Raised This Month: $ Target: $400
 0% 

menu scripting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
soccdoodcss
Veteran Member
Join Date: Nov 2006
Location: Wisconsin
Old 11-27-2006 , 23:58   menu scripting
Reply With Quote #1

I need serious help with my menu. I am brand new, started yesterday, at attempting to script in AMXX mod. this is my immediate plugin.




#include <amxmod>
#include <amxmisc>
#include <cstrike>
#include <fun>



public plugin_init()
{
register_plugin("MultiMenu","1.0","Bent")

register_menucmd(register_menuid("MultiMenu") ,1023,"actionMenu")
register_clcmd("amx_menu","showMenu",ADMIN_SL AY,"-displays Bent's menu")

new modName[32]
get_modname(modName,31)

}

public actionMenu(id,key)
{
switch(key){
case 0:{

if (get_cvar_num("amx_kyle")==0)
return PLUGIN_HANDLED
set_user_health(id, get_user_health(id) +250)
return PLUGIN_HANDLED

}
case 1:{

if (get_cvar_num("amx_kyle")==0)
return PLUGIN_HANDLED
cs_set_user_money(id, cs_get_user_money(id) +1000)
return PLUGIN_HANDLED

}
case 2:{

if (get_cvar_num("amx_kyle")==0)
return PLUGIN_HANDLED
set_user_armor(id, get_user_armor(id) +100)
return PLUGIN_HANDLED

}
case 3:{

if (get_cvar_num("amx_kyle")==0)
return PLUGIN_HANDLED
set_user_maxspeed(id, 400000000.0)
return PLUGIN_HANDLED

}
}

return PLUGIN_HANDLED
}

public showMenu(id,level,cid)
{
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED

new menuBody[512]
new len = format(menuBody,255 "\yFirst Menu:^n";)
len += format(menuBody[len],511-len,"1. Health^n2. Money^n3. Armor^n4. Slight Speed^n^n0. Exit")
show_menu(id,((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1< <9)),menuBody)

return PLUGIN_HANDLED
}





What am i doing wrong??? Anyones help would be appreciated. Good Luck, and Thank You.

By the way, this entire thing was done by me PLEASE HELP!
soccdoodcss is offline
Send a message via AIM to soccdoodcss
jim_yang
Veteran Member
Join Date: Aug 2006
Old 11-28-2006 , 00:10   Re: PLEASE HELP! MENU SCRIPTING!
Reply With Quote #2

indent your code please.
Code:
public actionMenu(id,key) {  //check the cvar here     if (!get_cvar_num("amx_kyle"))     return PLUGIN_HANDLED    //then switch(key)      ... }
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 11-28-2006 , 00:15   Re: PLEASE HELP! MENU SCRIPTING!
Reply With Quote #3

and you can try amxx studio, it has a menu generator
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 11-28-2006 , 03:04   Re: PLEASE HELP! MENU SCRIPTING!
Reply With Quote #4

+ You haven't registered the cvar "amx_kyle". You'll have to register it in plugin_init():
Code:
 register_cvar("amx_kyle", "1")

And this:
Code:
if (get_cvar_num("amx_kyle")==0) return PLUGIN_HANDLED set_user_maxspeed(id, 400000000.0) return PLUGIN_HANDLED
Is extreme. You will crash the server with this setting. change it to like 1000.0
or something.

Last edited by mateo10; 11-28-2006 at 03:07.
mateo10 is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 11-28-2006 , 12:34   Re: PLEASE HELP! MENU SCRIPTING!
Reply With Quote #5

I beleve 999 is maximum user speed.
[ --<-@ ] Black Rose is offline
soccdoodcss
Veteran Member
Join Date: Nov 2006
Location: Wisconsin
Old 11-28-2006 , 16:28   Re: PLEASE HELP! MENU SCRIPTING!
Reply With Quote #6

Here is the .sma file, i figure it will be easier to understand.

Problem 1 : line 31 loose indentation
Problem 2 : line 66 expected token "," but found "-string-"
Problem 3 : line 66 expression has no affect
Problem 4 : line 66 invalid expression assumed zero

Once again thank you all, and hopefully you can help.
Attached Files
File Type: sma Get Plugin or Get Source (Kyle.sma - 82 views - 1.4 KB)
soccdoodcss is offline
Send a message via AIM to soccdoodcss
mateo10
Veteran Member
Join Date: Jan 2006
Old 11-29-2006 , 11:01   Re: PLEASE HELP! MENU SCRIPTING!
Reply With Quote #7

This one compiles without errors or warnings.
All credits goes to soccdoodcss.
Attached Files
File Type: sma Get Plugin or Get Source (Kyle.sma - 646 views - 1.4 KB)
mateo10 is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 11-29-2006 , 11:06   Re: PLEASE HELP! MENU SCRIPTING!
Reply With Quote #8

set_user_maxspeed(id, 1000.0)


1.0 is normal speed ( i beleve it's 320 )

2.0 is twice as much. you only need like 3.2 to get max speed.
[ --<-@ ] Black Rose is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 11-29-2006 , 16:10   Re: menu scripting
Reply With Quote #9

I fixed the subject of your thread for you.

Quote:
PLEASE HELP! MENU SCRIPTING!
Do not use all caps. Do not say anything related to "please help". Do not use exclamation marks.

Do make your subject specific and descriptive of the issue you want help with.
__________________
Brad is offline
soccdoodcss
Veteran Member
Join Date: Nov 2006
Location: Wisconsin
Old 11-29-2006 , 23:58   Re: menu scripting
Reply With Quote #10

Quote:
Originally Posted by Brad View Post
I fixed the subject of your thread for you.



Do not use all caps. Do not say anything related to "please help". Do not use exclamation marks.

Do make your subject specific and descriptive of the issue you want help with.
My bad, won't happen again.
__________________
"Now safe beneath their wisdom and their feet.
Here I will teach you truly how to sleep."
soccdoodcss is offline
Send a message via AIM to soccdoodcss
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:59.


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