Raised This Month: $ Target: $400
 0% 

The Xp isnt added :S


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
maakera
Member
Join Date: Jul 2009
Old 05-16-2010 , 15:08   The Xp isnt added :S
Reply With Quote #1

why isnt the XP added :s ?
PHP Code:
public cmd_xp(idlevelcid)
{
     if (!
cmd_access(idlevelcid3))
        return 
PLUGIN_HANDLED
         
new Arg1[24]
    new 
Arg2[4]
    new 
Xp str_to_num(Arg2)
    new 
szName[33];

    
//Get the command arguments from the console
    
read_argv(1Arg123)
    
read_argv(2Arg23)
          new 
player Xp
          
if (!player)
          {
               
console_print(id"Sorry, player %s could not be found or targetted!"Arg1)
          } else {
               
PlayerXP[player] += read_argv(2Arg23)
           
console_print(id"Added Xp To Player!")
           while(
PlayerXP[player] >= LEVELS[PlayerLevel[player]])
    {
      
PlayerLevel[player] += 1
      client_print
(idprint_chat"[Avatar Mod] Congratulations! You are a level %i %s!"PlayerLevel[player], CLASSES[PlayerClass[player]]) 
    
set_hudmessage(25500, -1.00.01)
    
show_hudmessage(0"%i Has Leveled UP !!!"get_user_name(playerszName31))
      } 
    
ShowHud(player)
    
SaveData(player)
    }

__________________

maakera is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 05-16-2010 , 16:21   Re: The Xp isnt added :S
Reply With Quote #2

Code:
public cmd_xp(id, level, cid) {     if(!cmd_access(id, level, cid, 3))         return PLUGIN_HANDLED         new Arg1[33] // maximum size of a name is 32 chars     new Arg2[4]     new Xp;         //Get the command arguments from the console     read_argv(1, Arg1, 32)     read_argv(2, Arg2, 3)         Xp = str_to_num(Arg2)     new player = cmd_target(id, Arg1/*, CMDTARGET_OBEY_IMMUNITY*/)     if(!player)     {         console_print(id, "Sorry, player %s could not be found or targetted!", Arg1)     }     else     {         PlayerXP[player] += Xp         console_print(id, "Added %i Xp To Player!", Xp)         while(PlayerXP[player] >= LEVELS[PlayerLevel[player]])         {             PlayerLevel[player] += 1             client_print(id, print_chat, "[Avatar Mod] Congratulations! You are a level %i %s!", PlayerLevel[player], CLASSES[PlayerClass[player]])               set_hudmessage(255, 0, 0, -1.0, 0.01)             show_hudmessage(0, "%i Has Leveled UP !!!", get_user_name(player, szName, 31))         }           ShowHud(player)         SaveData(player)     } }

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

funcwiki is your friend.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!

Last edited by Xellath; 05-16-2010 at 16:22. Reason: sixe -> size @_@
Xellath is offline
Reply


Thread Tools
Display Modes

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 03:44.


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