AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   need help with seeting CVARS (https://forums.alliedmods.net/showthread.php?t=20507)

SweatyBanana 11-10-2005 07:04

need help with seeting CVARS
 
Was putting a script together to set CVARS when i types amx_surf...didn't know exactly wat to do with the cvars though....

Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {     register_srvcmd("amx_surf","cmd_surf",ADMIN_LEVEL_B,"<Surf Enabled>")     register_srvcmd("surf_config","cmd_surf",ADMIN_LEVEL_B,"<Surf Enabled>") } public cmd_surf(id, level, cid) {     if ( !cmd_access( id, level, cid, 2 ) )         return PLUGIN_HANDLED;             amx_cvar sv_accelerate 100     amx_cvar sv_airaccelerate 800     amx_cvar sv_gravity 800 } {     client_print(0, print_chat, "[AMXX]Surf Mode Enabled");     return PLUGIN_HANDLED; }

THX

jtp10181 11-10-2005 07:08

http://www.amxmodx.org/funcwiki.php?go=func&id=242

SweatyBanana 11-10-2005 08:10

OK so this?

Code:
#include <amxmodx>   #include <amxmisc>   #include <fun>   public plugin_init() {     register_srvcmd("amx_surf","cmd_surf",ADMIN_LEVEL_B,"<Surf Enabled>")     register_srvcmd("surf_config","cmd_surf",ADMIN_LEVEL_B,"<Surf Enabled>") } public cmd_surf(id, level, cid) {     if ( !cmd_access( id, level, cid, 2 ) )         return PLUGIN_HANDLED;               set_cvar_num ( const sv_accelerate [],100 )     set_cvar_num ( const sv_airaccelerate [],800 )     set_cvar_num ( const sv_gravity [],800 ) } {     client_print(0, print_chat, "[AMXX]Surf Mode Enabled");       return PLUGIN_HANDLED;   }

Xanimos 11-10-2005 08:14

Nope. When you see ( const String[] , ....) it just means you put a string in there.
Code:
 #include <amxmodx>   #include <amxmisc>   #include <fun>   public plugin_init()   {       register_srvcmd("amx_surf","cmd_surf",ADMIN_LEVEL_B,"<Surf Enabled>")       register_srvcmd("surf_config","cmd_surf",ADMIN_LEVEL_B,"<Surf Enabled>")   }   public cmd_surf(id, level, cid)   {       if ( !cmd_access( id, level, cid, 2 ) )           return PLUGIN_HANDLED;                 set_cvar_num ( "sv_accelerate",100 )     set_cvar_num ( "sv_airaccelerate",800 )     set_cvar_num ( "sv_gravity",800 ) }   {       client_print(0, print_chat, "[AMXX]Surf Mode Enabled");       return PLUGIN_HANDLED;   }

SweatyBanana 11-10-2005 15:59

/home/users/amxmodx/tmp3/textcLOqLY.sma(19) : warning 209: function "cmd_surf" should return a value
/home/users/amxmodx/tmp3/textcLOqLY.sma(20) : error 055: start of function body without function header
/home/users/amxmodx/tmp3/textcLOqLY.sma(22) : error 010: invalid function or declaration

Zenith77 11-10-2005 16:05

You cant just place ' { ' in places :p ( Not sure if your new at this )


Code:
#include <amxmodx>   #include <amxmisc>   #include <fun>   public plugin_init()   {       register_srvcmd("amx_surf","cmd_surf",ADMIN_LEVEL_B,"<Surf Enabled>")       register_srvcmd("surf_config","cmd_surf",ADMIN_LEVEL_B,"<Surf Enabled>")   }   public cmd_surf(id, level, cid)   {       if ( !cmd_access( id, level, cid, 2 ) )           return PLUGIN_HANDLED;                 set_cvar_num ( "sv_accelerate",100 )     set_cvar_num ( "sv_airaccelerate",800 )     set_cvar_num ( "sv_gravity",800 )     client_print(0, print_chat, "[AMXX]Surf Mode Enabled");       return PLUGIN_HANDLED;   }

Hawk552 11-10-2005 20:33

brb

EDIT:

http://forums.alliedmods.net/showthread.php?p=138464

SweatyBanana 11-10-2005 20:56

tried that be4...couldnt get it to work...

Hawk552 11-10-2005 21:13

The 1.60 compiler for the site is broken, download the already compiled package.

alonelive 05-27-2013 10:24

Re: need help with seeting CVARS
 
Why ADMIN_LEVEL_B?
register_srvcmd("amx_surf","cmd_surf",ADMIN_LEVEL_B,"<Surf Enabled>")

SrvCmd can be executed only from server console (hlds console / amx_rcon / rcon)? Or not?


All times are GMT -4. The time now is 23:41.

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