Raised This Month: $ Target: $400
 0% 

Add some cmds to XP plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
preetham
Member
Join Date: Sep 2012
Location: India
Old 03-01-2014 , 03:31   Add some cmds to XP plugin
Reply With Quote #1

Somebody add the following commads to the plugin.. BIG THANKS IN ADVANCE __/\__

/topxp - list of top 15 players who have xp in large number...[in motd *ofcourse]

/nextlevel - Display the next level and the required xp to reach that level.
With colors.[colorchat include is already in the code], something like this.
[<szPrefix>] Next Level is %s, Required xp %s
Here:- szPrefix in Green, first %s and second %s in green and rest letters in white.

/levels - Display all the levels that are available and the number of xp required to reach that
level

/xprank - Display their rank according to xp they have.(skip this if not possible)

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>  
#include <colorchat>
#include <cstrike>

new Level[33], eXP[33]
new 
KillXpHsXpHeXpKnifeXp
new gVault

new const szPrefix[] = "[^4XP-ALERT^3] -"

#define MaxLevels 9
new const Levels[MaxLevels] = 
{
    
100// Noob Nigga
    
120// Casual
    
250// Junior
    
400// Senior Sir
    
420,  // Strategist
    
500// Gang Leader
    
700// Global Assasin
    
999// Hardcore Player
    
1111 // Professional
}
new const 
Prefix[MaxLevels +2][] =
{
    
"Newbie"// 0
    
"Noob Nigga"// 15
    
"Casual",  // 40
    
"Junior"// 75
    
"Senior Sir"// 130
    
"Strategist",  // 200
    
"Gang Leader"// 300
    
"Global Assasin"// 450
    
"Hardcore Player"// 650
    
"Professional"// 1000
    
""
}

public 
plugin_init() {
    
register_plugin("XP-Mod""1.0""preetham")
    
    
register_event("DeathMsg""eDeath""a")
    
    
register_clcmd("say""handle_say")
    
register_clcmd("say_team""handle_team_say")
    
    
KillXp    register_cvar("xm_xp_pr_kill""3")
    
HsXp    register_cvar("xm_xp_pr_hs""5")
    
HeXp    register_cvar("xm_xp_pr_nade""7")
    
KnifeXp    register_cvar("xm_xp_pr_knife""10")
    
    
gVault nvault_open("XMoD")
}
public 
handle_say(id)
{
    new 
chat[192], none[2][32], message[192], name[192]
    
read_argv(1chatsizeof(chat) -1)
    
formatex(none[0], sizeof(none) -1""), formatex(none[1], sizeof(none) -1" ")
    
    if(!
equali(chatnone[0]) && !equali(chatnone[1]))
    {
        
get_user_name(idnamesizeof(name) -1)
        if(!
is_user_alive(id))
        {
            
formatex(messagesizeof(message) -1"^4[%s]^1 *DEAD*^3 %s : ^1%s"Prefix[Level[id]], namechat)
        }
        else
        {
            
formatex(messagesizeof(message) -1"^4[%s]^3 %s ^1 : %s"Prefix[Level[id]], name chat)
        }
        if(
equali(chat"/xp"))
        {
            
ColorChat(idGREY"%s You have ^4%d^3 XP and you're on a level ^4%s^3."szPrefixeXP[id], Prefix[Level[id]])
            
ShowHud(id)
            return 
PLUGIN_HANDLED
        
}
        switch(
cs_get_user_team(id))
        {
            case 
CS_TEAM_CTColorChat(0BLUEmessage)
            case 
CS_TEAM_TColorChat(0REDmessage)
        }
        return 
PLUGIN_HANDLED_MAIN
    
}
    return 
PLUGIN_CONTINUE    
}
public 
handle_team_say(id)
{
    new 
chat[192], none[2][32], message[192], message2[192], name[192]
    
read_argv(1chatsizeof(chat) -1)
    
formatex(none[0], sizeof(none) -1""), formatex(none[1], sizeof(none) -1" ")
    
    if(!
equali(chatnone[0]) && !equali(chatnone[1]))
    {
        
get_user_name(idnamesizeof(name) -1)
        switch(
cs_get_user_team(id))
        {
            case 
CS_TEAM_CT: {
                if(!
is_user_alive(id))
                    
formatex(messagesizeof(message) -1"^4[%s]^1 (Counter-Terrorists) *DEAD*^3 %s : ^1%s"Prefix[Level[id]], namechat)
                else
                    
formatex(messagesizeof(message) -1"^4[%s]^1 (Counter-Terrorists)^3 %s : ^1%s"Prefix[Level[id]], namechat)
                new 
iPlayers[32], iNumiPid
                get_players
(iPlayersiNum)
                for(new 
iiNumi++)
                {
                    
iPid iPlayers[i]
                    if(
cs_get_user_team(iPid) != CS_TEAM_CT)
                        continue;
                    
                    
ColorChat(iPidBLUEmessage)
                }
            }
            case 
CS_TEAM_T: {
                if(!
is_user_alive(id))
                    
formatex(message2sizeof(message2) -1"^4[%s]^1 (Terrorists) *DEAD*^3 %s : ^1%s"Prefix[Level[id]], namechat)
                else 
                    
formatex(message2sizeof(message2) -1"^4[%s]^1 (Terrorists)^3 %s : ^1%s"Prefix[Level[id]], namechat)
                new 
iPlayers[32], iNumiPid
                get_players
(iPlayersiNum)
                for(new 
iiiNumi++)
                {
                    
iPid iPlayers[i]
                    if(
cs_get_user_team(iPid) != CS_TEAM_T)
                        continue
                    
                    
ColorChat(iPidREDmessage2)
                }
            }
        }
        return 
PLUGIN_HANDLED_MAIN
    
}
    return 
PLUGIN_CONTINUE    
}
public 
plugin_end()
{
    
nvault_close(gVault)
}
public 
client_putinserver(id)
{
    
LoadData(id)
    
set_task(3.0"ShowHud"id__"b")
    
set_task(5.0"WM"id)
}
public 
WM(id)
{
    if(
Level[id] == 9)
    {
        new 
name[32]
        
get_user_name(idnamesizeof(name) -1)
        
        new 
szText[555 char]
        
        
formatex(szTextsizeof(szText) -1"Professional : %s has joined with %i XP!"nameeXP[id])
        
        new 
iPlayers[32], iNumiPid
        get_players
(iPlayersiNum)
        for(new 
iiNumi++)
        {
            
iPid iPlayers[i]
            
set_hudmessage(25500, -1.00.2706.05.00.10.23)
            
show_hudmessage(iPidszText)
        }
    }
}
public 
client_disconnect(id)
{
    
SaveData(id)
    
set_task(1.0"LM"id)
}
public 
LM(id)
{
    if(
Level[id] == 9)
    {
        new 
name[32]
        
get_user_name(idnamesizeof(name) -1)
        
        new 
szText[555 char]
        
        
formatex(szTextsizeof(szText) -1"Professional : %s has left with %i XP!"nameeXP[id])
        
        new 
iPlayers[32], iNumiPid
        get_players
(iPlayersiNum)
        for(new 
iiNumi++)
        {
            
iPid iPlayers[i]
            
set_hudmessage(25500, -1.00.2706.05.00.10.23)
            
show_hudmessage(iPidszText)
        }
    }
}
public 
eDeath( )
{
    new 
iKiller read_data(1)
    
    new 
iVictim read_data(2)
    
    new 
Headshot read_data(3)
    
    new 
weapon[32]
    
read_data(4weaponsizeof(weapon) -1)
    if(
iKiller == iVictim)
    {
        return 
PLUGIN_HANDLED
    
}
    new 
name[32]
    
    
get_user_name(iVictimnamesizeof(name) -1)
    
    if(
Headshot)
    {
        
eXP[iKiller] += get_pcvar_num(HsXp)
        
set_hudmessage(2550255, -1.0, -1.105.05.0__2)
        
show_hudmessage(iKiller"+ %i XP"get_pcvar_num(HsXp) + get_pcvar_num(KillXp))
    }
    else if(
equali(weapon"knife"))
    {
        
eXP[iKiller] += get_pcvar_num(KnifeXp)
        
set_hudmessage(0255255, -1.0, -1.105.05.0__2)
        
show_hudmessage(iKiller"+ %i XP"get_pcvar_num(KnifeXp) + get_pcvar_num(KillXp))
    }
    else if(
equali(weapon"grenade"))
    {
        
eXP[iKiller] += get_pcvar_num(HeXp)
        
set_hudmessage(128096, -1.0, -1.105.05.0__2)
        
show_hudmessage(iKiller"+ %i XP"get_pcvar_num(HeXp) + get_pcvar_num(KillXp))
    }
    else
    {
        
set_hudmessage(1281920, -1.0, -1.105.05.0__2)
        
show_hudmessage(iKiller"+ %i XP"get_pcvar_num(KillXp))
    }
    
eXP[iKiller] += get_pcvar_num(KillXp)
    if(
Level[iKiller] == 9)
    {
        
ShowHud(iKiller)
        return 
PLUGIN_HANDLED
    
}
    while(
eXP[iKiller] >= Levels[Level[iKiller]]) 
    { 
        
ColorChat(iKillerGREY"%s You just Leveled Up! ^4%s^3, with ^4%i^3 XP."szPrefixPrefix[Level[iKiller]], eXP[iKiller])
        
Level[iKiller]++
    } 
    
ShowHud(iKiller)
    
SaveData(iKiller)
    return 
PLUGIN_HANDLED
}
public 
ShowHud(id)
{
    new 
szText[555 char]
    if(
Level[id] == 9)
    {
        
formatex(szTextsizeof(szText) -1"[Level : %s]^n[XP : %i]"Prefix[Level[id]], eXP[id])
    }
    else
    {
        
formatex(szTextsizeof(szText) -1"[Level : %s]^n[XP : %i]"Prefix[Level[id]], eXP[id])
    }
    
set_hudmessage(22422400.010.6005.05.05.0_1)
    
show_hudmessage(idszText)
}

public 
SaveData(id

    new 
AuthID[35]
    
get_user_authid(id,AuthID,34
    new 
vaultkey[64],vaultdata[256
    
    
format(vaultkey,63,"%s-Mod",AuthID
    
format(vaultdata,255,"%i#%i#",eXP[id],Level[id]) 
    
    
nvault_set(gVault,vaultkey,vaultdata
    
    return 
PLUGIN_CONTINUE 

public 
LoadData(id

    new 
AuthID[35]
    
get_user_authid(id,AuthID,34
    new 
vaultkey[64],vaultdata[256
    
    
format(vaultkey,63,"%s-Mod",AuthID
    
format(vaultdata,255,"%i#%i#",eXP[id],Level[id]) 
    
    
nvault_get(gVault,vaultkey,vaultdata,255
    
    
replace_all(vaultdata255"#"" "
    
    new 
playerxp[32], playerlevel[32
    
    
parse(vaultdataplayerxp31playerlevel31
    
    
eXP[id] = str_to_num(playerxp
    
    
Level[id] = str_to_num(playerlevel
    
    return 
PLUGIN_CONTINUE 

__________________

Last edited by YamiKaitou; 03-24-2014 at 09:43. Reason: removed annoying text block and correcting title
preetham is offline
Old 03-01-2014, 05:33
preetham
This message has been deleted by YamiKaitou. Reason: Wait 14 days before you bump
Old 03-02-2014, 20:40
preetham
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
Old 03-02-2014, 22:27
preetham
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 03-03-2014 , 00:47   Re: Add some cmds to XP plugin
Reply With Quote #2

are you the real author of this plugin?
__________________
Blizzard_87 is offline
preetham
Member
Join Date: Sep 2012
Location: India
Old 03-03-2014 , 01:04   Re: Add some cmds to XP plugin
Reply With Quote #3

Nope im not... actually my cousin gave me the code 1 week ago... he told me that he found this code on internet somewhere..
__________________
preetham is offline
Old 03-03-2014, 01:51
preetham
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 03-03-2014 , 04:34   Re: Add some cmds to XP plugin
Reply With Quote #4

My reason for asking because if you did make it you'd be able to add these features.
__________________
Blizzard_87 is offline
preetham
Member
Join Date: Sep 2012
Location: India
Old 03-03-2014 , 05:24   Re: Add some cmds to XP plugin
Reply With Quote #5

Yes i know but fortunately im beginner in scripting so i need help of alliedmods
preetham is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 03-03-2014 , 05:59   Re: Add some cmds to XP plugin
Reply With Quote #6

since you want to learn... try this..

add this code snippet into your handle_say right under the FIRST formatex native
Code:
    if( equali(chat, "/nextlvl" ) )     {         ColorChat( id, GREY, "^3%s Next Level is ^4%s^3, Required xp ^4%i", szPrefix, Prefix[ Level[id]+1], Levels[ Level[id]+1] );         return PLUGIN_HANDLED     }
Example:

then test it.. tell me if it works.
__________________

Last edited by Blizzard_87; 03-03-2014 at 06:00.
Blizzard_87 is offline
Old 03-03-2014, 06:06
preetham
This message has been deleted by preetham.
Old 03-03-2014, 06:14
preetham
This message has been deleted by preetham.
preetham
Member
Join Date: Sep 2012
Location: India
Old 03-03-2014 , 06:16   Re: Add some cmds to XP plugin
Reply With Quote #7

Works perfectly ty and please give the other 3 commad's code i request you
[IMG]http://s26.************/xjf1ozgjd/de_nuke0005.jpg[/IMG]

Last edited by preetham; 03-03-2014 at 06:17.
preetham is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 03-03-2014 , 06:30   Re: Add some cmds to XP plugin
Reply With Quote #8

Quote:
Originally Posted by preetham View Post
Works perfectly ty and please give the other 3 commad's code i request you
you requested for anyone to help... im now too busy to do the rest... hope someone else helps you.
__________________
Blizzard_87 is offline
preetham
Member
Join Date: Sep 2012
Location: India
Old 03-03-2014 , 06:32   Re: Add some cmds to XP plugin
Reply With Quote #9

Quote:
Originally Posted by Blizzard_87 View Post
hope someone else helps you.
Yes me too
preetham is offline
Old 03-03-2014, 08:12
preetham
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
Old 03-03-2014, 10:05
Mordekay
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
Old 03-03-2014, 10:31
preetham
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
Old 03-06-2014, 00:10
preetham
This message has been deleted by preetham.
Old 03-06-2014, 03:09
Blizzard_87
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
Old 03-06-2014, 04:11
preetham
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
Old 03-13-2014, 21:30
preetham
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump (you only waited 10)
preetham
Member
Join Date: Sep 2012
Location: India
Old 03-17-2014 , 22:52   Re: Add some cmds to XP plugin
Reply With Quote #10

Thread started 18 days ago... no HELP till now :\
__________________

Last edited by preetham; 03-18-2014 at 22:04. Reason: image not needed
preetham is offline
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 02:47.


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