18.10.2014, 12:24
Well hello today I wanted to test ConvertPrice how it works and I found bug or it`s my wrong usage. Well see. I put my variable value to 1000. Then I used that variable to give a player money so it`s means that variable and function (GivePlayerMoney) will give player 1000 dollars. But when SendClientMessage shows up it`s says that player get only 36. Strange well this is the command and ConvertPrice code. Please take a look!
Screens
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/givemoney", cmdtext, true, 10) == 0)
{
new cash[MAX_PLAYERS] = 1000, string[100];
GivePlayerMoney(playerid,cash[playerid]);
format(string,sizeof(string),"[Info] You get %d !",ConvertPrice(cash[playerid], 1));
SendClientMessage(playerid, -1, string);
return 1;
}
return 0;
}
stock ConvertPrice( iValue, iCashSign = 1 )
{
static
szNum[ 32 ]
;
format( szNum, sizeof( szNum ), "%d", iValue < 0 ? -iValue : iValue );
for( new i = strlen( szNum ) - 3; i > 0; i -= 3 ) {
strins( szNum, ",", i, sizeof( szNum ) );
}
if( iCashSign ) strins( szNum, "$", 0 );
if( iValue < 0 ) strins( szNum, "-", 0, sizeof( szNum ) );
return szNum;
}