Online Vips
I'm trying to display the current online vips on the server but i'm having some trouble.
This is how my current code looks like, and it's showing the message on a new line every single time. How do i fix this? PHP Code:
|
Re: Online Vips
You're displaying the message for each loop cycle. Only get the names in the loop and store them in a variable using "formatex" and/or "format", then display the formatted message (the variable) outside the loop.
|
Re: Online Vips
PHP Code:
|
Re: Online Vips
I'm currently using this code which i kinda stole from another plugin. The problem is that it doesn't show the vips correctly. For players without the VIP flag, it will always show "No vips online", while people who have the VIP flag will always get a message that outputs all the player names in the server. Any idea how i can fix this?
PHP Code:
PHP Code:
|
Re: Online Vips
It's because you're checking the flags of "id" (the person who used the command") instead of "TempID" (the loop-element).
Please use "get_players" instead of looping all indexes from 1 to 32. |
Re: Online Vips
something like this?
PHP Code:
|
Re: Online Vips
You don't need "is_user_connected". Use the flags provided by "get_players" - https://www.amxmodx.org/api/amxmodx/get_players
Even though this will probably work, what happens if you have more VIP users than the message can display? |
Re: Online Vips
Quote:
And that's a good question, i don't know to be honest lol. |
Re: Online Vips
You can add a limit, e.g. 4 players max on a line. If the loop reaches 4, print the message and clear the formatex, then set the counter to 0 again.
|
| All times are GMT -4. The time now is 02:40. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.