What is the problem of this plugin?
Hi all!
I'm new with amxmodx scripting.I have made a advanced vote plugin for my practice.But it doesn't work correctly. This plugin must open a vote menu and the title is"Which player should get 255 health.". This vote menu bring 7 players name for 10 seconds and players should vote to one of the players in the menu.After 10 seconds it collects votes and selections and selects the player who has the most votes and sets his health to 255. The problem is here, when you say the command /vote the menu doesn't appear and after 10 seconds it prints a chat that says Vote has tied. This is the code: PHP Code:
|
Re: What is the problem of this plugin?
menu_additem(gVoteMenu, szName, szVoteId, 0);
Also you need to limit the time that the menu is displayed. Matching the time of set_task(10.0, "EndVote"). This is done by calling menu_cancel(player) for all players that haven't voted in the EndVote function. |
Re: What is the problem of this plugin?
Quote:
Quote:
And in the vote menu, when I choose a player it doesn't show the result after 10 seconds and it doesn't set the player's health to 255. What should I do? Please correct the code. |
Re: What is the problem of this plugin?
The problem is find_player() doesn't find a match because the argument you send to it is not actually a userid.
The whole vote count needs a rewrite. I can't really understand how the code works as it is. Try looking at some other plugins. I can do a rewrite of the plugin this weekend if you want. |
Re: What is the problem of this plugin?
Quote:
|
Re: What is the problem of this plugin?
Quote:
|
Re: What is the problem of this plugin?
Quote:
Thanks! |
Re: What is the problem of this plugin?
Only tested in single player.
If you have any questions, let me know. Code:
|
Re: What is the problem of this plugin?
Thank you!
But as I said I don't know a lot about scripting and I'm beginner.So there are many things in the code that I don't know or it's hard to understand. I want to learn.So, please give an explanation of the code and why we use this functions or other things like copy , ",", ,get_pcvar_num and etc. |
Re: What is the problem of this plugin?
I can't explain what every function does. Look in the .inc files for the explanation of them.
I only used amxmodx.inc, amxmisc.inc and fun.inc so it won't be hard to find. If you're wondering about a specific use, ask again and I'll explain. I'll try adding some pointers in the code during the day. |
| All times are GMT -4. The time now is 19:06. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.