This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

title xp


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lashsh
BANNED
Join Date: Jun 2010
Location: Georgia, Tbilisi
Old 08-22-2010 , 16:22   title xp
Reply With Quote #1

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

#define MAXCLASSES 5

new PlayerXP 33 ], PlayerLevel 33 ], PlayerClass 33 
//these are for special kills 
new XP_Kill XP_Knife XP_Hs SaveXP 
//this is for Nvault. so that We can save XP 
new g_vault

new const CLASSES MAXCLASSES ][] = { 
"None" 
"Dog" 
"Cat" 
"Horse" 
"Admin" 
}

new const 
LEVELS ] = { 

100 //this means you need 100 xp 
200 //this means you need 200 xp 
400 //this means you need 400 xp 
800 //so on 
1600 //so on 
3200 //so on 
}

public 
plugin_init () 

register_plugin "XpLif" "0.1" "LifIgor" 

//we need this to check your level after you kill some one 
register_event "DeathMsg" "eDeath" "a" 
//is saving on? 
SaveXP register_cvar "SaveXP" "1" 
//how many xp are u gonna get per kill? 
XP_Kill register_cvar "XP_per_kill" "3" 
//if you get a hs you get bonus xp 
XP_Hs register_cvar "XP_hs_bonus" "7" 
//if you make a knife kill you get bounus xp 
XP_Knife register_cvar "XP_knife_bonus" "8" 
//we just opened a new connection NVAULT connection 
// we will call it animod 
g_vault nvault_open "animod" 
// register a say command to change class 
register_clcmd "say /class" "ChangeClass" 
register_clcmd "say_team /class" "ChangeClass" 
//show how much xp you have 
register_clcmd "say /xp" "ShowHud" 
register_clcmd "say_team /xp" "ShowHud" 
}

public 
eDeath id 

new 
headshot read_data 
new 
attacker read_data 
new 
clip ammo weapon get_user_weapon id clip ammo ); 

PlayerXP attacker ] += get_pcvar_num XP_Kill 

if( 
headshot 
PlayerXP attacker ] += get_pcvar_num XP_Hs 

if( 
weapon == CSW_KNIFE 
PlayerXP attacker ] += get_pcvar_num XP_Knife 


while( 
PlayerXP attacker ] >= LEVELS PlayerLevel attacker ]]) 

PlayerLevel attacker ] += 
client_print 
attacker print_chat "[LifMod] Congratulations! You are a level %i %s!" PlayerLevel attacker ], CLASSES PlayerClass attacker ]]) 

ShowHud attacker 
SaveData attacker 
}


public 
ShowHud id 

set_hudmessage 255 0.75 0.01 6.0 15.0 
show_hudmessage id "Level: %i^nXP: %i^nClass: %s" PlayerLevel id ], PlayerXP id ], CLASSES PlayerClass id ]]) 
}

public 
ChangeClass id 

new 
menu menu_create "Class Menu" "Class_Handle" ); 
menu_additem menu "Dog" "1" ); 
menu_additem menu "Cat" "2" ); 
menu_additem menu "Horse" "3" ); 
menu_additem menu "Admin" "4" ); 

menu_setprop menu MPROP_EXIT MEXIT_ALL ); 

menu_display id menu ); 

return 
PLUGIN_CONTINUE 
}

public 
Class_Handle id menu item 

if( 
item == MENU_EXIT 


menu_destroy menu ); 



new 
szCommand ] , szName 64 ]; 
new 
access callback 

menu_item_getinfo menu item access szCommand szName 63 callback ); 

new 
str_to_num szCommand 
if( 
PlayerClass id ] != 

PlayerClass id ] = 
client_print 
id print_chat "You are now a %s" CLASSES ]) 

else 

client_print id print_chat "You are alredy a %s" CLASSES ]) 


menu_destroy menu ); 
return 
PLUGIN_CONTINUE 
}

public 
client_connect id 

// Only does it if xp saving is on 
if( get_pcvar_num SaveXP ) == 

// load your player data 
LoadData id 

}

public 
client_disconnect id 

// Only does it if xp saving is on 
if( get_pcvar_num SaveXP ) == 

// lets save the data 
SaveData id 

}

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#" PlayerXP id ], PlayerLevel id ]) 
nvault_set g_vault 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#" PlayerXP id ], PlayerLevel id ]) 
nvault_get g_vault vaultkey vaultdata 255 

replace_all vaultdata 255 "#" " " 

new 
playerxp 32 ], playerlevel 32 

parse vaultdata playerxp 31 playerlevel 31 

PlayerXP id ] = str_to_num playerxp 
PlayerLevel id ] = str_to_num playerlevel 

return 
PLUGIN_CONTINUE 

how delete from this plugin class , menu and add on XP title e.g 1 kill 10 XP, and 800 XP title serious player

Last edited by lashsh; 08-22-2010 at 17:42.
lashsh is offline
Send a message via Skype™ to lashsh
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 08-22-2010 , 16:41   Re: title xp
Reply With Quote #2

Comment those two lines
PHP Code:
register_clcmd "say /class" "ChangeClass" )  
register_clcmd "say_team /class" "ChangeClass" 
The rest of code will still be there- but it will be never used.
__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.
naven is offline
lashsh
BANNED
Join Date: Jun 2010
Location: Georgia, Tbilisi
Old 08-22-2010 , 17:42   Re: title xp
Reply With Quote #3

That?
PHP Code:
#include <amxmodx>  
#include <amxmisc>  
#include <nvault> 

#define MAXCLASSES 5 

new PlayerXP 33 ], PlayerLevel 33 ], PlayerClass 33 ]  
//these are for special kills  
new XP_Kill XP_Knife XP_Hs SaveXP  
//this is for Nvault. so that We can save XP  
new g_vault 

new const CLASSES MAXCLASSES ][] = {  
"None" ,  
"Dog" ,  
"Cat" ,  
"Horse" ,  
"Admin"  


new const 
LEVELS ] = {  
,  
100 //this means you need 100 xp  
200 //this means you need 200 xp  
400 //this means you need 400 xp  
800 //so on  
1600 //so on  
3200 //so on  


public 
plugin_init ()  
{  
register_plugin "XpLif" "0.1" "LifIgor" )  

//we need this to check your level after you kill some one  
register_event "DeathMsg" "eDeath" "a" )  
//is saving on?  
SaveXP register_cvar "SaveXP" "1" )  
//how many xp are u gonna get per kill?  
XP_Kill register_cvar "XP_per_kill" "3" )  
//if you get a hs you get bonus xp  
XP_Hs register_cvar "XP_hs_bonus" "7" )  
//if you make a knife kill you get bounus xp  
XP_Knife register_cvar "XP_knife_bonus" "8" )  
//we just opened a new connection NVAULT connection  
// we will call it animod  
g_vault nvault_open "animod" )  
// register a say command to change class 
//show how much xp you have  
register_clcmd "say /xp" "ShowHud" )  
register_clcmd "say_team /xp" "ShowHud" )  


public 
eDeath id )  
{  
new 
headshot read_data )  
new 
attacker read_data )  
new 
clip ammo weapon get_user_weapon id clip ammo );  

PlayerXP attacker ] += get_pcvar_num XP_Kill )  

if( 
headshot )  
PlayerXP attacker ] += get_pcvar_num XP_Hs )  

if( 
weapon == CSW_KNIFE )  
PlayerXP attacker ] += get_pcvar_num XP_Knife )  


while( 
PlayerXP attacker ] >= LEVELS PlayerLevel attacker ]])  
{  
PlayerLevel attacker ] += 1  
client_print 
attacker print_chat "[LifMod] Congratulations! You are a level %i %s!" PlayerLevel attacker ], CLASSES PlayerClass attacker ]])  
}  
ShowHud attacker )  
SaveData attacker )  



public 
ShowHud id )  
{  
set_hudmessage 255 0.75 0.01 6.0 15.0 )  
show_hudmessage id "Level: %i^nXP: %i^nClass: %s" PlayerLevel id ], PlayerXP id ], CLASSES PlayerClass id ]])  


public 
client_connect id )  
{  
// Only does it if xp saving is on  
if( get_pcvar_num SaveXP ) == )  
{  
// load your player data  
LoadData id )  
}  


public 
client_disconnect id )  
{  
// Only does it if xp saving is on  
if( get_pcvar_num SaveXP ) == )  
{  
// lets save the data  
SaveData id )  
}  


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#" PlayerXP id ], PlayerLevel id ])  
nvault_set g_vault 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#" PlayerXP id ], PlayerLevel id ])  
nvault_get g_vault vaultkey vaultdata 255 )  

replace_all vaultdata 255 "#" " " )  

new 
playerxp 32 ], playerlevel 32 ]  

parse vaultdata playerxp 31 playerlevel 31 )  

PlayerXP id ] = str_to_num playerxp )  
PlayerLevel id ] = str_to_num playerlevel )  

return 
PLUGIN_CONTINUE  

lashsh is offline
Send a message via Skype™ to lashsh
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 08-22-2010 , 18:12   Re: title xp
Reply With Quote #4

Yes. It is recommended that you use comments, then you can always restore old code if something goes wrong.
__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.
naven 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 23:34.


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