Strings in Pawno - 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: Strings in Pawno (
/showthread.php?tid=101397)
Strings in Pawno -
Tigerbeast11 - 10.10.2009
Hey guys!
Im new at scripting and I dont really understand strings! I was hoping you guys could give me some professional advice! For example, how can i use /score cmd which tells people their score using strings. Plz help!!! I mean i understand the GetPlayerName one, but how can i use GetPlayerScore
Greetz, Tiger
Edit: Sorry for double post, laggy internet connection made me do it!
Re: Strings in Pawno -
_Vortex - 10.10.2009
Wrong section.
http://forum.sa-mp.com/index.php?board=10.0
By the way, you can GetPlayerScore as easy as you can GetPlayerName.
pawn Код:
new string[128]
format(string,128,"Your score is %i",GetPlayerScore(playerid)); // note: i'm not sure if 'i' is the right one, I haven't used that for numbers
SendClientMessage(playerid,color,string);
Note: This has not been tested.
Re: Strings in Pawno -
Tigerbeast11 - 10.10.2009
Quote:
// note: i'm not sure if 'i' is the right one, I haven't used that for numbers
|
I think its %d for numbers
Right now i get it, but what if say, im making a dm and i want to give the player a minigun if he gets more than 3 kills. How can i do this
Yh sorry, i realised it after i had posted, and u cant delete after u have posted
Re: Strings in Pawno -
Correlli - 10.10.2009
It's the same if you use
%d or
%i, both formats are for integers (numbers as you say).
Quote:
|
Format Strings
Placeholder Meaning
%b Inserts a number at this position in binary radix
%c Inserts a single character.
%d Inserts an integer (whole) number
%f Inserts a floating point number.
%i Inserts an integer.
%s Inserts a string.
%x Inserts a number in hexadecimal notation.
%% Inserts the literal '%'
|
Re: Strings in Pawno -
(.Aztec); - 10.10.2009
pawn Код:
zcmd(score, playerid, params[])
{
new score, string[128];
score = GetPlayerScore(playerid);
format(string, sizeof(string), "Score = \"%d\"", score);
SendClientMessage(playerid, white, string);
return 1;
}
EDIT: My bad, forgot the new string[128];