Godmode help - 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 help (
/showthread.php?tid=433748)
Godmode help -
NicholasA - 28.04.2013
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
if(PlayerVar[damagedid][Godmode] == 1)
{
SetPlayerHealth(damagedid,100);
}
return 1;
}
It works great but whenever the player falls off a building he dies. How can I make this system better?
Re: Godmode help -
Pro_Drifter - 28.04.2013
pawn Код:
This gonna help u
CMD:god(playerid, params[])
{
if(PlayerInfo[playerid][World] == TDMWorldID) return SendClientMessage(playerid, COLOR_RED, "you can't use this command in this world");
if(PlayerInfo[playerid][World] == DMWorldID) return SendClientMessage(playerid, COLOR_RED, "ERROR: you may not use this command in the Deathmatch World!");
if(PlayerInfo[playerid][AdminLevel] >= 3)
{
SendCommandToAdmins(playerid,"/god");
if(PlayerInfo[playerid][GodMode] == false)
{
SetPlayerHealth(playerid, 99999999);
SendClientMessage(playerid, COLOR_GREEN, "GodMode ON!");
PlayerInfo[playerid][GodMode] = true;
}
else if(PlayerInfo[playerid][GodMode] == true)
{
SetPlayerHealth(playerid, 100);
SendClientMessage(playerid, COLOR_RED, "GodMode OFF!");
PlayerInfo[playerid][GodMode] = false;
}
}
else return SendClientMessage(playerid, COLOR_RED, "ERROR: you need to be atleast Admin Level 3 to use this command");
return 1;
}
Re: Godmode help -
McFellow - 28.04.2013
set godmode health to like 9999
Re: Godmode help -
NicholasA - 28.04.2013
^ Those didn't help me, I know how to script guys, only thing is whenever he gets lots of damage at once he dies anyways
Re: Godmode help -
Isolated - 28.04.2013
try OnPlayerTakeDamage rather than OnPlayerGiveDamage.
EDIT: or get Sabrina to hit me up on skype and I'll fix it for you bud.
Re: Godmode help -
BigGroter - 28.04.2013
You could add it under OnPlayerUpdate();.
If godmode is on, set the HP to X.
Re: Godmode help -
Ananisiki - 28.04.2013
Why doesn't you use something like this?
pawn Код:
CMD:god(playerid, params[])
{
if(!IsCnRAdmin(playerid)) return UnknownCMD(playerid);
if(Dead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead.");
if(IsSpecing[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Spectating.");
if(God[playerid] == 0)
{
God[playerid] = 1;
SetPlayerHealth(playerid, 100000);
SendClientMessage(playerid, COLOR_GREEN, "God Mode ON.");
GivePlayerWeapon(playerid, 38, 100000);
AdminCMD(playerid, "GOD");
}
else
{
God[playerid] = 0;
SetPlayerHealth(playerid, 100);
SendClientMessage(playerid, COLOR_GREEN, "God Mode OFF.");
GivePlayerWeapon(playerid, 35, 0);
}
new log[256];
format(log, sizeof log, "Admin %s Has Used God", PlayerName(playerid));
LogToFile("god", log);
return 1;
}