AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Whats wrong with this script? (https://forums.alliedmods.net/showthread.php?t=19591)

DarlD 10-20-2005 15:47

Whats wrong with this script?
 
I get no errors while compiling, but when im in game, i type amx_hsonly and it wont turn it on! did i do an error for the command?
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "amx_hsonly" #define VERSION "1.0" #define AUTHOR "Meta" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("amx_hsonly","hs_only",ADMIN_KICK,"enable hs only")     register_cvar("hs_only","0"); } public hs_only(id,level,cid) {     if(!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     new arg[12];     read_argv(1,arg,11);     if(str_to_num(arg) > 0)     {         client_print(0,print_chat,"Meta-HSONLY: HS ONLY MODE ENABLED FOR THIS ROUND")         set_user_hitzones(0,0,2)     }     else     {         client_print(0,print_chat,"Meta-HSONLY: HS ONLY MODE DISABLED FOR THIS ROUND")         set_user_hitzones(0,0,255) //this is how you set the hitzones back to normal     }     return PLUGIN_CONTINUE }

atomic 10-20-2005 16:07

why do you have the cvar?

atomic 10-20-2005 16:11

Code:
 /* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "amx_hsonly" #define VERSION "1.0" #define AUTHOR "Meta" new hs public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("amx_hsonly","hs_only",ADMIN_KICK,"<1|0>")   } public hs_only(id,level,cid)   {     if(!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     new arg[12];     read_argv(1,arg,11);     hs = str_to_num(arg)     if(hs== 1)     {         client_print(0,print_chat,"Meta-HSONLY: HS ONLY MODE ENABLED FOR THIS ROUND")         set_user_hitzones(0,0,2)     }     if(hs== 0)       {         client_print(0,print_chat,"Meta-HSONLY: HS ONLY MODE DISABLED FOR THIS ROUND")         set_user_hitzones(0,0,255) //this is how you set the hitzones back to normal     }     return PLUGIN_CONTINUE }

tell me if it works

XxAvalanchexX 10-20-2005 19:28

You have to use amx_hsonly 1 for on or amx_hsonly 0 for off, you can't just enter the command amx_hsonly by itself.

v3x 10-20-2005 20:05

Also, put "return PLUGIN_HANDLED" at the end instead of "return PLUGIN_CONTINUE" for commands ;)

Zenith77 10-20-2005 20:23

OK i know was wrong about the hud messages having an index of 0,


but i am like 90% sure you can not put 0 in this funciton, but i could be wrong.




In the case that i am right,

Code:
 new i    for( i = 0; i < get_maxplayers(); i++ ) {       if( !is_user_connected(i) ) continue       set_user_hitzones(i,i,255)  }

Xanimos 10-20-2005 20:48

Nope, wrong again. Sorry
Quote:

Originally Posted by Function Doc
set_user_hitzones ( [ index = 0, target = 0, body = 255 [ )

Set index to a player's index and leave target at 0 to define what bodyparts this player can hit when he is firing.

Notes
Sets hit zones for player.
Parts of body are as bits:
1 - generic
2 - head
4 - chest
8 - stomach
16 - left arm
32 - right arm
64 - left leg
128 - right leg

Set index to 0 and target to a player's index to define what bodyparts on player other players can hit when they are firing.

Set both index and target to 0 to define globally what bodyparts people can hit and what bodyparts can be hit when firing.
Example: ( Make a single player fire blanks )


Zenith77 10-20-2005 20:50

Sigh, i know there is some situations where you cant use 0, or else it will give you an error :(


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

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