Making a stats command..
#5

Quote:
Originally Posted by HighFlyer
Посмотреть сообщение
Код:
command(stats, playerid, params[])
{
	new string[128];
	
	format(string, sizeof(string), "Player Stats: "); // depends what you want here, nick name?
	// Look at the message below, if you want a nick name, in the speech marks, set %u to find the nick name, and after the speech marks, set the enum and fields you want to get the data from.
	TextDrawShowForPlayer(playerid, STextdraw0);
	format(string, sizeof(string), "Score: %s", pInfo[playerid][pScore]); // looks for player's score...
	TextDrawShowForPlayer(playerid, STextdraw1); // this shows the textdraw using the string above
	format(string, sizeof(string), "Kills: %s", pInfo[playerid][pKills]);
	TextDrawShowForPlayer(playerid, STextdraw2);
	format(string, sizeof(string), "Deaths: %s", pInfo[playerid][pScore]);
	TextDrawShowForPlayer(playerid, STextdraw3);
	format(string, sizeof(string), "Robberies: %s", pInfo[playerid][pRobberies]);
	TextDrawShowForPlayer(playerid, STextdraw4);
	format(string, sizeof(string), "Arrests: %s", pInfo[playerid][pArrests]);
	TextDrawShowForPlayer(playerid, STextdraw5);
	
	return 1;
}
Untested :P

For this, you need to include ZCMD in your script:
https://sampforum.blast.hk/showthread.php?tid=91354
Okay, and what is the point of formatting the string if you're not using it?
This won't change the textdraws...

pawn Код:
CMD:stats(playerid, params[])
{
    new string[50];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    format(string, sizeof(string), "Player Stats: %s", name);
    TextDrawShowForPlayer(playerid, STextdraw0);
    TextDrawSetString(STextdraw0, string);
    format(string, sizeof(string), "Score: %d", pInfo[playerid][pScore]);
    TextDrawShowForPlayer(playerid, STextdraw1);
    TextDrawSetString(STextdraw1, string);
    format(string, sizeof(string), "Kills: %d", pInfo[playerid][pKills]);
    TextDrawShowForPlayer(playerid, STextdraw2);
    TextDrawSetString(STextdraw2, string);
    format(string, sizeof(string), "Deaths: %d", pInfo[playerid][pDeaths]);
    TextDrawShowForPlayer(playerid, STextdraw3);
    TextDrawSetString(STextdraw3, string);
    format(string, sizeof(string), "Robberies: %d", pInfo[playerid][pRobberies]);
    TextDrawShowForPlayer(playerid, STextdraw4);
    TextDrawSetString(STextdraw4, string);
    format(string, sizeof(string), "Arrests: %d", pInfo[playerid][pArrests]);
    TextDrawShowForPlayer(playerid, STextdraw5);
    TextDrawSetString(STextdraw5, string);
    return 1;
}
NOTE: Untested
Reply


Messages In This Thread
Making a stats command.. - by _Khaled_ - 15.09.2012, 20:57
Re: Making a stats command.. - by HighFlyer - 15.09.2012, 21:32
Re: Making a stats command.. - by _Khaled_ - 16.09.2012, 03:19
Re: Making a stats command.. - by _Khaled_ - 17.09.2012, 03:53
Re: Making a stats command.. - by clarencecuzz - 17.09.2012, 06:48
Re: Making a stats command.. - by Camacorn - 17.09.2012, 08:16
Re: Making a stats command.. - by clarencecuzz - 17.09.2012, 08:21

Forum Jump:


Users browsing this thread: 2 Guest(s)