GodMode - 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)
+--- Thread: GodMode (
/showthread.php?tid=286943)
GodMode -
Kostas' - 01.10.2011
Hey, I have a command for god on/off. I want when a player have /god and kill someone automatically his health set to 0 and die. How can i do this.
pawn Код:
if (strcmp("/godon", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid,0xAA3333AA,">>");
SendClientMessage(playerid,COLOR_RED,"GodMod ON!");
SetPlayerHealth(playerid,99999);
return 1;
}
if (strcmp("/godoff", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid,0xAA3333AA,">>");
SendClientMessage(playerid,COLOR_RED,"GodMod OFF!");
SetPlayerHealth(playerid,100);
return 1;
}
Re: GodMode -
Raimis_R - 01.10.2011
pawn Код:
new bool:GodOrder[MAX_PLAYERS];
if (strcmp("/godon", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid,0xAA3333AA,">>");
SendClientMessage(playerid,COLOR_RED,"GodMod ON!");
SetPlayerHealth(playerid,99999);
GodOrder[playerid] = true;
return 1;
}
if (strcmp("/godoff", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid,0xAA3333AA,">>");
SendClientMessage(playerid,COLOR_RED,"GodMod OFF!");
SetPlayerHealth(playerid,100);
GodOrder[playerid] = false;
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if (GorOrder[killerid])
{
SetPlayerHealth(killerid, -1);
GorOrder[killerid] = false;
}
return 1;
}
Re: GodMode -
Jafet_Macario - 01.10.2011
pawn Код:
new bool: God[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
if(God[killerid] == true && killerid != INVALID_PLAYER_ID)
{
SetPlayerHealth(killerid, 0);
God[killerid] = false;
}
return 1;
}
if (strcmp("/godon", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid,0xAA3333AA,">>");
SendClientMessage(playerid,COLOR_RED,"GodMod ON!");
SetPlayerHealth(playerid,99999);
God[playerid] = true;
return 1;
}
if (strcmp("/godoff", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid,0xAA3333AA,">>");
SendClientMessage(playerid,COLOR_RED,"GodMod OFF!");
SetPlayerHealth(playerid,100);
God[playerid] = false;
return 1;
}
EDIT: User above was faster
Re: GodMode -
Kostas' - 01.10.2011
Thanks!
Re: GodMode -
Kingunit - 01.10.2011
By the way, your script isn't really a godmode. I can easy kill you with a minigun or something else. Use a timer for that.
Re: GodMode -
lolumadd_ - 01.10.2011
pawn Код:
#define INFINITY (Float:0x7F800000)
pawn Код:
SetPlayerHealth(playerid, INFINITY);
That is really god mode, you cannot die.