Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Trying to set Group perm ability on vehicle

al Langdon
Registered User
Join date: 9 Sep 2004
Posts: 6
09-23-2006 17:06
Any help would be appreciated, new scriptor here.....LOL. Trying to get script to recognize either the owner or anyone in the group that the vehicle is set to, so that they and only they can drive the vehicle. Works fine for the owner now but group members still cant drive. The following is the decision tree I am trying to use....

Global setting of ....ingroup = TRUE

changed(integer change)
{
if (change & CHANGED_LINK)
{

key user = llAvatarOnSitTarget();
key objectowner;

if (user)

{
group = llDetectedGroup(0);
user = llDetectedKey(0);
objectowner = llGetOwner();


if ((user == objectowner)||(group && ingroup))
{
// You sit and are permitted so get controls
llSetStatus(STATUS_PHYSICS, TRUE);
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, TRUE);
llRequestPermissions(user,PERMISSION_TAKE_CONTROLS);

}
else
{
llSay(0, "Sorry, You do not have permission to drive";);
llUnSit(user);
llPushObject(user, <0,0,1>, ZERO_VECTOR, FALSE);
}
}


This is only the section for permissions, and as I said it works fine for the owner but....
anyone else in group or not is being allowed to sit with no push, and still getting the "Sorry mesage". I know i must have a logic error or something but any help would sure be welcome. Thx in advance!
Jesse Malthus
OMG HAX!
Join date: 21 Apr 2006
Posts: 649
09-23-2006 18:04
Replace group && ingroup with llSameGroup(user)
Then set the object's group to your group.
_____________________
Ruby loves me like Japanese Jesus.
Did Jesus ever go back and clean up those footprints he left? Beach Authority had to spend precious manpower.
Japanese Jesus, where are you?
Pragmatic!
al Langdon
Registered User
Join date: 9 Sep 2004
Posts: 6
09-23-2006 18:12
Thanks Jesse, will check it out right away.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
09-23-2006 18:32
Hmm. Also, I don't think you can use the 'llDetected...()' functions from the 'changed' event handler. As far as I know they only work for touch, collision, and sensor event handlers.
al Langdon
Registered User
Join date: 9 Sep 2004
Posts: 6
09-23-2006 18:32
Unfortunately it didnt work, and i also tried to use llSameGroup(objectowner) which seemed more appropriate to me but it still didnt work, still fall thru to the Sorry Msg and still dont get unsat or pushed. Any more ideas??
al Langdon
Registered User
Join date: 9 Sep 2004
Posts: 6
09-23-2006 18:37
If I cant detect the Group or the User ID, what other way can I make this determination for permissions. I'm stumped!
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
09-24-2006 00:50
llDetected* does not work in the changed() event.

CODE
changed(integer change)
{
if (change & CHANGED_LINK)
{

key user = llAvatarOnSitTarget();

if ((user == llGetOwner()) || llSameGroup(user))
{
// You sit and are permitted so get controls
llSetStatus(STATUS_PHYSICS, TRUE);
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, TRUE);
llRequestPermissions(user,PERMISSION_TAKE_CONTROLS );

}
else
{
llSay(0, "Sorry, You do not have permission to drive");
llUnSit(user);
llPushObject(user, <0,0,1>, ZERO_VECTOR, FALSE);
}
}
}
_____________________
al Langdon
Registered User
Join date: 9 Sep 2004
Posts: 6
09-24-2006 09:47
Wonderful, that did it! Thanks so much for you assistance everyone, and Jillian you are responsible for making my whole week end!!!!!! TY so much!
bargain Walcott
Registered User
Join date: 31 Oct 2005
Posts: 248
10-20-2008 21:07
How would you change this to allow "anyone" to ride?