You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.3 KiB
69 lines
1.3 KiB
/* 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."); |
|
} |
|
} |
|
} |