Money - 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: Money (
/showthread.php?tid=180623)
Money -
zoolon23 - 02.10.2010
i want to do this: , next to each number..
look this command:
PHP код:
if(strcmp(cmdtext, "/bla", true) == 0)
{
format(String,sizeof(String), "%d", dini_Int(GetPlayerFile(playerid), "Bank"));
SendClientMessage(playerid, red, String);
return 1;
}
if my bank it 1000 i want its write for me 1,000.
and if my bank it 1000000 its write for me 1,000,000
Thanks to helpers!
Re: Money -
Sergei - 02.10.2010
There are functions like that released on the forum. Just search around.
Re: Money -
Calgon - 02.10.2010
http://forum.sa-mp.com/showpost.php?...&postcount=880
pawn Код:
stock IntToFormattedStr(integer) // Thanks to Zamaroht
{
// By Zamaroht
new value[20], string[20];
valstr(value, integer);
new charcount;
for(new i = strlen(value); i >= 0; i --)
{
format(string, sizeof(string), "%c%s", value[i], string);
if(charcount == 3)
{
if((integer >= 0 && i != 0) || (integer < 0 && i > 1))
format(string, sizeof(string), ",%s", string);
charcount = 0;
}
charcount ++;
}
return string;
}
Define that somewhere, then for your line of code (here):
pawn Код:
format(String,sizeof(String), "%s", IntToFormattedStr(dini_Int(GetPlayerFile(playerid), "Bank")));
FYI: The function turns the integer into a string for the usage of the commas. Enjoy, and thanks to Zamaroht for contributing the function to the 'Useful Functions' topic.
Re: Money -
zoolon23 - 02.10.2010
i does it:
PHP код:
if(strcmp(cmdtext, "/bla", true) == 0)
{
format(String,sizeof(String), "%d", IntToFormattedStr(dini_Int(GetPlayerFile(playerid), "Bank")));
SendClientMessage(playerid, red, String);
return 1;
}
and i have this error:
PHP код:
C:\Documents and Settings\Bar\щемзп дтбегд\Satla-Zone DeathMatch\gamemodes\Fear.PWN(2507) : error 035: argument type mismatch (argument 1)
why?
Re: Money -
Conroy - 02.10.2010
format(String,sizeof(String),
"%s", IntToFormattedStr(dini_Int(GetPlayerFile(playerid) , "Bank")));
Re: Money -
zoolon23 - 02.10.2010
still this error:
PHP код:
C:\Documents and Settings\Bar\щемзп дтбегд\Satla-Zone DeathMatch\gamemodes\Fear.PWN(2507) : error 035: argument type mismatch (argument 1)
Re: Money -
Conroy - 02.10.2010
What is line 2507?
Re: Money -
zoolon23 - 02.10.2010
this:
PHP код:
format(String,sizeof(String), "%s", IntToFormattedStr(dini_Int(GetPlayerFile(playerid), "Bank")));
Re: Money -
samgreen - 02.10.2010
Quote:
Originally Posted by zoolon23
this:
PHP код:
format(String,sizeof(String), "%s", IntToFormattedStr(dini_Int(GetPlayerFile(playerid), "Bank")));
|
The problem is with argument 1,
String show us where you have defined string. ex:
pawn Код:
new String[128]; // CORRECT: Should be defined similar to this
new String; // INCORRECT: Probably defined like this.
Re: Money -
zoolon23 - 02.10.2010
so what i need to do?