Raised This Month: $ Target: $400
 0% 

problem with argument copy


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Owyn
Veteran Member
Join Date: Nov 2007
Old 12-17-2008 , 12:42   problem with argument copy
Reply With Quote #1

problem is when i do persontoban() and ban person, it gives me value of reason = 8 , not what there was in reason =0 where does this number comes from? O_o how do i fix it?

here's the code

Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Ban with proof"
#define VERSION "1.0.4"
#define AUTHOR "[lego]F34R and re-scripted by kuddo"

static const banurl[] = ""

new Bantype

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_concmd("amx_banshot","banwithproof",ADMIN_BAN,"<name> <time> <reason>")
    register_cvar("amx_banurl",banurl)
    Bantype = register_cvar("amx_banshot_type", "2")    
}


public banwithproof(id,level,cid){
    if(!cmd_access(id,level,cid,2))
        return PLUGIN_HANDLED;

    new authid[32], ipadd[32], name[32], admin_name[32], reason[32], CurrentTime[9], hostname[64] ,banurl[64]
    new arg[32], arg2[32], temp[36]
    
    read_argv(1,arg,31)
    read_argv(2,arg2,31)
    
    new target = cmd_target(id,arg,1)
    
    if (!target) return PLUGIN_HANDLED
    
    get_user_ip(target,ipadd,31)
    get_cvar_string("hostname",hostname,63) 
    get_user_name(target,name,31)
    get_user_authid(target,authid,31)
    get_cvar_string("amx_banurl", banurl,63)
    get_user_name(id, admin_name, 31)
    read_argv(3, reason, 31)
    
    log_to_file("BannedwithSS.txt","    %s | IP: %s | STEAMid: %s | ADMIN: %s | REASON: %s^n",name,ipadd,authid,admin_name,reason)
    
    client_print(target,print_chat, "[Server] %s",hostname)
    client_print(target,print_chat, "[Name] %s [STEAMid] %s [IP] %s",name,authid,ipadd) 
    client_print(target,print_chat, "[Admin] %s [Reason] %s",admin_name,reason)
    get_time("%m/%d/%Y - %H:%M:%S",CurrentTime,31)
    
    client_print(target,print_chat, "[Date/Hour] %s",CurrentTime)
    client_print(target,print_chat, "[Website] Visit %s to be unbanned",banurl)
    
    console_print(target,"[Server] %s",hostname)
    console_print(target,"[Name] %s [STEAMid] %s [IP] %s",name,authid,ipadd)
    console_print(target,"[Admin] %s [Reason] %s",admin_name,reason) 
    console_print(target,"[Date/Hour] %s",CurrentTime)
    console_print(target,"[Website] Visit %s to be unbanned",banurl)
    
    client_cmd(target,"wait;wait;snapshot;wait;snapshot")
    
    temp[0] = target
    temp[1] = str_to_num(arg2)
    temp[2] = id
    copy( temp[3], 35, reason )
    
    set_task(0.5,"persontoban", target, temp, 36)
    
    return PLUGIN_HANDLED
}

public persontoban(arg[]){
    new name2[32]
    
    new target = arg[0]
    new bantime = arg[1]
    new id = arg[2]
    new reason[32]
    copy(reason, 31, arg[3])
    
    get_user_name(target,name2,31)
    
    switch (get_pcvar_num(Bantype)){
        case 1:{
            client_cmd(id, "amx_ban %s %d %s",name2,bantime,reason)
        }
        case 2:{
            client_cmd(id, "amx_banip %s %d %s",name2,bantime,reason)
        }
        case 3:{
            client_cmd(id, "amx_ban %d %s %s",bantime,name2,reason)
        }
        case 4:{
            client_cmd(id, "amx_say Visit %s",banurl)
        }
    }
    
}

Last edited by Owyn; 12-17-2008 at 12:50.
Owyn is offline
Send a message via ICQ to Owyn
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 12-17-2008 , 12:44   Re: problem with argument copy
Reply With Quote #2

Indentation please or I won't even care to read it.
__________________

Community / No support through PM
danielkza is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 12-17-2008 , 12:48   Re: problem with argument copy
Reply With Quote #3

Quote:
Indentation
i fixed it

Last edited by Owyn; 12-17-2008 at 12:51.
Owyn is offline
Send a message via ICQ to Owyn
Old 12-17-2008, 12:55
SnoW
This message has been deleted by SnoW. Reason: Bah, useless? :I
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 12-17-2008 , 12:58   Re: problem with argument copy
Reply With Quote #4

Why are you using a task for this? Just call persontoban() normally. Also, I don't get what was the original problem. How can you want persontoban to return anything if you're scheduling it for later?
__________________

Community / No support through PM
danielkza is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 12-17-2008 , 13:00   Re: problem with argument copy
Reply With Quote #5

but it worked with all other arguments, like target, id and bantime =0
Owyn is offline
Send a message via ICQ to Owyn
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 12-17-2008 , 13:01   Re: problem with argument copy
Reply With Quote #6

Quote:
Originally Posted by .Owyn. View Post
but it worked with all other arguments, like name, name2 and bantime =0
I still don't get what you're trying to achieve. Could please explain what you want to retrieve exactly?
__________________

Community / No support through PM
danielkza is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 12-17-2008 , 13:04   Re: problem with argument copy
Reply With Quote #7

i type amx_banshot name time reason, it bans a person, makes two screens, prints info on their screen ane do amx_banip name time reason

only problem is amx_banip name time reason, where reason is allways set to "8" and i have no idea why 8

everything works xept reason =3
Owyn is offline
Send a message via ICQ to Owyn
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 12-18-2008 , 01:25   Re: problem with argument copy
Reply With Quote #8

PHP Code:
if(!cmd_access(id,level,cid,2)) 
Should be:

PHP Code:
if (!cmd_access(idlevelcid4)) 
Since you have 4 arguments, including the command itself.
Spunky is offline
Send a message via AIM to Spunky
Owyn
Veteran Member
Join Date: Nov 2007
Old 12-18-2008 , 06:36   Re: problem with argument copy
Reply With Quote #9

oh, i fixed that, but i'm still getting
Reason: 8
Owyn is offline
Send a message via ICQ to Owyn
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 12-18-2008 , 11:51   Re: problem with argument copy
Reply With Quote #10

PHP Code:
// global variable
new g_reason32 ];

// ....

public yourfunc()
{
    
// read reason
    
new reason32 ];
    
read_argv3reasonsizeof reason );
    
    
copyg_reason31reason );
    
    
set_task3.0"something" );
    return 
1;
}

public 
something() client_print0print_chatg_reason ); 
__________________

anakin_cstrike is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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