10.07.2011, 20:03
First you need the Object Gate which is Closed. You link this object with a variable. For an example starsgate.
First add this at the top of the script.
Now link the Variable with the Object:
Next we have to create the command under OnPlayerCommandText:
Next we have to ask if he is in the gang "stars" ( I think its something like a Gang ). For this step you need to get the number of the gang. I chose 3. BUT: This Step depends on the script...
Now we have to add the function with MoveObject:
Now the Gate will open if you type in /starsgate, but just if you are in Stars. To close it you can do the same thing again:
But when you do not have "PlayerInfo" then try this:
And now script this: if playerid is in the stars set [pMember] = 3 and if playerid is the leader of the stars set [pLeader] = 3.
First add this at the top of the script.
pawn Код:
new starsgate; //This is the variable
pawn Код:
starsgate = CreateObject(...); //This is the Gate which is CLOSED
pawn Код:
if(strcmp(cmd, "/starsgate", true) == 0) //This is the Command
pawn Код:
if(strcmp(cmd, "/starsgate", true) == 0)
{
if(PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 3)
//Asks if playerid is in gang 3
pawn Код:
if(strcmp(cmd, "/starsgate", true) == 0)
{
if(PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 3)
{
MoveObject(starsgate,x-pos,y-pos,z-pos,The speed of which the object will be moved with);
//Moves the Object
}
else
{
SendClientMessage(playerid,COLOR,"You are not in the Stars");
//If playerid is NOT in gang 3 send the message
}
}
pawn Код:
if(strcmp(cmd, "/closestarsgate", true) == 0)
{
if(PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 3)
{
MoveObject(starsgate,x-pos,y-pos,z-pos,The speed of which the object will be moved with);
}
else
{
SendClientMessage(playerid,COLOR,"You are not in the Stars");
}
}
pawn Код:
new PlayerInfo[MAX_PLAYERS][pInfo];
enum pInfo
{
pLeader
pMember
}