AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Force mapvote from another plugin (https://forums.alliedmods.net/showthread.php?t=47663)

jeppelykke 11-23-2006 16:05

Force mapvote from another plugin
 
Hey Hey :)

How can i force a mapvote (like the vote when there are 2 mins left on a gameserver.)

The command i need to force on my plugin is: voteNextmap from mapchooser.

More Info:
When a player won on my server, (a mod i working on), then i need to force it to preform a mapvote, where it actives: voteNextmap from the mapchooser.amxx

Can anyone be so kind and help.

VEN 11-24-2006 02:58

Re: Force mapvote from another plugin
 
Use callfunc's natives from the core.

SSJ2GOKU 11-24-2006 05:23

Re: Force mapvote from another plugin
 
won't this work aswell

#include <mapchooser.amxx>

and then calling up the function ?

watch 11-24-2006 08:12

Re: Force mapvote from another plugin
 
No, do what VEN said

Code:
callfunc_begin("voteNextmap","mapchooser") callfunc_end()

VEN 11-24-2006 08:15

Re: Force mapvote from another plugin
 
Quote:

won't this work aswell

#include <mapchooser.amxx>

and then calling up the function ?
mapchooser.amxx is a binary, you can't include it.

XxAvalanchexX 11-24-2006 12:04

Re: Force mapvote from another plugin
 
The function voteNextmap is called every few seconds by mapchooser.amxx, not only when it is time to vote. Whenever it is called, it checks if it should do a map vote, and if not just keeps looping every few seconds. So, this is how I trigger it in GunGame AMXX:

Code:
// force maxrounds -1 so that mapchooser thinks that the game is almost over new oldValue = get_cvar_num("mp_maxrounds"); set_cvar_num("mp_maxrounds",-1); // call the vote if(callfunc_begin("voteNextmap","mapchooser.amxx") == 1)     callfunc_end(); // set maxrounds back set_cvar_num("mp_maxrounds",oldValue);

I also make sure to check the callfunc_begin for success before using callfunc_end, because it could raise a runtime error otherwise.

jeppelykke 11-25-2006 03:35

Re: Force mapvote from another plugin
 
Thank you so much XxAvalanchexX :)

Have a very good weekend


All times are GMT -4. The time now is 06:57.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.