inital commit
This commit is contained in:
69
ask4change.sp
Normal file
69
ask4change.sp
Normal file
@@ -0,0 +1,69 @@
|
||||
/* Plugin Template generated by Pawn Studio */
|
||||
|
||||
#include <sourcemod>
|
||||
#include <mapchooser>
|
||||
|
||||
new Handle:hTimer = INVALID_HANDLE;
|
||||
|
||||
public Plugin:myinfo =
|
||||
{
|
||||
name = "Ask4MapChange",
|
||||
author = "Chefe",
|
||||
description = "",
|
||||
version = "1.0",
|
||||
url = "<- URL ->"
|
||||
}
|
||||
|
||||
public OnPluginStart()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public OnMapStart()
|
||||
{
|
||||
if (hTimer == INVALID_HANDLE)
|
||||
{
|
||||
hTimer = CreateTimer(3600.0, Timer_Ask4Change, _, TIMER_REPEAT);
|
||||
}
|
||||
else
|
||||
{
|
||||
CloseHandle(hTimer);
|
||||
hTimer = CreateTimer(3600.0, Timer_Ask4Change, _, TIMER_REPEAT);
|
||||
}
|
||||
}
|
||||
|
||||
public Action:Timer_Ask4Change(Handle:timer)
|
||||
{
|
||||
if (IsVoteInProgress())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
new Handle:menu = CreateMenu(Handle_Ask4ChangeMenu);
|
||||
SetMenuTitle(menu, "Change map? (next vote in 60min)");
|
||||
AddMenuItem(menu, "dismiss", "Press-only-1-noobing", ITEMDRAW_DISABLED);
|
||||
AddMenuItem(menu, "no", "No");
|
||||
AddMenuItem(menu, "yes", "Yes");
|
||||
SetMenuExitButton(menu, false);
|
||||
VoteMenuToAll(menu, 20);
|
||||
}
|
||||
|
||||
public Handle_Ask4ChangeMenu(Handle:menu, MenuAction:action, param1, param2)
|
||||
{
|
||||
if (action == MenuAction_End)
|
||||
{
|
||||
/* This is called after VoteEnd */
|
||||
CloseHandle(menu);
|
||||
} else if (action == MenuAction_VoteEnd) {
|
||||
/* 0=yes, 1=no */
|
||||
if (param1 == 2)
|
||||
{
|
||||
PrintToChatAll("Vote succeed. Starting mapvote ...");
|
||||
InitiateMapChooserVote(MapChange_Instant);
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintToChatAll("Vote failed. Next Mapchange vote in 60 minutes.");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user