22.04.2017, 16:23
how to fix my god command
i just install this Include weapon-config.inc https://sampforum.blast.hk/showthread.php?tid=563387
and my command not work
i just install this Include weapon-config.inc https://sampforum.blast.hk/showthread.php?tid=563387
and my command not work
PHP код:
CMD:god(playerid, params[])
{
new str1[128], str2[128], admin[MAX_PLAYER_NAME], p[MAX_PLAYER_NAME], id, Float: health1, Float:health2;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x800000AA, "You must be Admin to use this command");
GetPlayerHealth(playerid, health1);
if(sscanf(params, "d", id))
{
if (health1==0.0)
{
god_mode[playerid] = 0;
SetPlayerHealth(playerid, 100.0);
return SendClientMessage(playerid,green, "Back to mortality.");
}
if (health1>0.0)
{
god_mode[playerid] = 1;
SetPlayerHealth(playerid, 0x7F800000);
return SendClientMessage(playerid, green, "You are god now!");
}
}
if(IsPlayerConnected(id))
{
GetPlayerName(playerid, admin, MAX_PLAYER_NAME);
GetPlayerName(id, p, MAX_PLAYER_NAME);
GetPlayerHealth(id, health2);
if (health2>0.0)
{
god_mode[playerid] = 1;
SetPlayerHealth(id, 0x7F800000);
format(str2, sizeof(str2), "You have successfully turned %s into god.", p);
SendClientMessage(playerid, green, str2);
format(str1, sizeof(str1), "Admin %s has turned you into god!", admin);
SendClientMessage(id, green, str1);
}
if (health2==0)
{
god_mode[playerid] = 0;
SetPlayerHealth(id, 100.0);
format(str2, sizeof(str2), "You have turned god %s into human.", p);
SendClientMessage(playerid, green, str2);
return SendClientMessage(id, green, "Back to mortality.");
}
}
else SendClientMessage(playerid, 0x800000AA, "ERROR: Player is not connected.");
return 1;
}