AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ban reasons only showing the 1st character (https://forums.alliedmods.net/showthread.php?t=83160)

Mlk27 01-05-2009 04:25

Ban reasons only showing the 1st character
 
any idea why in the "public banhaxor" the ban reason only printed as the first character from the reason, eg the reason is "wallhack & aimbot" it will be printed as "w" only

Code:

{
// .....

        new reason[64], minutes[8]

        new cData[100]

        cData[0] = haxor //id
        cData[1] = str_to_num(minutes)

        copy(cData[2], charsmax(cData)-1, reason)

        set_task(0.5, "banhaxor", haxor, cData, 3)

        return PLUGIN_HANDLED
}

public banhaxor(cData[])
{
        new haxorid = cData[0]
        new bantime = cData[1]

        new banreason[64]
        copy(banreason, charsmax(banreason), cData[2])
       
        // debug
        log_amx("userid: #%d bantime: %d banreason: ^"%s^"", get_user_userid(haxorid), bantime, banreason)
       
        // ....
}

Code:

L 01/04/2009 - 18:06:29: [amx_banhaxor.amxx] userid: #1 bantime: 1 banreason: "w"

jim_yang 01-05-2009 05:28

Re: Ban reasons only showing the 1st character
 
your param len is 3

jim_yang 01-05-2009 05:30

Re: Ban reasons only showing the 1st character
 
here is a example
Code:

public test2(id)
{
    new param[10]
    param[0] = 88
    copy(param[1], 9, "jim")
    set_task(1.0, "test3", 100, param, 9)
    return PLUGIN_HANDLED
}
 
public test3(param[], id)
{
    new reason[10]
    copy(reason, 9, param[1])
    console_print(1, "%d - %d - %s - %s", param[0], id, reason, param[1])
}


Mlk27 01-05-2009 09:12

Re: Ban reasons only showing the 1st character
 
hey jim thanks for codes..i understand it now

+karma


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

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