help with some commands - 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: help with some commands (
/showthread.php?tid=497341)
help with some commands -
Extraordinariness - 26.02.2014
So basically I'm creating a gm now, how do I create it with timers(10 seconds)? cus sometimes they'll just escape death.
you know /god command right? It becomes ON and OFF. so how do I do it? If I set his health into 10000 how do I reset his old health?

[NOTE: +REP]
Re: help with some commands -
Ryan_Undering - 26.02.2014
Quote:
Originally Posted by Extraordinariness
So basically I'm creating a gm now, how do I create it with timers(10 seconds)? cus sometimes they'll just escape death.
you know /god command right? It becomes ON and OFF. so how do I do it? If I set his health into 10000 how do I reset his old health?  [NOTE: +REP]
|
Try:
pawn Код:
new OldHealth[MAX_PLAYERS];
new bool:GodMode[MAX_PLAYERS]; //New variable to store old health
// Then in a command... (zcmd for example)
CMD:god(playerid, params[])
{
//if admin blah blah blah;
if (GodMode[playerid] == false)
{
GetPlayerHealth(playerid, OldHealth[playerid]);
SetPlayerHealth(playerid, 10000);
GodMode = true;
}
else
{
SetPlayerHealth(playerid, OldHealth[playerid]);
GodMode = false;
}
return 1;
}
*This is untested, it may not work perfectly, but you get the idea if you have even the most basic of pawno knowledge.
Re: help with some commands -
Threshold - 26.02.2014
Close.
pawn Код:
new Float:OldHealth[MAX_PLAYERS]; //This will store the player's original health.
new bool:GodMode[MAX_PLAYERS]; //This will determine whether the player has godmode activated or not.
public OnPlayerConnect(playerid)
{
OldHealth[playerid] = 100.0;
GodMode[playerid] = false;
return 1;
}
// Then in a command... (zcmd for example)
CMD:god(playerid, params[])
{
//if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "Only administrators can use this command.");
if(!GodMode[playerid])
{
GetPlayerHealth(playerid, OldHealth[playerid]);
SetPlayerHealth(playerid, (Float:0x7F800000));
GodMode[playerid] = true;
}
else if(GodMode[playerid])
{
SetPlayerHealth(playerid, OldHealth[playerid]);
GodMode[playerid] = false;
}
return 1;
}
Re: help with some commands -
Aerotactics - 26.02.2014
Quote:
Originally Posted by BenzoAMG
Close.
pawn Код:
new Float:OldHealth[MAX_PLAYERS]; //This will store the player's original health. new bool:GodMode[MAX_PLAYERS]; //This will determine whether the player has godmode activated or not.
public OnPlayerConnect(playerid) { OldHealth[playerid] = 100.0; GodMode[playerid] = false; return 1; }
// Then in a command... (zcmd for example) CMD:god(playerid, params[]) { //if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "Only administrators can use this command."); if(!GodMode[playerid]) { GetPlayerHealth(playerid, OldHealth[playerid]); SetPlayerHealth(playerid, (Float:0x7F800000)); GodMode[playerid] = true; } else if(GodMode[playerid]) { SetPlayerHealth(playerid, OldHealth[playerid]); GodMode[playerid] = false; } return 1; }
|
OBJECTION!
Not quite, is he asking for the playerid that typed the command, or for the command to select which playerid to godmode?
Re: help with some commands -
Threshold - 26.02.2014
No, he isn't. So he has what he wanted.
Re: help with some commands -
Extraordinariness - 27.02.2014
Thanks, for everyone helpewd.+repped all I can.
SORRY, I forgot the thread so I just checked this out now