AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   HS only script (https://forums.alliedmods.net/showthread.php?t=19550)

DarlD 10-19-2005 11:45

HS only script
 
ok so basicly its working. but i would like to be able to take it off some how.

right now thats the code i have for the HS only script

Code:
register_concmd("ma_hsonly","hs_only",ADMIN_KICK,"enable hs only") register_cvar("hs_only","0"); public hs_only() {     {         client_print(0,print_chat,"Meta-Addons: HS ONLY MODE ENABLED FOR THIS ROUND")         set_user_hitzones(0,0,2)     }     return PLUGIN_CONTINUE }

i would like to know how to make commands like amx_hsonly 1= on 0= off

SweatyBanana 10-19-2005 12:41

all you would have to do is set another command to let all the hitzones be shot...its not that hard, but i dont know the hitzones...

XxAvalanchexX 10-19-2005 14:31

Code:
register_concmd("ma_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-Addons: HS ONLY MODE ENABLED FOR THIS ROUND")         set_user_hitzones(0,0,2)     }     else     {         client_print(0,print_chat,"Meta-Addons: HS ONLY MODE DISABLED FOR THIS ROUND")         // reset hitzones however you do it     }     return PLUGIN_CONTINUE }

This uses the cmd_access function from the amxmisc include to make sure the person calling the function really has access to it. The last parameter is the number of arguments the function has plus one. Since we only want one argument, on or off, we take that and add one to get two.

It then uses the read_argv function to read the first argument (that's the first parameter, 1) into the arg variable. Then we check to see if it is more then one and turn it on, otherwise we turn it off.

Hawk552 10-19-2005 14:53

set_user_hitzones is broken AFAIK

DarlD 10-19-2005 15:33

So if i type ma_hsonly 1 in console it will enable it? and if i type ma_hsonly 0 it will disable it?

Code:
register_concmd("ma_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-Addons: HS ONLY MODE ENABLED FOR THIS ROUND")         set_user_hitzones(0,0,2)     }     else     {         client_print(0,print_chat,"Meta-Addons: 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 }

XxAvalanchexX 10-19-2005 15:44

Try it.


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

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