29.06.2012, 04:39
How could i make a command like /god that when I activate it, i won't loose health? Sounds simple ish but not really sure.
if(strcmp(cmd, "/god", true) == 0) { GetPlayerName(playerid, AdminName, sizeof(playername)); if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pAdmin] >= 1) { if(PlayerInfo[playerid][pAOnDuty] == 0) { SetPlayerColor(playerid, COLOR_LIGHTBLUE); PlayerInfo[playerid][pAOnDuty] = 1; SendClientMessage(playerid, COLOR_GRAD2, "You are now on-duty as an admin, Please do your best!."); SetPlayerHealth(playerid, 100); SetPlayerArmour(playerid, 100); format(string, sizeof(string), "%s is now on-duty as an admin.", AdminName); SendClientMessageToAll(COLOR_YELLOW, string); return 1; } else { SetPlayerColor(playerid, COLOR_INVIS); PlayerInfo[playerid][pAOnDuty] = 0; SendClientMessage(playerid, COLOR_GRAD2, "You are not longer on-duty as admin, notice to /reports please!."); SetPlayerHealth(playerid, 100); SetPlayerArmour(playerid, 0); format(string, sizeof(string), "%s is no longer on-duty as admin.", AdminName); SendClientMessageToAll(COLOR_YELLOW, string); return 1; } } else { SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!"); } } return 1; }
new AdminName[MAX_PLAYER_NAME];
I want a command that when you type /god you won't take damage.
If you read.. It says what i want, also, who said I was mad.. |
CMD:god(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 SendClientMessage(playerid, 0xFF0000FF, "God mode Enabled"); } 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 SendClientMessage(playerid, 0xFF0000FF, "God mode Disabled"); } return 1; }