new God[MAX_PLAYERS] = 0; if(strcmp("/god", cmdtext, true, 10) == 0) { if (God[playerid] == 1) { GameTextForPlayer(playerid, "~r~GOD ~r~MODE ~r~DISABLED", 3000, 3); SetPlayerHealth(playerid, 100); God[playerid] = 0; return 1; } else if(God[playerid] == 0) { GameTextForPlayer(playerid, "~r~GOD ~r~MODE ~r~ENABLED", 3000, 3); God[playerid] = 1; SetPlayerArmour(playerid, 10000); SetPlayerHealth(playerid, 10000); return 1; } }
COMMAND:godon(playerid, params[]) { #pragma unused params if (God[playerid] == 1) { GameTextForPlayer(playerid, "~r~GOD ~r~MODE ~r~DISABLED", 3000, 3); SetPlayerHealth(playerid, 100); God[playerid] = 0; return 1; } else if(God[playerid] == 0) { GameTextForPlayer(playerid, "~r~GOD ~r~MODE ~r~ENABLED", 3000, 3); God[playerid] = 1; SetPlayerArmour(playerid, 10000); SetPlayerHealth(playerid, 10000); return 1; } }
To operate the command
1) You must have #include zcmd 2) You must delete OnPlayerCommandText Код:
COMMAND:godon(playerid, params[]) { #pragma unused params if (God[playerid] == 1) { GameTextForPlayer(playerid, "~r~GOD ~r~MODE ~r~DISABLED", 3000, 3); SetPlayerHealth(playerid, 100); God[playerid] = 0; return 1; } else if(God[playerid] == 0) { GameTextForPlayer(playerid, "~r~GOD ~r~MODE ~r~ENABLED", 3000, 3); God[playerid] = 1; SetPlayerArmour(playerid, 10000); SetPlayerHealth(playerid, 10000); return 1; } } |
COMMAND:godon(playerid, params[]) { #pragma unused params if (God[playerid] == 1) { GameTextForPlayer(playerid, "~r~GOD ~r~MODE ~r~DISABLED", 3000, 3); SetPlayerHealth(playerid, 100); God[playerid] = 0; return 1; } else { GameTextForPlayer(playerid, "~r~GOD ~r~MODE ~r~ENABLED", 3000, 3); God[playerid] = 1; SetPlayerArmour(playerid, 10000); SetPlayerHealth(playerid, 10000); return 1; } }
CMD:god(playerid, params[])
{
if(God[playerid])
{
GameTextForPlayer(playerid, "~r~GOD ~r~MODE ~r~DISABLED", 3000, 3);
SetPlayerHealth(playerid, 100);
God[playerid] = 0;
return 1;
}
else
{
GameTextForPlayer(playerid, "~r~GOD ~r~MODE ~r~DISABLED", 3000, 3);
SetPlayerHealth(playerid, 100);
God[playerid] = 1;
return 1;
}
return 1;
}
Remove the callback of OnPlayerCommandText since you won't use it and add this:
pawn Код:
|
CMD:god(playerid, params[])
{
#pragma unused params
// no admin check?
if(God[playerid])
{
GameTextForPlayer(playerid, "~r~GOD MODE DISABLED", 3000, 3);
SetPlayerHealth(playerid, 100);
God[playerid] = 0;
}
else
{
GameTextForPlayer(playerid, "~r~GOD MODE ENABLED", 3000, 3);
SetPlayerHealth(playerid, 100);
God[playerid] = 1;
}
return 1;
}
CMD:god(playerid, params[])
{
if(God[playerid])
{
GameTextForPlayer(playerid, "~r~GOD ~r~MODE ~r~DISABLED", 3000, 3);
SetPlayerHealth(playerid, 100);
God[playerid] = 0;
}
else
{
GameTextForPlayer(playerid, "~r~GOD ~r~MODE ~r~DISABLED", 3000, 3);
SetPlayerHealth(playerid, 100);
God[playerid] = 1;
}
return 1;
}
use
pawn Код:
|