Health & Armor On Disconnect
#1

How do I make the disconnect message say the following incase a player times out:

(_AcE_) has left the server (Lost Connection) (HP: 100) (Armor: 25)

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    First[playerid] = 0;
    new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    switch(reason)
    {
        case 0: format(string, sizeof(string), "** %s has left the server. (Lost Connection)", pname);
        case 1: format(string, sizeof(string), "** %s has left the server. (Leaving)", pname);
        case 2: format(string, sizeof(string), "** %s has left the server. (Kicked)", pname);
    }
    SendClientMessageToAll(COLOR_ERROR, string);
    return 1;
}
Reply
#2

pawn Код:
switch(reason)
    {
        case 0: format(string, sizeof(string), "** %s has left the server HP: %0.f Armour %0.f.. (Lost Connection)", pname, GetPlayerHealth(playerid),GetPlayerArmour(playerid));
        case 1: format(string, sizeof(string), "** %s has left the server HP: %0.f Armour %0.f. (Leaving)", pname, GetPlayerHealth(playerid),GetPlayerArmour(playerid));
        case 2: format(string, sizeof(string), "** %s has left the server HP %0.f Armour %0.f . (Kicked)", pname, GetPlayerHealth(playerid),GetPlayerArmour(playerid));
    }
Reply
#3

EDIT:
Код:
warning 202: number of arguments does not match definition
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    First[playerid] = 0;
    new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    if(isclanwarstarted == 0)
    {
        switch(reason)
        {
            case 0: format(string, sizeof(string), "** %s has left the server. (Lost Connection)", pname);
            case 1: format(string, sizeof(string), "** %s has left the server. (Leaving)", pname);
            case 2: format(string, sizeof(string), "** %s has left the server. (Kicked/Banned)", pname);
        }
    }
    else if(isclanwarstarted == 1)
    {
        switch(reason)
        {
            case 0: format(string, sizeof(string), "** %s has left the server. (Lost Connection)(HP: %0.f) (Armour: %0.f)", pname, GetPlayerHealth(playerid),GetPlayerArmour(playerid));
            case 1: format(string, sizeof(string), "** %s has left the server. (Leaving)(HP: %0.f) (Armour: %0.f)", pname, GetPlayerHealth(playerid),GetPlayerArmour(playerid));
            case 2: format(string, sizeof(string), "** %s has left the server. (Kicked/Banned)(HP: %0.f) (Armour: %0.f)", pname, GetPlayerHealth(playerid),GetPlayerArmour(playerid));
        }
    }
    SendClientMessageToAll(COLOR_ERROR, string);
    return 1;
}
HELP PLS
Reply
#4

new Float:Health;
GetPlayerHealth(playerid, Health);
etc with armour
Reply
#5

Yeah, I fixed it, thanks for help though.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)