Moving gates with pass?
#1

Hello, I were hoping that some of you could help me creating a script to open gates with a password.
What I imagined the command to be was something like: /opengate "pass"
For example.. /opengate westsideholmes

Thanks in advance.
Reply
#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
#3

Thanks alot, and yes I am using ZCMD.

Is the sa-mp mapping tool easier/better than MTA Mapping tool?
I am new to the mapping thing..
Reply
#4

I got used to MTA so I use it but if I need to get default Mainland's object ID I use JernejL's Map Editor
Reply
#5

Thanks once again.
So, if you wanted to create a gate you would use MTA?
Reply
#6

Yes. But it's all about which is more comfortable to you.
Reply
#7

Well, I guess I use MTA since the other map tool is lagging for me.
Reply
#8

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
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
This script should be in my gamemode file (igrp.pwn) Right? Also the converted map file?
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)