AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Menus (https://forums.alliedmods.net/showthread.php?t=5448)

Peli 09-01-2004 22:56

Menus
 
How would you know if a player chose something from a menu and how would you give him a weapon right after it? Can anyone show me with code? :)

Freecode 09-01-2004 23:01

show us ur menu code :)

Peli 09-01-2004 23:05

I didn't have one yet but I was just wondering.

Freecode 09-01-2004 23:10

well u do like this
Code:
switch (keys) {     case 1:     {         //code to give weapons or u can call another function in the plugin     }     case 2:     {         //code to give weapons or u can call another function in the plugin     } }

Peli 09-01-2004 23:14

Okay , so if you did that function by itself then it would automaticly no how many cases the menu has and would apply each number to the function?

Freecode 09-01-2004 23:51

no u pass on the keys to that function

Peli 09-01-2004 23:56

Okay I think I got it , but here's my code ( part of it ) :
Code:
public Myfunc(id, key) {     switch(key)     {         case 0:         { client_print(id, print_chat, "You have selected choice number 1") //Give a SMG         }         case 1:         { client_print(id, print_chat, "You have selected choice number 2") //Give a Rifle         }         case 2:         { client_print(id, print_chat, "You have selected choice number 3") //Give a Sniper Rifle         }         case 3:         { return PLUGIN_HANDLED         }     } }
BTW , thanks Freecode. :)

Freecode 09-01-2004 23:59

yep u got it

Peli 09-02-2004 00:00

Okay , thanks man!!! :D

Peli 09-02-2004 01:27

Couple more questions.
1. How would take off a players bind to buy something and how would you stop a player from binding a key to the regular CS buy menus ( B & O ) while they play on that server?
2. After a player clicks on a button how would you make a new menu pop-up asking them which weapon to pick? Ex : If they picked a rifle class and you let them choose between all the CS rifles , like AK's , Colt's etc... If anyone could help me , it would be appreciated. :)


All times are GMT -4. The time now is 17:10.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.