Raised This Month: $51 Target: $400
 12% 

Give xp to someone!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Spy123
BANNED
Join Date: Jul 2011
Location: Giurgiu / Romania
Old 05-22-2012 , 10:03   Give xp to someone!
Reply With Quote #1

I want to know if is possible to edit the sj.sma and make a command in chat to give someone your xp.For example: Me (Spy) i want to give John 50 xp..I type in chat: /givexp john 50 ,and if i don't have 50 xp, print me in chat: "You don't have enough xp, to donate!"

This is what I found:

PHP Code:
#include <amxmisc>

register_concmd("amx_givexp""concmd_GiveXP"ADMIN_LEVEL_A"<nick, #userid, authid> <xp to give>");

public 
concmd_GiveXP(idlevelcid)
{
    if(!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED;
    
    new 
arg[35];
    
read_argv(1arg34);
    new 
player cmd_target(idarg3);
    if(!
player)
        return 
PLUGIN_HANDLED;
    
    
read_argv(2arg15);
    new 
xp str_to_num(arg);
    if(
xp g_Experience[player])
        
xp g_Experience[player];
    
    
g_Experience[player] += xp;
    
    new 
nameA[32], nameP[32];
    
get_user_name(idnameA31);
    
get_user_name(playernameP31);
    
client_print(0print_chat"ADMIN %s: gave %d XP to %s!"nameAxpnameP);
    
    new 
authidA[32], authidP[32];
    
get_user_authid(idauthidA31);
    
get_user_authid(idauthidP31);
    
log_amx("%s <%s> gave %d XP to %s <%s>"nameAauthidAxpnamePauthidP);
    return 
PLUGIN_HANDLED;

But I don;t want 4 admins, i want for all people who play. Can someone edit this 4 me? I tried but...nothing.

Sry 4 my bad english (I'm from Romania)!

P.S: Here I hound that code: http://forums.alliedmods.net/showthread.php?t=67162

And here it's the .sma:
Attached Files
File Type: sma Get Plugin or Get Source (soccerjam.sma - 774 views - 97.6 KB)

Last edited by Spy123; 05-09-2013 at 15:43. Reason: Wrong .sma
Spy123 is offline
doondook
Member
Join Date: Dec 2010
Old 06-18-2012 , 16:54   Re: Give xp to someone in Soccerjam!
Reply With Quote #2

Register in plugin_init():
PHP Code:
register_concmd("sj_exp""GiveXP"_,  "<userid , nickname> <exp>"
Put somewhere:
PHP Code:
public GiveXP(idlevelcid){
    if(!
cmd_access(idlevelcid3)){
        return 
PLUGIN_HANDLED
    
}
        
    new 
sz_nick[32], sz_xp[12]
    
    
read_argv(1sz_nick,     charsmax(sz_nick))
    
read_argv(2sz_xp,     charsmax(sz_xp))
    
    new 
sz_player cmd_target(idsz_nick8)
    
    new 
sz_name[32]
    
get_user_name(idsz_name31)
    
    if(
sz_player){
        new 
sz_bname[32]
        
get_user_name(sz_playersz_bname31)
        
g_Experience[sz_player] += str_to_num(sz_xp// or add whatever you want
        
        
client_print(0print_chat"%s has added %s exp. to %s"sz_namesz_xpsz_bname
        
console_print(id"%s exp. has been added to %s"sz_xpsz_bname)
    }
    else
        
console_print(id"Invalid player!")
        
    return 
PLUGIN_HANDLED    


Last edited by doondook; 06-19-2012 at 00:05.
doondook is offline
Spy123
BANNED
Join Date: Jul 2011
Location: Giurgiu / Romania
Old 06-19-2012 , 04:32   Re: Give xp to someone in Soccerjam!
Reply With Quote #3

Thanx again doondook!!! God bless you!!!!!!

Edit: Oh, i tried this code but there are few problems..

1.The players can donate xp but more then they have.
2.To donate you must type in console,but i wan't in chat

Last edited by Spy123; 05-09-2013 at 15:44. Reason: Few problems with the code.
Spy123 is offline
Old 06-11-2014, 14:15
TheAutomatiK
This message has been deleted by YamiKaitou. Reason: comment serves no point but to spam
Old 06-11-2014, 14:28
joshknifer
This message has been deleted by YamiKaitou. Reason: reply to deleted post
Reply



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 09:01.


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