Raised This Month: $ Target: $400
 0% 

Arguments not finishing


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-16-2007 , 21:50   Re: Arguments not finishing
Reply With Quote #2

I rewrote it since your code is basically unworkable (at least to me). There's no real way to detect 10% of their XP, so I just left that part out:

Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {     register_plugin("Give XP","1.0","Hawk552")         register_clcmd("say","CmdSay") } public CmdSay(id) {     static Args[6][33],Name[33]     new Num = read_argc()     for(new Count = 1;Count <= Num;Count++)         read_argv(Count,Args[Count - 1],32)         if(!equali(Args[0],"/transferxp"))         return         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) }

Problems:
1) You can give more XP than you have.
2) You can't cap it at 10% (as I said before).

This is more an example than anything - you could integrate it into your WC3 plugin (I'm guessing FT) to give the ability to check the XP of these players.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
 



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