Re: Scripting Forum
need help adding comma separator between digits to number, displaying in chat
want chat to display player's points on infected death with comma after thousand, for instance: stupid (10,222) got 1 point for killing infected can't get 10222 number with comma what doI do with this: PrintToChat(i, "%s (%i) got point for killing Infected", Name, (ClientPoints[i] + CurrentPoints[i])); was advised to go http://forums.alliedmods.net/showpos...45&postcount=5 but that requires amxmod. what's the way for sourcemod? |
Re: Scripting Forum
Quote:
Having said that, here's a quick and completely untested port of the AddCommas function to SourceMod. SourceMod only has a float absolute value function, so I did a two's complement to swap the sign. PHP Code:
|
Re: Scripting Forum
Quote:
thank you for your peace of code, it' just doesn't seem like I'm capable of inserting it properly to plugin). if I put it before the block, responsible for displaying client points on infected death, plugin compiles perfectly, but there's no effect - numbers are still displayed in gamechat with no comma between digits. and when I tried to put indicated code directly in the block , I couldn't compile a thing- got like undefined symbols.. pretty sure I'm doing something wrong)). here's where I tried to insert it, but failed (peace of [L4D & L4D2] Custom Player Stats v1.4B105 by muukis, just attempting to adopt to how I'd like stats to be displayed): PHP Code:
|
Re: Scripting Forum
Quote:
PHP Code:
|
Re: Scripting Forum
got it now. thank you for pointing. did as you recommended
PHP Code:
name(1) got points for killing infected name(1)got points for killing infected "1" value never changed. is this because there's sum of clientPoints+current , maybe it'll display properly if referred to some separate value, like just client points or only current (but need some time to earn 1000 currentpoints to see if there's comma:))? or should I install whole piece of code before the block correctly ( I did try that and nothing compiled because of: "AddCommas" already defined) also I tried PHP Code:
name (t)) got points for killing Infected name(v)) got points for killing Infected nema (x)) got points for killing Infected and lots of other different symbols)) |
Re: Scripting Forum
ok tried displaying currentPoints only:
PHP Code:
|
Re: Scripting Forum
Likely the problems are being caused by SourceMod storing strings differently than AMX Mod X does. I'll have to check what needs to be changed to get this working like it should.
|
Re: Scripting Forum
Here's a new version with a few string handling functions changed around to use the ones that deal with bytes rather than cells (which are 4 bytes each).
PHP Code:
|
Re: Scripting Forum
Quote:
|
Re: Scripting Forum
Quote:
PHP Code:
btw, there is another shtick about displaying stats - when it's about special infected, for exapmple: "Name(1,111) got points for (1)Boomer" , boomer is shown with number if there's few of them currently spawned on the map; like when you look at players list thru adminmenu - it says 1. Hunter, 2. (1)hunter, when there's couple of infected of the same tipe. but when you killed (1)Boomer, you can assume there's more nearby, which should be a surprise I suppose. got no clue how to deal with this characters in front of infected name.. |
All times are GMT -4. The time now is 18:47. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.