AlliedModders

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

soccdoodcss 11-27-2006 23:58

menu scripting
 
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!

jim_yang 11-28-2006 00:10

Re: PLEASE HELP! MENU SCRIPTING!
 
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)      ... }

jim_yang 11-28-2006 00:15

Re: PLEASE HELP! MENU SCRIPTING!
 
and you can try amxx studio, it has a menu generator

mateo10 11-28-2006 03:04

Re: PLEASE HELP! MENU SCRIPTING!
 
+ 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.

[ --<-@ ] Black Rose 11-28-2006 12:34

Re: PLEASE HELP! MENU SCRIPTING!
 
I beleve 999 is maximum user speed.

soccdoodcss 11-28-2006 16:28

Re: PLEASE HELP! MENU SCRIPTING!
 
1 Attachment(s)
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. :up:

mateo10 11-29-2006 11:01

Re: PLEASE HELP! MENU SCRIPTING!
 
1 Attachment(s)
This one compiles without errors or warnings.
All credits goes to soccdoodcss.

[ --<-@ ] Black Rose 11-29-2006 11:06

Re: PLEASE HELP! MENU SCRIPTING!
 
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.

Brad 11-29-2006 16:10

Re: menu scripting
 
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.

soccdoodcss 11-29-2006 23:58

Re: menu scripting
 
Quote:

Originally Posted by Brad (Post 408572)
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.

:mrgreen:My bad, won't happen again.:up:


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

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