(help) HudSyncObject error
what is wrong with this code?
the hud message is not displayed! PHP Code:
|
Re: HudSyncObject not work
For starters, why do you have this commented out? You need it. Your plugin is probably throwing errors without this check. There's more stuff that can be fixed/improved.
You should instead use get_players() instead of looping through all slots and doing these checks. PHP Code:
|
Re: HudSyncObject not work
Quote:
it's just a simple xp plugin, but i want to add a sync hud (always showing/updating player stats) and i did copy this from army ranks plug, but seems that something is wrong. I'm not good at all in scripting, but a litle help would be nice. |
Re: HudSyncObject not work
Give this a try:
PHP Code:
|
Re: HudSyncObject not work
Nice! i think this is working much better!
btw, are this a good way to hide my rank when i'm dead? PHP Code:
and would be nice if you help me creating a fuction that will show the rank of the player you spectact. that means if you die, your rank already will hide but will show another player rank when you spectate him. thanks by the way!! |
Re: (help) HudSyncObject not work
This will show the players own data while alive, or spectated player info when dead. You will need to add PLAYERNAME to your language file. You also need to include fakemeta if you do not use it already.
See comments: PHP Code:
|
Re: (help) HudSyncObject not work
Error: Undefined symbol "PlayerFrags" on line 171
Should i add new PlayerFrags[32] before plugin_init ? |
Re: (help) HudSyncObject not work
I don't remember why I added it, I think because you had FRAGS but no value for it. I updated my code to remove it
|
Re: (help) HudSyncObject error
Is this beceause i'm testing with bots?
|
Re: (help) HudSyncObject error
Yes, all variables are initialized at 0 when first created unless you change the value. So when players first join and no value is assigned, it will be 0. So if PlayerLevel[ id ] = 0 then LEVELS[ PlayerLevel[ id ] ] will be 0 since the first cell in the LEVELS array is 0.
I don't think testing with bots should matter unless you are specifically excluding bots somewhere using !is_user_bot() or excluding them with get_players(). If you are saving data to vault or something with their steam id, then it will only create 1 record for all bots, using podbots atleast. I don't know enough about your plugin to know what is wrong. Plus it's difficult to help with and/or fix a plugin without seeing all of the code. This will be good debugging practice for you. When something doesn't work how you expect, put some client_prints or server_prints in to output values. If they are not what you want, you know there is an issue at that location of code. |
| All times are GMT -4. The time now is 09:29. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.