CMD:godmode(playerid) { new Float:health; GetPlayerHealth(playerid, health); if (health == 100) { SetPlayerHealth(playerid, 90000.0); SendClientMessageToAll(0xFFFF00AA, "A player has enabled godmode!"); } else if(health == 90000.0 ) { SetPlayerHealth(playerid, 100.0); SendClientMessageToAll(0xFFFF00AA, "A player has disabled godmode!"); } return 1; } |
CMD:godmode(playerid, params[])
{
if(GodMode[playerid] == 0)
{
SetPlayerHealth(playerid, HEALTHHERE);
}
else if(GodMode[playerid] == 1)
{
SetPlayerHealth(playerid, HEALTHHERE);
}
return 1;
}
new GodMode[MAX_PLAYERS];
GodMode[playerid] = 0;
#define INFINITY (Float:0x7F800000)
new GodMode[MAX_PLAYERS];
CMD:godmode(playerid, params[])
{
if(GodMode[playerid] == 0) //god mode not set, lets set it
{
SetPlayerHealth(playerid, INFINITY); //set the health to infinity
GodMode[playerid] = 1; //set godmode to true
}
else if(GodMode[playerid] == 1) //god mode set .. lets unset it
{
SetPlayerHealth(playerid, 100.0); //set health to 100%
GodMode[playerid] = 0; //set godmode to false
}
return 1;
}
#define INFINITY (Float:0x7F800000)
CMD:godmode(playerid, params[])
{
new Float:health;
GetPlayerHealth(playerid, health);
if(health > 100.0) //god mode set .. lets unset it
{
SetPlayerHealth(playerid, 100.0); //set health to 100%
}
else //god mode not set, lets set it
{
SetPlayerHealth(playerid, INFINITY); //set the health to infinity
}
return 1;
}
CMD:godmode(playerid) {
new
Float: health
;
GetPlayerHealth(playerid, health);
if(health <= 100.0) {
SetPlayerHealth(playerid, Float: 0x7F800000);
SendClientMessageToAll(0xFFFF00FF, "A player has enabled godmode!");
} else {
SetPlayerHealth(playerid, 100.0);
SendClientMessageToAll(0xFFFF00FF, "A player has disabled godmode!");
}
return true;
}
Why did you post once in Script Request Thread and here ?
Also just some little edits and done pawn Код:
|
Awesome, Jonny that worked.
Any idea how I could modify what ive done so that my global messages saying a player is using godmode/isnt using godmode can be changed to display the actual players name instead of just the word player? Sorry, I'll delete my post there :C |
#define INFINITY (Float:0x7F800000)
new GodMode[MAX_PLAYERS];
CMD:godmode(playerid, params[])
{
if(GodMode[playerid] == 0) //god mode not set, lets set it
{
SetPlayerHealth(playerid, INFINITY); //set the health to infinity
GodMode[playerid] = 1; //set godmode to true
SendClientMessageToAll(COLOR_RED, " An Admin is now in god mode!");
}
else if(GodMode[playerid] == 1) //god mode set .. lets unset it
{
SetPlayerHealth(playerid, 100.0); //set health to 100%
GodMode[playerid] = 0; //set godmode to false
SendClientMessageToAll(COLOR_RED, "An Admin is now in god mode!");
}
return 1;
}
new strOut[50],pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName);
format(strOut,50,"%s has enabled godmode!",pName);
SendClientMessageToAll(0xFFFF00AA, strOut);
@Edward156
thats not even close to what they asked!!! @OP yes you use format and getplayername something like pawn Код:
|
Ok I have done what you are explaining in both parts and I got 2 warnings.
C:\Users\Kurtis\Desktop\GTA - San Andreas\Pawno\gamemodes\learning.pwn(48 ![]() C:\Users\Kurtis\Desktop\GTA - San Andreas\Pawno\gamemodes\learning.pwn(497) : warning 202: number of arguments does not match definition Why did I receive these? what can I do to fix. Edit: Oh, its because I do not have pName defined anywhere as anything right? |