Godmode:
Top of script:
pawn Код:
new GodMode[MAX_PLAYERS];
An example of how you could do it:
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
if(GodMode[damagedid] = 1) // If godmode = true for damagedid (victim)
{
GameTextForPlayer(playerid, "~r~This player is godmodded! You can not attack him!", 5000, 0); // Send this message to playerid (attacker)
return 1;
}
return 1;
}
An example of how it could look with zCMD: (Not tested, just done an all nighter so it is most likely messed up, but you get the idea).
pawn Код:
CMD:godmode(playerid, params[])
{
if(GodMode[playerid] < 1) // checking if godmode is off (left is less than right)
{
SendClientMessage(playerid, -1, "Godmode turned on!"); // give them a message
GodMode[playerid] = 1; // turn it on
// Code here (for health or w/e)
return 1; // return 1;
}
else if(GodMode[playerid] > 0) // if its more than 0,
{
GodMode[playerid] = 0; // set it to 0, so it's turned off
SendClientMessage(playerid, -1, "Godmode turned off!"); // let them know
// Remove that code here if you want
return 1; // return 1;
}
return 1;
}
AFK checker:
Top of script:
Coming straight from SA-MP wiki:
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
if(IsAFK[playerid] < 1) // checking if they are AFK
{
new message[32]; // new message
format(message, sizeof(message), "Player %d is AFK!", clickedplayerid); // format so we can display name
SendClientMessage(playerid, -1, message); // send the above message in "-1" (white)
return 1; // return 1;
}
return 1;
}
zCMD example again:
pawn Код:
CMD:afk(playerid, params[])
{
if(IsAFK[playerid] < 1) // if left is more than right...
{
SendClientMessage(playerid, -1, "You have gone AFK!"); // let them know
IsAFK[playerid] = 1; // set their variable
// Code here (for health or w/e)
return 1; // return 1;
}
else if(IsAFK[playerid] > 0) // if right is more than left
{
IsAFK[playerid] = 0; // turn it off
SendClientMessage(playerid, -1, "You have returned!"); // let them know
// Remove that code here if you want
return 1; // return 1;
}
return 1;
}