Help !! How to set Enable/Desable
#1

Hello all

i have this
pawn Код:
if(strcmp(cmdtext,"/god",true)==0)
{
SetPlayerHealth(playerid,100000);
SendClientMessage(playerid, COLOR_YELLOW, "Enabled.");
}
else
{
SetPlayerHealth(playerid,100);
SendClientMessage(playerid, COLOR_YELLOW, "Desabled.");
return 1;
}
But not work
the (Desabled) show if i type a wrong command
& /god is un wrong command
I need if you type for the first time /god
it enable the God
& in case of 2sd time -> desable
Thanks
Reply
#2

set global variable gGodMode[MAX_PLAYERS];

Код:
if(strcmp(cmd, "/god", true) == 0){
   if(gGodMode[playerid] == 0){
     SetPlayerHealth(playerid, 9999999);
     gGodMode[playerid] = 1;
   }else{
     SetPlayerHealth(playerid, 100);
     gGodMode[playerid] = 0;
   }
   return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)