[Help] Stats in textdraws
#1

Code:
public StatsInfromation() {
    new coordsstring[199];
	for(new i=0;i<MAX_PLAYERS;i++)
	{
		if (IsPlayerConnected(i))
	    {
	        format(coordsstring, sizeof(coordsstring), "Ubojstva: ~w~%d  ~n~Smrti: ~w~%d ~n~Level: ~w~%d ~n~Respekti: ~w~%d/%d ~n~Spol: ~w~%s ~n~Godina: ~w~%d" , PlayerInfo[pKills], PlayerInfo[pDeaths], PlayerInfo[pLevel], PlayerInfo[pExp], atext, PlayerInfo[pAge]);
	        TextDrawSetString(PlayerStats[i],coordsstring);
    	}
	}
	return 1;
}
Hi all, I made statistics in textdraw and it work fine but variables won't save and there isn't any "ubojstva" (kills). In Game "Spol" (age), there is 0, and in Level/Respekti/Godina are also 0. Please help me.
When I add [playerid] or [targetid] it show me undefined playerid/targetid.
Sorry for bad English.
Reply
#2

Quote:
Originally Posted by Saddin
View Post
When I add [playerid] or [targetid] it show me undefined playerid/targetid.
pawn Code:
forward StatsInfromation(playerid);
public StatsInfromation(playerid)
{
       //codes...
}
Reply
#3

error 025: function heading differs from prototype

forward StatsInfromation(playerid);

Error on this line that you gave it to me.
Reply
#4

Hmm.. Infromation OR Information? I just copied it from your script.
Reply
#5

pawn Code:
forward StatsInfromation(playerid);
public StatsInfromation(playerid)
{
new coordsstring[199];
        if (IsPlayerConnected(playerid))
        {
            format(coordsstring, sizeof(coordsstring), "Ubojstva: ~w~%d  ~n~Smrti: ~w~%d ~n~Level: ~w~%d ~n~Respekti: ~w~%d/%d ~n~Spol: ~w~%s ~n~Godina: ~w~%d" , PlayerInfo[pKills], PlayerInfo[pDeaths], PlayerInfo[pLevel], PlayerInfo[pExp], atext, PlayerInfo[pAge]);
            TextDrawSetString(PlayerStats[playerid],coordsstring);
        }
    return 1;
}
Wherever you want to call this function.
Example
pawn Code:
//when player type /stats
StatsInformation(playerid);
Reply
#6

It's infromation cause i copy script.
I already had forward StatsInfromation(); but not playerid
Now it's only undefined playerid

Code:
  format(coordsstring, sizeof(coordsstring), "Ubojstva: ~w~%d  ~n~Smrti: ~w~%d ~n~Level: ~w~%d ~n~Respekti: ~w~%d/%d ~n~Spol: ~w~%s ~n~Godina: ~w~%d" , PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pExp], PlayerInfo[playerid][pSex], PlayerInfo[playerid][pAge]);
Reply
#7

Quote:
Originally Posted by [MM]RoXoR[FS]
View Post
pawn Code:
forward StatsInfromation(playerid);
public StatsInfromation(playerid);
{
new coordsstring[199];
        if (IsPlayerConnected(playerid))
        {
            format(coordsstring, sizeof(coordsstring), "Ubojstva: ~w~%d  ~n~Smrti: ~w~%d ~n~Level: ~w~%d ~n~Respekti: ~w~%d/%d ~n~Spol: ~w~%s ~n~Godina: ~w~%d" , PlayerInfo[pKills], PlayerInfo[pDeaths], PlayerInfo[pLevel], PlayerInfo[pExp], atext, PlayerInfo[pAge]);
            TextDrawSetString(PlayerStats[playerid],coordsstring);
        }
    return 1;
}
Wherever you want to call this function.
Example
pawn Code:
//when player type /stats
StatsInformation(playerid);
pawn Code:
public StatsInfromation(playerid);
Wrong! It should be
pawn Code:
public StatsInfromation(playerid)
Remove ' ; '
Reply
#8

Quote:
Originally Posted by newbienoob
View Post
pawn Code:
public StatsInfromation(playerid);
Wrong! It should be
pawn Code:
public StatsInfromation(playerid)
Remove ' ; '
Typing mistake. Sorry. Edited my post.
Thanks for finding my mistake
Reply
#9

Thanks but i remove this error doing this :

Code:
forward StatsInfromation(playerid);
public StatsInfromation(playerid)
I add to public StatsInfromation(playerid)

And now I solved this error with undefined playerid, but now I get new error undefined targetid on the same line ?
Can you help me and explain what targeid do ?
Reply
#10

Post your whole "public StatsInfromation(playerid)" with targetid.
Reply
#11

Code:
public StatsInfromation(playerid) {
    new coordsstring[199];
	for(new i=0;i<MAX_PLAYERS;i++)
	{
		if (IsPlayerConnected(i))
	    {
	        format(coordsstring, sizeof(coordsstring), "Ubojstva: ~w~%d  ~n~Smrti: ~w~%d ~n~Level: ~w~%d ~n~Respekti: ~w~%d/60 ~n~Spol: ~w~%s ~n~Godina: ~w~%d ~n~Pohvala: ~w~%d/5 ~n~Upozorenja: ~w~%d/5" , PlayerInfo[playerid][pKills], PlayerInfo[targetid][pDeaths], PlayerInfo[targetid][pLevel], PlayerInfo[targetid][pExp], PlayerInfo[targetid][pSex], PlayerInfo[playerid][pAge],PlayerInfo[targetid][pGreats],PlayerInfo[targetid][pWarns]);
	        TextDrawSetString(PlayerStats[i],coordsstring);
    	}
	}
	return 1;
}
Can you explain me what targetid do ?
Reply
#12

Replace targetid with playerid.
Reply
#13

pawn Code:
format(coordsstring, sizeof(coordsstring), "Ubojstva: ~w~%d  ~n~Smrti: ~w~%d ~n~Level: ~w~%d ~n~Respekti: ~w~%d/60 ~n~Spol: ~w~%s ~n~Godina: ~w~%d ~n~Pohvala: ~w~%d/5 ~n~Upozorenja: ~w~%d/5" , PlayerInfo[playerid][pKills], PlayerInfo[targetid][pDeaths], PlayerInfo[targetid][pLevel], PlayerInfo[targetid][pExp], PlayerInfo[targetid][pSex], PlayerInfo[playerid][pAge],PlayerInfo[targetid][pGreats],PlayerInfo[targetid][pWarns]);
You need to replace each targetid with playerid
Reply
#14

Works, thank you very much on this.
Just one more question.
How to add name of player when he typed /account statistic show like this

STATISTICS - NAME_SURNAME, in textdraws ?
Reply
#15

pawn Code:
new name[24];
GetPlayerName(playerid,name,24);
format(coordsstring, sizeof(coordsstring),"Name - %s, //others.............",name,//others....);
Reply
#16

Code:
error 075: input line too long (after substitutions)
Reply
#17

Post Edited.
Reply
#18

BUMP* Please help me, line is too long, but I need to put more things here.
Reply
#19

Well, if the line is too long, make it shorter or split it up into two formats.
Reply
#20

How to split it in two formats ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)