Stats command
#1

~~~~~~
Reply
#2

You had a extra bracket.
PHP код:
CMD:stats(playerid,params[])
{
    new 
pID;
    if(
sscanf(params"u"pID))
    {
        new 
string[32];
        
format(stringsizeof (string), "~p~%s (%d)"PlayerName(playerid), playerid);
        
PlayerTextDrawSetString(playeridStatsTextDraw[4][playerid], string);
        
format(stringsizeof (string), "~g~%d"pStats[playerid][Kills]);
        
PlayerTextDrawSetString(playeridStatsTextDraw[6][playerid], string);
        
format(stringsizeof (string), "~g~%d"pStats[playerid][Deaths]);
        
PlayerTextDrawSetString(playeridStatsTextDraw[7][playerid], string);
        
format(stringsizeof (string), "~g~%d"pStats[playerid][Rapes]);
        
PlayerTextDrawSetString(playeridStatsTextDraw[10][playerid], string);
        
format(stringsizeof (string), "~g~%d"pStats[playerid][DrugsTaken]);
        
PlayerTextDrawSetString(playeridStatsTextDraw[11][playerid], string);
        
format(stringsizeof (string), " ~g~%d ~b~Game Days"pStats[playerid][DaysPlayed]);
        
PlayerTextDrawSetString(playeridStatsTextDraw[13][playerid], string);
        
format(stringsizeof (string), "  ~g~%d"GetPlayerScore(playerid));
        
PlayerTextDrawSetString(playeridStatsTextDraw[15][playerid], string);
        
format(stringsizeof (string), "~g~%d"pStats[playerid][BonusKills]);
        
PlayerTextDrawSetString(playeridStatsTextDraw[17][playerid], string);
        
PlayerTextDrawShow(playeridStatsTextDraw[0][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[1][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[2][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[3][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[4][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[5][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[6][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[7][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[8][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[9][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[10][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[11][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[12][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[13][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[14][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[15][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[16][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[17][playerid]);
    }
    else
    {
        if(!
IsPlayerConnected(pID)) return SendClientMessage(playeridCOLOR_RED"This Player Is Not Connected.");
//      pStats[pID][Score] = GetPlayerScore(pID);
//      pStats[pID][Money] = GetPlayerMoney(pID);
        
new string[32];
        
format(stringsizeof (string), "~p~%s (%d)"PlayerName(pID), pID);
        
PlayerTextDrawSetString(playeridStatsTextDraw[4][playerid], string);
        
format(stringsizeof (string), "~g~%d"pStats[pID][Kills]);
        
PlayerTextDrawSetString(playeridStatsTextDraw[6][playerid], string);
        
format(stringsizeof (string), "~g~%d"pStats[pID][Deaths]);
        
PlayerTextDrawSetString(playeridStatsTextDraw[7][playerid], string);
        
format(stringsizeof (string), "~g~%d"pStats[pID][Rapes]);
        
PlayerTextDrawSetString(playeridStatsTextDraw[10][playerid], string);
        
format(stringsizeof (string), "~g~%d"pStats[pID][DrugsTaken]);
        
PlayerTextDrawSetString(playeridStatsTextDraw[11][playerid], string);
        
format(stringsizeof (string), "%d Game Days"pStats[pID][DaysPlayed]);
        
PlayerTextDrawSetString(playeridStatsTextDraw[13][playerid], string);
        
format(stringsizeof (string), "~g~%d"GetPlayerScore(playerid));
        
PlayerTextDrawSetString(playeridStatsTextDraw[15][playerid], string);
        
format(stringsizeof (string), "~g~%d"pStats[pID][BonusKills]);
        
PlayerTextDrawSetString(playeridStatsTextDraw[17][playerid], string);
        
PlayerTextDrawShow(playeridStatsTextDraw[0][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[1][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[2][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[3][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[4][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[5][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[6][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[7][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[8][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[9][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[10][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[11][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[12][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[13][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[14][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[15][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[16][playerid]);
        
PlayerTextDrawShow(playeridStatsTextDraw[17][playerid]);
    }
    return 
1;

Reply
#3

~~~~~~
Reply
#4

I am not really sure but its caused becouse of that. You should edit this
pawn Код:
if(sscanf(params, "u", pID)) //becouse this means if he didn't used correct format
Try it:
pawn Код:
if(!sscanf(params, "u", pID)) //code continues
Reply
#5

~~~~~~
Reply
#6

Well actually the else statement down means if he didn't entered command correctly /spec ID that means so put here some SCM for example
pawn Код:
else return SendClientMessage(playerid, -1, "Usage /spec ID");
Reply
#7

~~~~~~
Reply
#8

aww okay, but then I don't understand why you use this
pawn Код:
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "This Player Is Not Connected.");
when you are checking only you?

Also why are you working with pID parameter in else statement, when you are checking only you? pID is in sscanf "targetid"
Reply
#9

~~~~~~
Reply
#10

Use:
pawn Код:
TextDrawShowForPlayer(playerid, Text:Text);
More information here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)