AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   dm reporter help (https://forums.alliedmods.net/showthread.php?t=22701)

ng1200 01-02-2006 07:25

dm reporter help
 
hi,
this is my code:
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <sockets> #include <amxmisc> #define PLUGIN "Report Dmers" #define VERSION "Beta 1" #define AUTHOR "HyperboleRP" new dmreps[33] new dmreported[33] public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /reportdmer","repdmer") } public repdmer(id) {     new arg1[32],dmname[32]     read_argv(id,arg1,31)     new dmid=cmd_target(id,arg1,0)     get_user_name(dmid,dmname,31)     if(dmreported[id] = dmid)     {         client_print(id,print_chat,"[DMReporter]Cant report more times on that dmer")         return PLUGIN_HANDLED     }     if(get_user_frags(dmid) > 1)     {         dmreps[dmid] = dmreps[dmid]+1         dmreported[id] = dmid         client_print(dmid,print_chat,"[DMReporter]You Have been reported as a dmer. after 5 reports your kicked.")     }     else     {         client_print(id,print_chat,"[DMReporter]Sorry but %s Cant be a dmer with 0 frags",dmname)     }     if(dmreps[dmid] > 5)     {         server_cmd("kick %s",dmname)         dmreps[dmid] = 0     }     return PLUGIN_HANDLED }
it doenst work, i dont know why.
and i also tried to make it so pepole wont be able to report on same person again.
but, it didnt actually work.
i could report on other one, and then back on the already-reported one.
help?

Basic-Master 01-02-2006 07:42

Re: dm reporter help
 
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <sockets> #include <amxmisc> #define PLUGIN "Report Dmers" #define VERSION "Beta 1" #define AUTHOR "HyperboleRP" new dmreps[33] new dmreported[33] public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say", "repdmer") // You need to register say, your version doesn't work because it already contains arguments } public repdmer(id) {     new arg1[32]     read_argv(1, arg1, 31) // read the first argument, not the argument no. id     if (!equal(arg1, "/reportdmer")) // check if this command is for this function, if not ignore..         return PLUGIN_CONTINUE         read_argv(2, arg1, 31)     new dmname[32], dmid = cmd_target(id, arg1, 0)     if (!dmid) { // 0 would be the server and I believe it's not possible to kick it ;)         client_print(id, print_chat, "[DMReporter] Can't find player ^"%s^".", arg1)         return PLUGIN_HANDLED     }         get_user_name(dmid, dmname, 31)     if(dmreported[id] == dmid) // use == for comparisons, = for assignments         client_print(id,print_chat,"[DMReporter] Can't report more times on that dmer")     else if (get_user_frags(dmid) > 1) {         dmreps[dmid]++ // same as dmreps[dmid] = dmreps[dmid]+1         dmreported[id] = dmid         client_print(dmid, print_chat, "[DMReporter] You have been reported as a dmer. You'll get kicked after 5 reports.")     }     else         client_print(id,print_chat,"[DMReporter] Sorry but %s can't be a dmer with 0 frags",dmname)     if(dmreps[dmid] > 5) {         server_cmd("kick %s", dmname)         dmreps[dmid] = 0     }     return PLUGIN_HANDLED }

try that :)

XxAvalanchexX 01-02-2006 13:54

Basic, if someone uses the messagemode1 command says something like this:

/command arg1 arg2

I'm fairly certain it will be read by the console like this:

say "/command arg1 arg2"

Therefore arg0 is say, and arg1 is /command arg1 arg2, so you can't use an equali check.

Des12 01-02-2006 14:16

So if you are doing

read_argc() on say "/command arg1 arg2"

it would return 4?

XxAvalanchexX 01-02-2006 17:01

Anything between quotations is one argument. In that case it would be 2.


All times are GMT -4. The time now is 16:09.

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