PDA

View Full Version : [HELP] /check


Bokyyy
09/04/2012, 10:55 AM
Im talking about ZCMD /check command, where is the problem...in console Im getting sscanf warning, and if I do /check on some player its showing my "Name:" instead of his...


CMD:check(playerid,params[])
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
new targetid;
if(sscanf(params, "ui", playerid)) return SendClientMessage(playerid, COLOR_WHITE, "KORISTI: /check <playerid>");
else if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED,"Igrac nije pronadjen!");
else
{
ShowStats(playerid,targetid);
}
}
else SendClientMessage(playerid, COLOR_RED, "Nisi admin da koristis ovu komandu!");
return 1;
}



...adn ShowStats,

forward ShowStats(playerid,targetid);

public ShowStats(playerid,targetid)
{
new str[256];
new TName[MAX_PLAYER_NAME];
GetPlayerName(playerid,TName,MAX_PLAYER_NAME);
format(str, sizeof(str), COL_RED"Ime: "COL_WHITE"%s\n"COL_RED"Novci: "COL_WHITE"%d\n"COL_RED"Kills: "COL_WHITE"%d\n"COL_RED"Deaths: "COL_WHITE"%d\n", TName, PlayerInfo[targetid][pCash], PlayerInfo[targetid][pKills], PlayerInfo[targetid][pDeaths]);
ShowPlayerDialog(playerid, 100, DIALOG_STYLE_MSGBOX, COL_WHITE"|Statistike|",str,"Ok","");
return 1;
}

JRISETH
09/04/2012, 11:02 AM
Change


if(sscanf(params, "ui", playerid)) return SendClientMessage(playerid, COLOR_WHITE, "KORISTI: /check <playerid>");

to

if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "KORISTI: /check <playerid>");

Then..
Change

GetPlayerName(playerid,TName,MAX_PLAYER_NAME);

to

GetPlayerName(targetid,TName,MAX_PLAYER_NAME);