06.03.2014, 21:59
i have made this now:
first of all add this near the other enums and news:
Under OnPlayerConnect
and the command:
if you want the command only for admins:
and for all of the players:
and under OnPlayerTakeDamage:
0.3z
0.3x:
first of all add this near the other enums and news:
pawn Код:
new Godmode[MAX_PLAYERS];
pawn Код:
Godmode[playerid] = 0;
if you want the command only for admins:
pawn Код:
CMD:god(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1 && IsPlayerConnected(playerid))
{
if(Godmode[playerid] == 0)
{
Godmode[playerid] = 1;
SetPlayerHealth(playerid, 99999);
SetPlayerArmour(playerid, 99999);
SendClientMessage(playerid, -1, "You have enabled the god mode");
}
if(Godmode[playerid] == 1)
{
Godmode[playerid] = 0;
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0);
SendClientMessage(playerid, -1, "You have disabled the god mode");
}
}
else
{
SendClientMessage(playerid, -1, "You are not an admin");
}
return 1;
}
pawn Код:
CMD:god(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(Godmode[playerid] == 0)
{
Godmode[playerid] = 1;
SetPlayerHealth(playerid, 99999);
SetPlayerArmour(playerid, 99999);
SendClientMessage(playerid, -1, "You have enabled the god mode");
}
if(Godmode[playerid] == 1)
{
Godmode[playerid] = 0;
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0);
SendClientMessage(playerid, -1, "You have disabled the god mode");
}
}
else
{
SendClientMessage(playerid, -1, "You are not logged in");
}
return 1;
}
0.3z
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(Godmode[playerid] == 1) return 0;
}
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(Godmode[playerid] == 1) return 0;
}