06.04.2012, 10:06
I'm looking to give myself god mode in my script, but can't find the code. Can anyone help me? Thanks in advance.
I'm looking to give myself god mode in my script, but can't find the code. Can anyone help me? Thanks in advance.
|
SetPlayerHealth(playerid, 999999); //this sets your health to 999999 i.e unlimited.
CMD:god(playerid, params[])
{
SetPlayerHealth(playerid, 999999);
SetPlayerArmour(playerid, 999999);
SendClientMessage(playerid, C_GREEN, "You are now in godmode, good luck!");
SetPlayerColor(playerid, C_BLACK);
return 1;
}
Yeah, I thought of doing that myself. But I've been on other servers where they've had commands such as /god making them impossible to kill. Does "999999" do that then? Thanks for the quick response by the way.
|
new IsEnabled[MAX_PLAYERS]; // on the beginning of your script
IsEnabled[playerid] = 0; // put this on OnPlayerConnect and OnPlayerDisconnect.
CMD:godmod(playerid, params[])
{
if(IsEnabled[playerid] == 0)
{
SetPlayerHealth(playerid, 999999);
SetPlayerArmour(playerid, 999999);
SendClientMessage(playerid, -1, "You have enabled the GOD-MOD, type the command again to disable it.");
IsEnabled[playerid] = 1;
}
else
{
SendClientMessage(playerid, -1, "You have disabled the GOD-MOD, type the command again to enable it.");
IsEnabled[playerid] = 0;
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0);
}
return 1;
}