Quote:
Originally Posted by Hawk552
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
__________________