SA-MP Forums Archive
Solved Thanks! :) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Solved Thanks! :) (/showthread.php?tid=68850)



Solved Thanks! :) - notec100 - 14.03.2009

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!


Re: Not quite sure - Weirdosport - 14.03.2009

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"


Re: Not quite sure - Pyrokid - 14.03.2009

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.


Re: Not quite sure - Norn - 14.03.2009

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);



Re: Not quite sure - Pyrokid - 14.03.2009

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.


Re: Not quite sure - Dujma - 14.03.2009

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


Re: Not quite sure - Pyrokid - 14.03.2009

Yeah I noticed. Sometimes I mix them up.


Re: Not quite sure - notec100 - 14.03.2009

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


Re: Not quite sure - Weirdosport - 14.03.2009

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.