Solved Thanks! :)
#1

I would like to have when a player types /myinfo then in the chat area it would display their stats from the file. Would it be something like:

Код:
SendClientMessage(playerid, RED, "dUserSetINT(PlayerName(playerid)).("TimesDied",dUserINT(PlayerName(playerid)).("TimesDied"))");
I am not sure how to display info from the file in the chat to show the players stats.Help is appreciated Thanks!
Reply
#2

You would need to format the string to put all that stuff in, otherwise it will send a tonne of script into the chat box in San Andreas >.>

Let me find the wiki page for formats.. in the meantime:

pawn Код:
new string[100];
format(string, sizeof(string), "%d.%d.%d", Source of first variable, second, third)
Having some trouble interpreting what you've got going on there, but i'm fairly sure you need to use format!

EDIT: Information on using "format"
Reply
#3

pawn Код:
new string[128];
format(string,sizeof(string),"Died %s times",dUserINT(PlayerName(playerid)).("TimesDied"));
SendClientMessage(playerid, RED, string);
That's it. Click on Weirdosport's link to formatting for more info you'll need in the future.
Reply
#4

Quote:
Originally Posted by [Fackin'
Pyro ]
pawn Код:
new string[128];
format(string,sizeof(string),"Died %s times",dUserINT(PlayerName(playerid)).("TimesDied"));
SendClientMessage(playerid, RED, string);
That's it. Click on Weirdosport's link to formatting for more info you'll need in the future.
pawn Код:
new string[128];
format(string,sizeof(string),"Died %d times",dUserINT(PlayerName(playerid)).("TimesDied"));
SendClientMessage(playerid, RED, string);
Reply
#5

Quote:
Originally Posted by Norn
Quote:
Originally Posted by [Fackin'
Pyro ]
pawn Код:
new string[128];
format(string,sizeof(string),"Died %s times",dUserINT(PlayerName(playerid)).("TimesDied"));
SendClientMessage(playerid, RED, string);
That's it. Click on Weirdosport's link to formatting for more info you'll need in the future.
pawn Код:
new string[128];
format(string,sizeof(string),"Died %d times",dUserINT(PlayerName(playerid)).("TimesDied"));
SendClientMessage(playerid, RED, string);
What's the difference?

Oh I see. Used %d for integers. My bad.
Reply
#6

Quote:
Originally Posted by [Fackin'
Pyro ]
Quote:
Originally Posted by Norn
Quote:
Originally Posted by [Fackin'
Pyro ]
pawn Код:
new string[128];
format(string,sizeof(string),"Died %s times",dUserINT(PlayerName(playerid)).("TimesDied"));
SendClientMessage(playerid, RED, string);
That's it. Click on Weirdosport's link to formatting for more info you'll need in the future.
pawn Код:
new string[128];
format(string,sizeof(string),"Died %d times",dUserINT(PlayerName(playerid)).("TimesDied"));
SendClientMessage(playerid, RED, string);
What's the difference?
String -> Decimal
Reply
#7

Yeah I noticed. Sometimes I mix them up.
Reply
#8

Thank you very much to all of you guys! You have helped me out a lot! Thank you again!
Reply
#9

Quote:
Originally Posted by notec100
Thank you very much to all of you guys! You have helped me out a lot! Thank you again!
Happy to help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)