Moving gates with pass?
#2

PHP код:
new    Gate,
    
bool:IsOpened,
    
password[24] = "your_password";

//public OnGameModeInit()
Gate CreateObject(...); //create closed gate
IsOpened false//set it's status to closed

//public OnPlayerCommandText(playerid,cmdtext[])
    
if(!strcmp("/gate",cmdtext,true))
    {
        if(!
IsPlayerInRangeOfPoint(playerid,10.0,x,y,z)) return SendClientMessage(playerid,-1"You aren't near any gate!");//replace with your gate x,y,z
        
if(strlen(cmdtext) < 7) return SendClientMessage(playerid,-1,"Usage: /gate [password]");
        if(
strcmp(cmdtext[7],password,true)) return SendClientMessage(playerid,-1,"Wrong Password!");
        switch(
IsOpened)
        {
            case 
true:
            {
                
IsOpened false;
                
SendClientMessage(playerid,-1,"Gate is closing!");
                
MoveObject(Gate,...); //co-ordinates of closed gate
            
}
               case 
false:
               {
                   
IsOpened true;
                
SendClientMessage(playerid,-1,"Gate is opening!");
                
MoveObject(Gate,...); //co-ordinates of opened gate
            
}
        }
        return 
1;
    } 
It would be easier with ZCMD. I guess you use strcmp for commands
Reply


Messages In This Thread
Moving gates with pass? - by reckst4r - 24.11.2011, 06:53
Re: Moving gates with pass? - by [MG]Dimi - 24.11.2011, 07:05
Re: Moving gates with pass? - by reckst4r - 24.11.2011, 07:15
Re: Moving gates with pass? - by [MG]Dimi - 24.11.2011, 07:43
Re: Moving gates with pass? - by reckst4r - 24.11.2011, 07:47
Re: Moving gates with pass? - by [MG]Dimi - 24.11.2011, 07:47
Re: Moving gates with pass? - by reckst4r - 24.11.2011, 07:49
Re: Moving gates with pass? - by reckst4r - 24.11.2011, 10:04

Forum Jump:


Users browsing this thread: 3 Guest(s)