Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <nativevotes>
- int votefor;
- // voting section
- votefor = voteval;
- Handle vote = NativeVotes_Create(MenuHandler_VoteMaxSlots, NativeVotesType_Custom_YesNo);
- NativeVotes_SetInitiator(vote, client);
- char sDetails[256];
- FormatEx(sDetails, sizeof(sDetails), "Vote to change the maxslots value to %i?", votefor);
- NativeVotes_SetDetails(vote, sDetails);
- NativeVotes_DisplayToAll(vote, 20);
- return Plugin_Handled;
- }
- public int MenuHandler_VoteMaxSlots(Menu menu, MenuAction action, int param1, int param2)
- {
- switch (action)
- {
- case MenuAction_VoteEnd:
- {
- if (param1 == NATIVEVOTES_VOTE_YES)
- {
- char sDetails[256];
- FormatEx(sDetails, sizeof(sDetails), "Maxslots changed to %i", votefor);
- NativeVotes_DisplayPass(menu, sDetails);
- SetConVarInt(FindConVar("sv_maxplayers"), votefor);
- }
- else
- {
- NativeVotes_DisplayFail(menu, NativeVotesFail_Loses);
- }
- }
- case MenuAction_VoteCancel:
- {
- if (param1 == VoteCancel_NoVotes)
- {
- NativeVotes_DisplayFail(menu, NativeVotesFail_NotEnoughVotes);
- }
- else
- {
- NativeVotes_DisplayFail(menu, NativeVotesFail_Generic);
- }
- }
- case MenuAction_End:
- {
- NativeVotes_Close(menu);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement