Raised This Month: $ Target: $400
 0% 

Read_agv...Error?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 03-20-2010 , 14:02   Read_agv...Error?
Reply With Quote #1

Hey, i was making my own version of amx_slap, and read_argv didnt work out to well for me.


PHP Code:
register_concmd("amx_ultslap""slap_cmd"ADMIN_BAN"- amx_ultslap <Victim> <Damage> <# of Slaps>"); 
PHP Code:
public slap_cmd(id)
{
    new 
arg[32], arg2arg3name[32], name2[32];

    
readargv(1arg31)
    
readargv(2arg20)
    
readargv(3arg30)

    
get_user_name(idname31)
    
get_user_name(idname231)

    for (new 
i=1i<=arg3i++)
    {
           
user_slap(argarg20);
    }

    
client_print(0print_chat"ADMIN: %s has slapped %s"namename2); 

What did i do wrong?
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-20-2010 , 14:05   Re: Read_agv...Error?
Reply With Quote #2

Quote:
Originally Posted by r4ndomz View Post
What did i do wrong?
You try to do something too dificult for your level, please start with something easier.
All what is highlighted is wrong :

Code:
public slap_cmd(id) {     new arg[32], arg2, arg3, name[32], name2[32];     readargv(1, arg, 31)     readargv(2, arg2, 0)     readargv(3, arg3, 0)     get_user_name(id, name, 31)     get_user_name(id, name2, 31)     for (new i=1; i<=arg3; i++)     {            user_slap(arg, arg2, 0);     }     client_print(0, print_chat, "ADMIN: %s has slapped %s", name, name2); }
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-20-2010 , 14:27   Re: Read_agv...Error?
Reply With Quote #3

Read some tutorials there : http://wiki.amxmodx.org/Category:Scripting_(AMX_Mod_X)
__________________
Arkshine is offline
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 03-20-2010 , 15:04   Re: Read_agv...Error?
Reply With Quote #4

Quote:
Originally Posted by ConnorMcLeod View Post
You try to do something too dificult for your level, please start with something easier.
All what is highlighted is wrong :

Code:
public slap_cmd(id) { new arg[32], arg2, arg3, name[32], name2[32];
readargv(1, arg, 31)
readargv(2, arg2, 0)
readargv(3, arg3, 0)
get_user_name(id, name, 31) get_user_name(id, name2, 31)
for (new i=1; i<=arg3; i++)
{ user_slap(arg, arg2, 0);
} client_print(0, print_chat, "ADMIN: %s has slapped %s", name, name2);
}

Well i have to learn it at some point. Anyways what should i do with the highlighted text?
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-20-2010 , 15:08   Re: Read_agv...Error?
Reply With Quote #5

Read more tutorials, you will your errors fastly. Follow the link above.
__________________
Arkshine is offline
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 03-20-2010 , 15:35   Re: Read_agv...Error?
Reply With Quote #6

Ok, i went through this http://wiki.amxmodx.org/Intro_to_AMX_Mod_X_Scripting at the hp tutorial thing.

PHP Code:
register_concmd("amx_ultslap""slap_cmd"ADMIN_BAN"- amx_ultslap <Victim> <Damage> <# of Slaps>"); 
PHP Code:
public slap_cmd(idlevelcid)
{
    if (!
cmd_access(idlevelcid3))
        return 
PLUGIN_HANDLED

    
new arg[32], arg2[4], arg3[4], name[32];

    
readargv(1arg31)
    
readargv(2arg23)
    
readargv(3arg33)

    new 
targ cmd_target(idarg1);
    new 
amount str_to_num(arg2);
    new 
times str_to_num(arg3);

    
get_user_name(idname31)

    if(!
targ)
    {
        
console_print(id"Sorry, player %s could not be found or targetted!"arg)
        return 
PLUGIN_HANDLED
    
}
    else
    {
        for (new 
i=1i<=timesi++)
        {
               
user_slap(targamount0);
        }

        
client_print(0print_chat"ADMIN: %s has slapped %s %s times with %s damage"nameargtimesamount);
    }

    return 
PLUGIN_CONTINUE

PHP Code:
//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// allinone.sma
// C:\Documents and Settings\\Desktop\USB\compiler1\allinone.sma(48) : err
or 017undefined symbol "readargv"
// C:\Documents and Settings\\Desktop\USB\compiler1\allinone.sma(49) : err
or 017undefined symbol "readargv"
// C:\Documents and Settings\\Desktop\USB\compiler1\allinone.sma(50) : err
or 017undefined symbol "readargv"
//
// 3 Errors.
// Could not locate output file C:\Documents and Settings\\Desktop\USB\com
piler1\compiled\allinone.amx (compile failed).
//
// Compilation Time: 0.2 sec
// ----------------------------------------

Press enter to exit ... 

__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-20-2010 , 15:44   Re: Read_agv...Error?
Reply With Quote #7

Code:
read_argv
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-20-2010 , 16:10   Re: Read_agv...Error?
Reply With Quote #8

That's better.
You forgot to use cmd_target to retrieve the player index you want to slap.
Also, a for() loop won't do what you want to do because such a loop in done in an instant, means the player will be slapped 3 times at the exact same time.
You would have to set a task and use the flag "a" (repeat) in it with the number of slap ou want.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 03-20-2010 , 20:35   Re: Read_agv...Error?
Reply With Quote #9

Thanks connor, but how do i set the for loop to a?

Also, i feel so silly for readargv instead of read_argv, i remember searching read_argv on the func wiki and just feeling that mood where you want to scream WHAT THE HELL!! and wonder why it wasnt working LOL
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-20-2010 , 21:17   Re: Read_agv...Error?
Reply With Quote #10

Heres a hint

http://www.amxmodx.org/funcwiki.php?go=func&id=253

Just make sure id is the id of player you want to slap.
PHP Code:
new iData];
iData] = amount;
set_task0.75 "SlapPlayer" id iData sizeofiData ) , "a" times );

public 
SlapPlayeriData] , id )
{
    
user_slapid iData] , );

__________________
Bugsy 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 08:40.


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