#4

here you go sir you just had to check gatestatus value on the command, for that you can use if or switch

PHP код:
COMMAND:gate(playeridparams[])
{
    if(
PlayerStat[playerid][Dead] == || PlayerStat[playerid][InHospital] == 1) return SendClientMessage(playeridGREY"You are unconscious.");
    if(
PlayerStat[playerid][FactionID] < 1) return SendClientMessage(playeridGREY"You are not a Prison Guard/Doctor.");
    if(
IsPlayerInRangeOfPoint(playerid5, -21.93213, -338.946237.83163))
    {
        switch(
gatestatus)
        {
            case 
0:
            {
                new 
str[128];
                
gatestatus 1;
                
MoveObject(gate, -21.93213, -338.94623, -4.831631);
                
format(strsizeof(str), "* %s opens the prison gate."GetICName(playerid));
                  
SendNearByMessage(playeridACTION_COLORstr3);
            }
            case 
1:
            {
                new 
str[128];
                
gatestatus 0;
                
MoveObject(gate, -21.93213, -338.946237.831631);
                
format(strsizeof(str), "* %s closes the prison gate."GetICName(playerid));
                  
SendNearByMessage(playeridACTION_COLORstr3);
            }
        }
    }
    return 
1;

What is if?
What is switch?
Reply


Messages In This Thread
How - by darkhunter332 - 30.07.2016, 07:35
Re: How - by Ahmed21 - 30.07.2016, 07:59
Re: How - by darkhunter332 - 30.07.2016, 08:02
Re: How - by jlalt - 30.07.2016, 08:10
Re: How - by darkhunter332 - 30.07.2016, 08:19
Re: How - by Ahmed21 - 30.07.2016, 08:34
Re: How - by darkhunter332 - 30.07.2016, 08:35

Forum Jump:


Users browsing this thread: 1 Guest(s)