Quote:
Originally Posted by Lorenc_
Revamped the version someone posted about ConvertPrice itself, it now doesn't use valstr and supports negative numbers.
pawn Код:
stock ConvertPrice( price, no_price_tag = 0 ) { new szString[ 32 ], iNumbers = 0, bool: isneg = price < 0 ? true : false ; if( isneg ) price = price * -1; iNumbers = floatround( floatlog( price ), floatround_floor ) + 1; format( szString, sizeof( szString ), "%d", price ); while( iNumbers >= 4 ) { iNumbers -= 3; strins( szString, ",", iNumbers ); } if( !no_price_tag ) strins( szString, "$", 0 ); if( isneg ) strins( szString, "-", 0 ); return szString; }
Warning: Can crash if using a integer over the 32 bit integer limit..
I fixed some little glitch with the logarithm... Should work fine now!
|
Was it tested with numbers such as 1,000,000,000 (1 billion)? Most functions that convert into price tags (if you know what I mean) crash the server / fail to work when over 1,000,000,000 (which is under the 32-bit integer limit).
I'll test it later - thanks.
Quote:
Originally Posted by Nero_3D
pawn Код:
stock RoundGangZone(const Float: radius, const Float: X , const Float: Y, const color, const size = 20) { new Float: inc = 90.0 / size, Float: deg = inc, Float: cos, Float: sin, zone ; while(deg < 90.0) { cos = floatcos(deg, degrees) * radius; sin = floatsin(deg, degrees) * radius;
zone = GangZoneCreate(X - cos, Y - sin, X + cos, Y + sin); GangZoneShowForAll(zone, color);
deg += inc; } return zone; }
The upper "circle" is your version, both use about the same number of zones in the picture
It doesnt look like a circle because of my resolution
|
This is great! If the player is wanted, it will show a circle on the map (like GTA IV). Thanks :P