Member
|
12-22-2011
, 21:28
Re: Making a plugin tutorial?
|
#14
|
Edit: Figured it out turns out param1=client and I just named it wrong because I blindly copied examples, in my defines I have no idea sometimes what a variable.
I need to figure out how to make the back button work right now it just exits. Other then that i need to start making these menu's do things. Through chatting on IRC I have come to learn I need to use Hooks to make the the item I select actually do something with the player. For example right now I have it so it can do something when Soldier is hit. Right now these are what I want it to do: give 2 guns, multiple pipe bombs(not even sure this is possible I'm thinking maybe have a counter for how many had has that goes down, but gives him one till it reaches zero, not sure how refills are gonna work yet, but it could just reset the counter to its original position and give one.)fry pan (l4d2,pistol for l4d1). I have no idea where to start with this part, but thats why I'm just focusing on one class for right now and making sure I understand everything. I also need to strip the levels of pick up items except ammo, I know theres a stripper mod, but I don't know how picky you can be and if it even works on l4d/2/weapons.
Thank you btw for everyone who posted on here's help and anyone who helped in IRC, I know I'm a noob and this is probably way over me, but I really wanna do it and it something I've been wanting to do for a while. Although I didn't know I'd have to write a plugin to do it, though maybe just maybe I could use L4D sdk tools :\.
Recent Code:
PHP Code:
#include <sourcemod> #include <sdktools> #include <sdkhooks> public Plugin:myinfo = { name = "Dead Fortress", author = "Bakuryu", description = "Team Fortress Meets Left 4 Dead", version = "0.0.0.1", url = "http://www.sourcemod.net/" }
public OnPluginStart() {
} public OnClientPutInServer(client) { BuildMainmenu(client); } BuildMainmenu(client) { new Handle:menu = CreateMenu(MainMenuHandler); AddMenuItem(menu, "chooseclass", "Choose Class"); AddMenuItem(menu, "classinfo", "Class Info"); SetMenuTitle(menu, "Dead Fortress Menu"); DisplayMenu(menu, client, MENU_TIME_FOREVER); } public MainMenuHandler(Handle:menu,MenuAction:action, client, param2) { if (action == MenuAction_End) { CloseHandle(menu); } else if (action == MenuAction_Cancel) { if (param2 == MenuCancel_ExitBack) { } } else if (action == MenuAction_Select) { new String:item1[56]; GetMenuItem(menu,param2,item1,sizeof(item1)); if (StrEqual(item1,"chooseclass")) { BuildClassMenu(client); //create another menu with a back button //also on MenuCancel_ExitBack build the clients previous menu. } else if (StrEqual(item1,"classinfo")) { BuildClassInfoMenu(client); //create another menu with a back button //also on MenuCancel_ExitBack build the clients previous menu. } } } BuildClassMenu(client) { new Handle:classmenu = CreateMenu(ClassMenuHandler); AddMenuItem(classmenu,"soldier","Soldier"); AddMenuItem(classmenu,"scout","Scout"); AddMenuItem(classmenu,"pyro","Pyro"); AddMenuItem(classmenu,"demoman","Demoman"); AddMenuItem(classmenu,"heavy","Heavy"); AddMenuItem(classmenu,"sniper","Sniper"); AddMenuItem(classmenu,"spy","Spy"); AddMenuItem(classmenu,"engineer","Engineer"); AddMenuItem(classmenu,"medic","Medic"); AddMenuItem(classmenu,"back","Back"); SetMenuTitle(classmenu,"Dead Fortress Class Menu"); DisplayMenu(classmenu, client, MENU_TIME_FOREVER); } public ClassMenuHandler(Handle:classmenu,MenuAction:action,client,param2) { if (action == MenuAction_End) { CloseHandle(classmenu); } else if (action == MenuAction_Cancel) { if (param2 == MenuCancel_ExitBack) { } } else if (action == MenuAction_Select) { new String:item1[56]; GetMenuItem(classmenu,param2,item1,sizeof(item1)); if (StrEqual(item1,"solider")) { CloseHandle(classmenu); } } } BuildClassInfoMenu(client) { new Handle:classinfo = CreateMenu(ClassInfoMenuHandler) AddMenuItem(classinfo,"soldier","Soldier"); AddMenuItem(classinfo,"scout","Scout"); AddMenuItem(classinfo,"pyro","Pyro"); AddMenuItem(classinfo,"demoman","Demoman"); AddMenuItem(classinfo,"heavy","Heavy"); AddMenuItem(classinfo,"sniper","Sniper"); AddMenuItem(classinfo,"spy","Spy"); AddMenuItem(classinfo,"engineer","Engineer"); AddMenuItem(classinfo,"medic","Medic"); AddMenuItem(classinfo,"back","Back"); SetMenuTitle(classinfo,"Dead Fortress Class Menu"); DisplayMenu(classinfo, client, MENU_TIME_FOREVER); } public ClassInfoMenuHandler(Handle:classinfomenu,MenuAction:action,client,param2) { if (action == MenuAction_End) { CloseHandle(classinfomenu); } else if (action == MenuAction_Cancel) { if (param2 == MenuCancel_ExitBack) { } } else if (action == MenuAction_Select) { new String:item1[56]; GetMenuItem(classinfomenu,param2,item1,sizeof(item1)); if (StrEqual(item1,"solider")) { CloseHandle(classinfomenu); } } }
Last edited by Bakuryu; 12-23-2011 at 00:00.
|
|