Raised This Month: $ Target: $400
 0% 

make xp start all over


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Nican
Veteran Member
Join Date: Jan 2006
Location: NY
Old 04-09-2007 , 02:36   Re: make xp start all over
Reply With Quote #2

i think this should work

please give karma
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <vault>
#define HUD_INTERVAL 1.0
#define CLASS_NOTHING 0
#define CLASS_DOG 1
#define CLASS_CAT 2
#define CLASS_HORSE 3
#define CLASS_COW 4
#define MAXCLASSES 5

new playerdata[33][9]

new 
PlayerClass[33]
new 
PlayerXP[33]
new 
PlayerLevel[33]

new const 
CLASSES[MAXCLASSES][] = {
    
"None",
    
"Dog",
    
"Cat",
    
"Horse",
    
"Cow"
}
new 
msgtext
new const LEVELS[6] = {
    
100
    
200
    
400
    
800,
    
1600,
    
3200
}
public 
client_putinserver(id)

    
set_task(HUD_INTERVAL"ShowHUD"id)
    return 
PLUGIN_HANDLED
}
public 
plugin_init()
{
    
register_plugin("Animal Mod""1.0""XunTric")
    
    
register_cvar("sv_animalmod""1")
    
    
register_event("DeathMsg""DeathMsg""a"
    
    
register_cvar("XP_per_kill""20")
    
    
register_menucmd(register_menuid("menu_ChooseAnimal"),1023,"DoChooseAnimal"); 
    
    
register_event("ResetHUD""ResetHud""b")
    
    
msgtext get_user_msgid("StatusText"
    
register_clcmd"say /menu","ChooseAnimal", -1"Shows The menu" )
}

public 
loadnewxp(id,class){
    switch(
PlayerClass[id]){
        case 
1:{
            
playerdata[id][1] = PlayerLevel[id]
            
playerdata[id][2] = PlayerXP[id]                
        }
        case 
2:{
            
playerdata[id][3] = PlayerLevel[id]
            
playerdata[id][4] = PlayerXP[id]
        }
        case 
3:{
            
playerdata[id][5] = PlayerLevel[id]
            
playerdata[id][6] = PlayerXP[id]
            
        }
        case 
4:{
            
playerdata[id][7] = PlayerLevel[id]
            
playerdata[id][8] = PlayerXP[id]                
        }            
    }
    
    
    
PlayerClass[id] = class
    switch(class){
        case 
1:{
            
PlayerLevel[id] = playerdata[id][1]
            
PlayerXP[id] = playerdata[id][2]                            
        }
        case 
2:{
            
PlayerLevel[id] = playerdata[id][3]
            
PlayerXP[id] = playerdata[id][4]
        }
        case 
3:{
            
PlayerLevel[id] = playerdata[id][5]
            
PlayerXP[id] = playerdata[id][6]
        }
        case 
4:{
            
PlayerLevel[id] = playerdata[id][7]
            
PlayerXP[id] = playerdata[id][8]                
        }            
    }
}
 
 
public 
SaveXP(id)
{
    new 
authid[32],message[128],pos;  
    
get_user_authid(id,authid,31); 
    
    for(new 
i=0;i<=8;i++)
    
pos += format(message[pos],256 pos,"%i "playerdata[i])
    
trim(message)    
    
set_vaultdata(authid,message);


public 
LoadXP(id)
{
    new 
authid[32] ,vaultdata[128],playerinfo[9][32]; 
    
    
get_user_authid(id,authid,31);   
    
get_vaultdata(authid,vaultdata,63); 
    
    
parse(vaultdataplayerinfo[0], 31,playerinfo[1], 31playerinfo[2], 31playerinfo[3], 31,playerinfo[4], 31,playerinfo[5], 31,playerinfo[6], 31,playerinfo[7], 31,playerinfo[8], 31)    
                    
    for(new 
i=0;i<=8;i++)
    
playerdata[id][i] = str_to_num(playerinfo[i]) 

public 
client_authorized(id)
{
    if(
get_cvar_num("SaveXP") == 1) {
       
         
LoadXP(id)
         
client_print(idprint_chat"[Animal Mod] XP Loaded!")
         
client_print(idprint_chat"[Animal Mod] You are a %s with level %s and %s XP"PlayerClass[id], PlayerLevel[id], PlayerXP[id])
    }
}
public 
client_disconnect(id)
{
    if(
get_cvar_num("SaveXP") == 1) {
    
         
SaveXP(id)
    }
}
public 
ChooseAnimal(id)
{
   new 
szMenuBody[256]
   new 
keys
   
new nLen formatszMenuBody255"\yChoose Animal:^n" )
   
nLen += formatszMenuBody[nLen], 255-nLen"^n\w1. dog" )
   
nLen += formatszMenuBody[nLen], 255-nLen"^n\w2. cat" )
   
nLen += formatszMenuBody[nLen], 255-nLen"^n\w3. Horse" )
   
nLen += formatszMenuBody[nLen], 255-nLen"^n\w4. Cow" )
   
nLen += formatszMenuBody[nLen], 255-nLen"^n^n\w0. Exit" )
   
keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<9)
   
show_menuidkeysszMenuBody, -"menu_ChooseAnimal")
   return 
PLUGIN_CONTINUE
}
public 
DoChooseAnimal(idkey)
{
 switch( 
key )
   {
    case 
0: {
    if(
PlayerClass[id] == CLASS_DOG) {
        
client_print(idprint_chat"[Animal Mod] You are allready a Dog! Choose something else!")
        
ChooseAnimal(id)           
        return 
PLUGIN_HANDLED
    
}    
        
    
loadnewxp(id,CLASS_DOG)       
    
client_print(idprint_chat"[Animal Mod] You are now a Dog!")
    }        
         
    case 
1: {
         
    if(
PlayerClass[id] == CLASS_CAT) {
              
        
client_print(idprint_chat"[Animal Mod] You are allready a Cat! Choose something else!")
        
ChooseAnimal(id)
        return 
PLUGIN_HANDLED
    
}
               
    
loadnewxp(id,CLASS_CAT)
    
client_print(idprint_chat"[Animal Mod] You are now a Cat!")
    }
    
    case 
3: {
         
    if(
PlayerClass[id] == CLASS_HORSE) {
              
              
client_print(idprint_chat"[Animal Mod] You are allready a Horse! Choose something else!")
              
ChooseAnimal(id)
              return 
PLUGIN_HANDLED
    
}
                
    
loadnewxp(id,CLASS_HORSE)
    
client_print(idprint_chat"[Animal Mod] You are now a Horse!")
    }    
    case 
4: {
         
    if(
PlayerClass[id] == CLASS_COW) {
              
              
client_print(idprint_chat"[Animal Mod] You are allready a Cow! Choose something else!")
              
ChooseAnimal(id)
              return 
PLUGIN_HANDLED
    
}
                   
    
loadnewxp(id,CLASS_COW)
    
client_print(idprint_chat"[Animal Mod] You are now a Cow!")
    }
 }
 
ShowHUD(id)
    
 return 
PLUGIN_HANDLED
}
public 
ResetHud(id)
{
    if(
PlayerClass[id] == CLASS_NOTHING) {
    
         
ChooseAnimal(id)
         return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_HANDLED
}
public 
DeathMsg()
{
    if(
get_cvar_num("sv_animalmod") == 0) {
         return 
PLUGIN_HANDLED
    
}
    
    new 
attacker read_data(1)
    
    if(
PlayerClass[attacker] == CLASS_NOTHING) {
         return 
PLUGIN_HANDLED
    
}
    
    if(
PlayerLevel[attacker] == 6) {
         return 
PLUGIN_HANDLED
    
}
            
    
PlayerXP[attacker] += get_cvar_num("XP_per_kill"
    
    if(
PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]]) {
     
         
PlayerLevel[attacker] += 1
         
         client_print
(attackerprint_chat"[Animal Mod] Congratulations! You are now level %i!"PlayerLevel[attacker])
         if(
get_cvar_num("SaveXP") == 1) {
 
              
SaveXP(attacker)
         }
         
         
ShowHUD(attacker)
    }   
    
    
ShowHUD(attacker)
    
    return 
PLUGIN_CONTINUE
}
public 
ShowHUD(id)    

    new 
HUD[51]
    
format(HUD50"[%s]Level: %i XP: %i"CLASSES[PlayerClass[id]], PlayerLevel[id], PlayerXP[id]) 
    
message_begin(MSG_ONEmsgtext, {0,0,0}, id
    
write_byte(0
    
write_string(HUD
    
    
message_end() 
    
set_task(HUD_INTERVAL"ShowHUD"id)
    return
    

i cant wait till' i see the rest of this plugin
__________________
http://www.nican132.com
I require reputation!

Last edited by Nican; 04-09-2007 at 02:42.
Nican is offline
Send a message via ICQ to Nican Send a message via MSN to Nican
 



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 06:35.


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