Trying to make a toggle phone system
#4

Your code isn't going to work you need to make a player array or else when 1 player uses the command EVERYONES phone will turn off.

PHP код:
new bool:PhoneOn[MAX_PLAYERS];//we will use a bool here since it is more efficient to do so when possible
PhoneOn[playerid] = true//put this in OnPlayerConnect so their phone is on when they spawn
    
CMD:poweron(playerid,params[])
    {
        if(
PlayerInfo[playerid][Cell]<=1)return SendClientMessage(playeridCOLOR_GREY"You don't own a cellphone.");
        if(
PhoneOn[playerid] == true)
       {
           
SendClientMessage(playerid,COLOR_GREY,"You have shut off your phone");
           
PhoneOn[playerid] = false;
       }
       else
       {
             
SendClientMessage(playerid,COLOR_GREY,"Your phone is now on");
             
PhoneOn[playerid] = true;
       }
       return 
1;
 } 
Let me know if you need help making this work with your /call and /text cmds
Reply


Messages In This Thread
Trying to make a toggle phone system - by Goldilox - 08.06.2013, 19:53
Re: Trying to make a toggle phone system - by mastermax7777 - 08.06.2013, 19:54
Re: Trying to make a toggle phone system - by Goldilox - 08.06.2013, 19:56
Re: Trying to make a toggle phone system - by random123 - 08.06.2013, 20:06
Re: Trying to make a toggle phone system - by Goldilox - 08.06.2013, 20:53
Re: Trying to make a toggle phone system - by DobbysGamertag - 08.06.2013, 20:55
Re: Trying to make a toggle phone system - by Goldilox - 08.06.2013, 21:39

Forum Jump:


Users browsing this thread: 1 Guest(s)