22.04.2017, 16:40
PHP код:
CMD:god(playerid, params[])
{
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, 0x800000AA, "You must be Admin to use this command");
new id;
if(sscanf(params, "u", id))
id = playerid;
else
id = strval(params);
if (id == playerid)
{
if (god_model[playerid] == 1)
{
god_mode[playerid] = 0;
SetPlayerHealth(playerid, 100.0);
SendClientMessage(playerid, green, "Back to mortality.");
}
else
{
god_mode[playerid] = 1;
SetPlayerHealth(playerid, Float:0x7F800000);
SendClientMessage(playerid, green, "You are god now!");
}
}
else
{
if(IsPlayerConnected(id))
{
new admin[MAX_PLAYER_NAME], p[MAX_PLAYER_NAME], string[90];
GetPlayerName(playerid, admin, MAX_PLAYER_NAME);
GetPlayerName(id, p, MAX_PLAYER_NAME);
if (god_mode[id] == 0)
{
god_mode[id] = 1;
SetPlayerHealth(id, Float:0x7F800000);
format(string, sizeof(string), "You have successfully turned %s into god.", p);
SendClientMessage(playerid, green, string);
format(string, sizeof(string), "Admin %s has turned you into god!", admin);
SendClientMessage(id, green, string);
}
else
{
god_mode[id] = 0;
SetPlayerHealth(id, 100.0);
format(string, sizeof(string), "You have turned god %s into human.", p);
SendClientMessage(playerid, green, string);
SendClientMessage(id, green, "Back to mortality.");
}
}
else SendClientMessage(playerid, 0x800000AA, "ERROR: Player is not connected.");
}
return 1;
}