#include #include "W3SIncs/War3Source_Interface" new Handle:vecHelpCommands; #define HELPCOMMAND_COUNT GetArraySize(vecHelpCommands) public Plugin:myinfo= { name="War3Source help menu", author="Ownz (DarkEnergy)", description="War3Source Core Plugins", version="1.0", url="http://war3source.com/" }; public OnPluginStart() { if(!War3Source_InitiateHelpVector()) SetFailState("[War3Source] There was a failure in creating the help vector, definitely halting."); War3Source_InitHelpCommands(); } public bool:InitNativesForwards() { CreateNative("War3_CreateHelpCommand",Native_War3_CreateHelpCommand); return true; } public Native_War3_CreateHelpCommand(Handle:plugin,numParams) { decl String:name[64]; GetNativeString(1,name,sizeof(name)); decl String:desc[256]; GetNativeString(2,desc,sizeof(desc)); NewHelpCommand(name,desc); } public OnWar3Event(W3EVENT:event,client){ if(event==DoShowHelpMenu){ War3Source_War3Help(client); } } bool:War3Source_InitiateHelpVector() { vecHelpCommands=CreateArray(); //this is only called once... return true; } NewHelpCommand(String:name[],String:info[]) { new Handle:vec=CreateArray(ByteCountToCells(256)); //this array is no only created once, and help commands are only added once at first load, no longer on map change PushArrayString(vec,name); PushArrayString(vec,info); PushArrayCell(vecHelpCommands,vec); } War3Source_InitHelpCommands() { new limit=17; new String:transbuf1[32]; new String:transbuf2[32]; for(new i=0;i<=limit;i++){ Format(transbuf1,sizeof(transbuf1),"HelpMenu%d",i); Format(transbuf2,sizeof(transbuf2),"HelpMenu%ddesc",i); NewHelpCommand(transbuf1,transbuf2); } } Handle:GetHelpItem(command) { return GetArrayCell(vecHelpCommands,command); } War3Source_War3Help(client) { new Handle:helpMenu=CreateMenu(War3Source_HelpMenu_Selected); SetMenuExitButton(helpMenu,true); SetMenuTitle(helpMenu,"%T","[War3Source] Select a command for more info",client); decl String:commandname[64]; decl String:helpbuf[4]; new Handle:commandHandle; for(new x=0;x-1&&command