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-17-2007 , 22:58   Re: Arguments not finishing
Reply With Quote #3

Quote:
Originally Posted by Hawk552 View Post
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.
Ok, your code definitely uses more optimization and proper coding technique than mine because you practice more, therefore, you write better. Regarding the 10%, I'm trying to take 10% of whatever they input later on in the code like right before the "amx_givexp" line so couldn't we insert a line to take 90% of the XP away and give the target only 10%? I think it would be MAJORLY abused on a server if you could just transfer XP between everyone that simply without any kind of consequence. It's like taking out a loan and only having to pay the loan back, no interest/APR.

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