Automatic Gate with Command?
#2

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.

pawn Код:
new starsgate; //This is the variable
Now link the Variable with the Object:

pawn Код:
starsgate = CreateObject(...); //This is the Gate which is CLOSED
Next we have to create the command under OnPlayerCommandText:
pawn Код:
if(strcmp(cmd, "/starsgate", true) == 0) //This is the Command
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...
pawn Код:
if(strcmp(cmd, "/starsgate", true) == 0)
{
      if(PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 3)
      //Asks if playerid is in gang 3
Now we have to add the function with MoveObject:
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
      }
}
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:
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");
      }
}
But when you do not have "PlayerInfo" then try this:

pawn Код:
new PlayerInfo[MAX_PLAYERS][pInfo];
enum pInfo
{
      pLeader
      pMember
}
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.
Reply


Messages In This Thread
Automatic Gate with Command? - by ServerScripter - 10.07.2011, 19:39
Re: Automatic Gate with Command? - by xXGaryXx - 10.07.2011, 20:03
Re : Automatic Gate with Command? - by ServerScripter - 10.07.2011, 20:10
Re : Automatic Gate with Command? - by ServerScripter - 10.07.2011, 20:18
Re: Automatic Gate with Command? - by xXGaryXx - 10.07.2011, 20:28
Re : Automatic Gate with Command? - by ServerScripter - 11.07.2011, 19:45
Re : Automatic Gate with Command? - by ServerScripter - 11.07.2011, 20:30
Re: Automatic Gate with Command? - by Noner - 11.07.2011, 20:53
Re : Automatic Gate with Command? - by ServerScripter - 11.07.2011, 21:00
Re: Re : Automatic Gate with Command? - by Noner - 11.07.2011, 21:04

Forum Jump:


Users browsing this thread: 2 Guest(s)