SA-MP Forums Archive
Help !! How to set Enable/Desable - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help !! How to set Enable/Desable (/showthread.php?tid=153140)



Help !! How to set Enable/Desable - Yaszine - 07.06.2010

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


Re: Help !! How to set Enable/Desable - Aleksandar_Zivanovci - 07.06.2010

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;
}