If Get Player health >100
#4

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:
pawn Код:
new IsAFK[MAX_PLAYERS];
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;
}
Reply


Messages In This Thread
If Get Player health >100 - by MahdiGames - 12.01.2014, 23:13
Re: If Get Player health >100 - by Kirollos - 13.01.2014, 00:15
Re: If Get Player health >100 - by xZdadyZx - 13.01.2014, 06:03
Re: If Get Player health >100 - by Dignity - 13.01.2014, 07:45
Re: If Get Player health >100 - by MahdiGames - 13.01.2014, 07:46
Re: If Get Player health >100 - by MahdiGames - 13.01.2014, 07:51
Re: If Get Player health >100 - by Dignity - 13.01.2014, 07:52
Re: If Get Player health >100 - by MahdiGames - 13.01.2014, 07:55
Re: If Get Player health >100 - by Dignity - 13.01.2014, 07:57
Re: If Get Player health >100 - by MahdiGames - 13.01.2014, 07:59

Forum Jump:


Users browsing this thread: 1 Guest(s)