/check command not detecting Target's statistics correctly.
#2

You need to do these two lines before anything else

if(sscanf(params, "u",target)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /check [playerid]");
if(!IsPlayerConnected(target)) return SendClientMessage(playerid,COLOR_RED, "ERROR: Player ID is not connected.");

The code you have is always getting player with ID 0's stats.

Код:
CMD:check(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >=2)
    {
        new target;

        if(sscanf(params, "u",target)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /check [playerid]");
        if(!IsPlayerConnected(target)) return SendClientMessage(playerid,COLOR_RED, "ERROR: Player ID is not connected.");

        new string[200];
        format(string,sizeof(string), "%s's current statistics: Money: %d || VIP: %d || Kills: %d || Deaths: %d || Score: %d || Admin: %s || Talent: %s",GetName(target),PlayerInfo[target][pCash],PlayerInfo[target][pVip],PlayerInfo[target][pKills],PlayerInfo[target][pDeaths],PlayerInfo[target][pScore],GetAdminLvlName(target),GetTalentName(target));
        SendClientMessage(playerid,COLOR_GREEN, string);
    }
    else return SendClientMessage(playerid,COLOR_GREY, ERROR);
    return 1;
}

// If you want to have some more fun pretty sure this should work

public OnPlayerClickPlayer(playerid, clickedplayerid, source) { new strid[4]; valstr(strid, clickedplayerid); cmd_check(playerid, strid); }
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)