Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Base code for Lastrequest with AutoStart false.
- */
- #include <sourcemod>
- #include <sdktools>
- #include <menus>
- // Make certain the lastrequest.inc is last on the list
- #include <hosties>
- #include <lastrequest>
- #pragma semicolon 1
- #define PLUGIN_VERSION "1.0.0"
- // This global will store the index number for the new Last Request
- new g_LREntryNum;
- new This_LR_Type;
- new LR_Player_Prisoner;
- new LR_Player_Guard;
- // menu handler
- new Handle:Menu = INVALID_HANDLE;
- public Plugin:myinfo =
- {
- name = "Last Request: LR",
- author = "Author",
- description = "Adds a Lastrequest to sm_hosties",
- version = PLUGIN_VERSION,
- url = "yourwebsite"
- };
- public OnPluginStart()
- {
- // Load translations
- LoadTranslations("CustomLRs.phrases");
- // menu
- Menu = CreateMenu(MenuHandler);
- SetMenuTitle(Menu, "LR mode select");
- AddMenuItem(Menu, "M1", "Mode 1");
- AddMenuItem(Menu, "M2", "Mode 2");
- SetMenuExitButton(Menu, true);
- }
- public OnConfigsExecuted()
- {
- static bool:bAddedLR = false;
- if (!bAddedLR)
- {
- g_LREntryNum = AddLastRequestToList(LR_Start, LR_Stop, "LastRequest", false);
- bAddedLR = true;
- }
- }
- public MenuHandler(Handle:menu, MenuAction:action, param1, param2)
- {
- if (action == MenuAction_Select)
- {
- if(param2 == 0) // Mode 1
- {
- // Code for mode 1 here (can also be a function, recommended in seperate function)
- //
- // End for Code for mode 1
- // InitializeLR to start LR globally
- InitializeLR(param1);
- }
- if(param2 == 1) // Mode 2
- {
- // Code for mode 2 here (can also be a function, recommended in seperate function)
- //
- // End for Code for mode 2
- // InitializeLR to start LR globally
- InitializeLR(param1);
- }
- }
- }
- // The plugin should remove any LRs it loads when it's unloaded
- public OnPluginEnd()
- {
- RemoveLastRequestFromList(LR_Start, LR_Stop, "LastRequest");
- }
- public LR_Start(Handle:LR_Array, iIndexInArray)
- {
- This_LR_Type = GetArrayCell(LR_Array, iIndexInArray, _:Block_LRType); // get this lr from selection
- if (This_LR_Type == g_LREntryNum)
- {
- LR_Player_Prisoner = GetArrayCell(LR_Array, iIndexInArray, _:Block_Prisoner); // get prisoner's id
- LR_Player_Guard = GetArrayCell(LR_Array, iIndexInArray, _:Block_Guard); // get guard's id
- // check datapack value
- new LR_Pack_Value = GetArrayCell(LR_Array, iIndexInArray, _:Block_Global1);
- switch (LR_Pack_Value)
- {
- case -1:
- {
- PrintToServer("no info included");
- }
- }
- SetArrayCell(LR_Array, iIndexInArray, 3, _:Block_Global1);
- // here what you want before lr starts
- // ex : send a menu to the prisoner to select a mode in this lr.
- // after player selected a mode, call a function you need to make and call InitializeLR();
- // and for the real sample
- DisplayMenu(Menu, LR_Player_Prisoner, 0); // menu's handle, the prisoner, how long the menu holds on screen if player selects nothing
- PrintToChat(LR_Player_Guard, "\x04[SM] \x01The player %N selected to you as a partner in his lastrequest.", LR_Player_Prisoner);
- }
- }
- public LR_Stop(Type, Prisoner, Guard)
- {
- // What happens if there is a winner / lr aborted
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement