Raised This Month: $ Target: $400
 0% 

Arguments not finishing


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
slmclarengt
Veteran Member
Join Date: Jul 2004
Location: The Cookie Jar... or Pul
Old 02-20-2007 , 18:05   Re: Arguments not finishing
Reply With Quote #7

Quote:
Originally Posted by Hawk552 View Post
Try simplifying it into 3 args instead of the 6 that I did, it's just in case your name is like "bob bill smith" and the person types each one without quotes.
Still does not work. No MATTER WHAT is typed, it tells them they entered 0 XP. Whether they say "hello" or "/transferxp" it does not matter, it automatically responds "You have entered 0 xp..." - Here's the code.

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

public plugin_init()
{
    register_plugin("Give XP","1.0","Hawk552")
    
    register_clcmd("say","CmdSay")
}

public CmdSay(id)
{
    static Args[3][33],Name[33]
    new Num = read_argc()
    for(new Count = 1;Count <= Num;Count++)
        read_argv(Count,Args[Count - 1],32)

    new XP = str_to_num(Args[Num - 1])
    if(XP < 1)
    {
        client_print(id,print_chat,"[WAR3FT] You must give more than 0 XP (entered %d)",XP)
        return
    }
    
    for(new Count = 1,Len;Count <= Num - 2;Count++)
        Len += copy(Name[Len],32 - Len,Args[Count])
    
    new Target = cmd_target(id,Name,0)
    if(!Target || !is_user_connected(Target))
    {
        client_print(id,print_chat,"[WAR3FT] Could not find a user matching your input")
        return
    }
    
    get_user_name(id,Name,32)
    static tName[33]
    get_user_name(Target,Name,32)
    
    client_print(0,print_chat,"[WAR3FT] %s is giving %s %d XP",Name,tName,XP)
    
    server_cmd("amx_givexp ^"%s^" %d",tName,XP)
    server_cmd("amx_givexp ^"%s^" -%d",Name,XP)
}
Slmclarengt
__________________
But we don’t beat the Reaper by living longer. We beat the Reaper by living well. -Dr. Randy Pausch, R.I.P.

Come play WC3:FT on BnD Clan Server! You know you want to: Connect to WC3:FT BnD - go ahead click me!
slmclarengt is offline
 



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 00:36.


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