AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Getting wrong player index (https://forums.alliedmods.net/showthread.php?t=74883)

XAM 07-26-2008 15:57

Getting wrong player index
 
When someone with an index over 9, 2 numbers that means, it will only read the first number, and it will ban wrong person.

Example: a Player with index 13, gets banned by HLGUARD and kicked. But the ban will be applied to the player with index 1 instead. (in my case its my HLTV, so no harm done, but it needs to be fixed).

My code:
PHP Code:

public hlguardBan() {
    new 
bIds[1],bId[1],bLength[8],bReason[64],bNick[32],bSteamid[32],sqlCache[512]
    
read_argv(1,bIds,1)
    
bId[0] = str_to_num(bIds)
    
read_argv(2bLength7)
    
read_argv(3bReason63)
    
get_user_name(bId[0],bNick,31)
    
get_user_authid(bId[0],bSteamid,31)
    
replace_all(bNick,31,"'"," ")
    if(
equal(bLength,"3600"))
        
formatex(sqlCache,511,"INSERT INTO bans(steamid, steamid_admin, nickname, reason, added, ends, removed) VALUES('%s', '%s', '%s', '%s', NOW(), '2100-01-01 00:00:00', 0)",bSteamid,"HLGUARD",bNick,bReason)
    else
        
formatex(sqlCache,511,"INSERT INTO bans(steamid, steamid_admin, nickname, reason, added, ends, removed) VALUES('%s', '%s', '%s', '%s', NOW(), date_add(NOW(), interval %s day), 0)",bSteamid,"HLGUARD",bNick,bReason,bLength)
    
SQL_ThreadQuery(g_SqlTuple,"sqlQueryDefault",sqlCache,bId,1)



XAM 07-27-2008 01:30

Re: Getting wrong player index
 
here's my HLGUARD action lines when detecting stuff.
PHP Code:

hlg_action "b:found" "hlguardban \'%S\' \'3600\' \'%y\';wait;kick #%u [HLGUARD] Banned permanent. Reason: %y"
hlg_action "t:found" "hlguardban \'%S\' \'1\' \'%y\';wait;kick #%u [HLGUARD] Banned 1 day. Reason: %y" 

And here is my plugin_init()
PHP Code:

public plugin_init() {
    
register_plugin("XamNetworks""1.0""XAM")
    
register_clcmd("adminmenu""adminMenu")
    
register_clcmd("say","chatCommands")
    
register_clcmd("say_team","chatCommands")
    
register_srvcmd("hlguardban","hlguardBan")
    
register_event("SendAudio","end_round","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
    
cvar_cvarCheck register_cvar("x_cvarcheck","1")
    
cvar_pingCheck register_cvar("x_pingcheck","1")
    
cvar_pingMax register_cvar("x_pingmax","70")
    
cvar_pingTimes register_cvar("x_pingtimes","5")
    return 
PLUGIN_CONTINUE


Problem solved!
I've made a mistake at this line, which resulted that it only read the first number.
PHP Code:

read_argv(1,bIds,1

So I made bIds[3] and bId[3], then increased read_argv(1,bIds,2)


All times are GMT -4. The time now is 05:31.

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