08.06.2013, 20:06
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.
Let me know if you need help making this work with your /call and /text cmds
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(playerid, COLOR_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;
}