#1

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(playeridredString);
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!
Reply
#2

There are functions like that released on the forum. Just search around.
Reply
#3

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.
Reply
#4

i does it:
PHP код:
if(strcmp(cmdtext"/bla"true) == 0)
{
format(String,sizeof(String), "%d"IntToFormattedStr(dini_Int(GetPlayerFile(playerid), "Bank")));
SendClientMessage(playeridredString);
return 
1;

and i have this error:
PHP код:
C:\Documents and Settings\Bar\щемзп дтбегд\Satla-Zone DeathMatch\gamemodes\Fear.PWN(2507) : error 035argument type mismatch (argument 1
why?
Reply
#5

format(String,sizeof(String), "%s", IntToFormattedStr(dini_Int(GetPlayerFile(playerid) , "Bank")));
Reply
#6

still this error:
PHP код:
C:\Documents and Settings\Bar\щемзп дтбегд\Satla-Zone DeathMatch\gamemodes\Fear.PWN(2507) : error 035argument type mismatch (argument 1
Reply
#7

What is line 2507?
Reply
#8

this:
PHP код:
format(String,sizeof(String), "%s"IntToFormattedStr(dini_Int(GetPlayerFile(playerid), "Bank"))); 
Reply
#9

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.
Reply
#10

so what i need to do?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)