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

[Arreglo]XP MoD


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
TheShootSpeed
Member
Join Date: Nov 2011
Old 01-04-2012 , 10:46   Re: [Arreglo]XP MoD
#11

Quote:
Originally Posted by Korxu View Post
Da error porque la variable creada en la función es 'index', no 'id'. Simplemente cámbialo.
Korxu tu me podrias meter bien eso aqui?
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <cstrike>
#include <colorchat>
#include <engine>
#include <hamsandwich>
#include <fun>
#include <fakemeta>



#define PLUGIN    "lalalla"
#define AUTHOR    "DarkGL"
#define VERSION    "0.1"

new player_xp[33];
new 
player_xp_all[33];
new 
level[33];

new 
rangi[][256]={
    
"Nivel 1",
    
"Nivel 2",
    
"Nivel 3",
    
"Nivel 4",
    
"Nivel 5",
    
"Nivel 6",
    
"Nivel 7",
    
"Nivel 8",
    
"Nivel 9",
    
"Nivel 10",
    
"Nivel 11",
    
"Nivel 12",
    
"Nivel 13",
    
"Nivel 14",
    
"Nivel 15"
}

new 
exp[]={
    
1000,
    
2000,
    
3000,
    
4000,
    
5000,
    
6000,
    
7000,
    
8000,
    
9000,
    
10000,
    
12000,
    
14000,
    
16000,
    
18000,
    
20000,
    
22000,
    
24000,
    
28000,
    
9999999999
}


new 
zapis;


new 
msgtext;

new 
pcvar_exp_round,pcvar_exp_kill_ct,pcvar_exp_kill_tt,pcvar_exp_level,pcvar_exp_hs,pcvar_hud;



public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("Koniec_Rundy"2"1=Round_End")
    
register_concmd("add_exp","addexp",ADMIN_BAN,"dodaje expa nick i ile")
    
register_event("DeathMsg""DeathMsg""a")
    
pcvar_exp_round register_cvar("bb_exp_round","50");
    
pcvar_exp_kill_ct register_cvar("bb_exp_kill_ct","20");
    
pcvar_exp_kill_tt register_cvar("bb_exp_kill_tt","10");
    
pcvar_exp_level register_cvar("bb_exp_level","40");
    
pcvar_exp_hs register_cvar("bb_exp_hs","5");
    
pcvar_hud register_cvar("bb_hud","0");
    
zapis nvault_open("xpd")
    
register_event("ResetHUD","ShowHUD""b");
    
msgtext get_user_msgid("StatusText");
    
register_clcmd("say","sayhandle");
    
    
}

public 
plugin_precache(){
    
precache_sound("darkgl/bb/gained_level.wav");
}

public 
plugin_end(){
    
nvault_close(zapis);
}
public 
sayhandle(id){
    new 
text[192]
    
read_argv(1,text,191)
    if(
equal(text,"")){
        return 
PLUGIN_HANDLED;
    }
    new 
name[128];
    
get_user_name(id,name,127)
    
ColorChat(0,GREEN,"[%s] ^x03%s^x01: %s",rangi[level[id]],name,text)
    return 
PLUGIN_HANDLED;
}





public 
Koniec_Rundy(){
    for(new 
1;i<33;i++){
        if(
is_user_alive(i) && cs_get_user_team(i) == CS_TEAM_CT){
            
DajExp(i,get_pcvar_num(pcvar_exp_round));
            
ColorChat(i,GREEN,"^x03 Ganaste %d por sobrevivir la ronda",get_pcvar_num(pcvar_exp_round));
            
        }
    }
}

public 
addexp(idlevelcid){
    if(!
cmd_access(idlevelcid3)){
        return 
PLUGIN_HANDLED;
    }
    new 
arg1[33];
    new 
arg2[10];
    
read_argv(1,arg1,32);
    
read_argv(2,arg2,9);
    new 
player cmd_target(idarg10);
    
remove_quotes(arg2);
    new 
exp str_to_num(arg2);
    if(
exp != && exp ){
        
OdejmijExp(player,exp);
    }
    else if(
exp != && exp ){
        
DajExp(player,exp);
    }
    return 
PLUGIN_HANDLED;
}

public 
OdejmijExp(id,ile){
    
player_xp[id]-=ile;
    
player_xp_all[id]-=ile;
    
level[id]=0;
    while(
true){
        if(
player_xp_all[id] >= exp[level[id]]){
            
level[id]++;
            
//set_hudmessage(random_num(0,255), random_num(0,255),random_num(0,255), -1.0, -1.0, 0, 6.0, 5.0, 0.0, 0.0, -1)
            //show_hudmessage(id,"Awansowales na kolejny level (%s)",rangi[level[id]]);
            //ColorChat(0,GREEN,"^x03 Awansowal do rangi ^x01 %s gratki :D",rangi[level[id]]);
        
}
        else
        {
            break;
        }
    }
}

public 
DajExp(id,ile){
    
player_xp[id]+=ile;
    
player_xp_all[id]+=ile;
    new 
name[64];
    
get_user_name(id,name,63);
    while(
true){
        if(
player_xp_all[id] >= exp[level[id]] && sizeof(rangi) > level[id]){
            
level[id]++;
            
ColorChat(0,GREEN,"[JB] ^x03%s subio a ^x01 %s ^x03",name,rangi[level[id]]);
            
emit_sound(id,CHAN_VOICE,"darkgl/bb/gained_level.wav"VOL_NORMATTN_NORM0PITCH_NORM)
        }
        else
        {
            break;
        }
    }
}


public 
client_connect(id){
    
    
player_xp[id] = 0;
    
player_xp_all[id] = 0;
    
wczytaj_exp(id);
}

public 
client_disconnect(id){
    
zapisz_exp(id);
}

public 
wczytaj_exp(id){
    new 
vaultkey[64],vaultdata[512];
    
    new 
authid[64];
    
get_user_authid(id,authid,63);
    
format(vaultkey,63,"%s",authid);
    
nvault_get(zapis,vaultkey,vaultdata,511);
    
replace_all(vaultdata,256,"#"," ");
    new 
jeden[100],dwa[100]
    
parse(vaultdata,jeden,99,dwa,99)
    
player_xp[id] = str_to_num(jeden);
    
player_xp_all[id] = str_to_num(dwa);
    
    while(
true){
        if(
player_xp_all[id] >= exp[level[id]] && sizeof(rangi) > level[id]){
            
level[id]++;
        }
        else
        {
            break;
        }
    }
}

public 
zapisz_exp(id){
    new 
vaultkey[64],vaultdata[512];
    
    new 
authid[64];
    
get_user_authid(id,authid,63);
    
format(vaultkey,63,"%s",authid);
    
format(vaultdata,511,"%d#%d",player_xp[id],player_xp_all[id]);
    
nvault_set(zapis,vaultkey,vaultdata)
}

public 
ShowHUD(id)  { 
    if(
is_user_alive(id)){
        new 
HUD[128];
        
        
format(HUD127,"[%s] Exp actual: %d | Exp todal: %d",rangi[level[id]],player_xp[id],player_xp_all[id]);
        if(
get_pcvar_num(pcvar_hud) == ){
            
message_begin(MSG_ONEmsgtext, {0,0,0}, id);
            
write_byte(0);
            
write_string(HUD); 
            
message_end();
            return 
PLUGIN_CONTINUE;
        }
        else
        {
            
set_hudmessage(255000.020.6306.015.0)
            
show_hudmessage(id"%s",HUD)
        }
    }
    return 
PLUGIN_CONTINUE;
}



public 
DeathMsg()
{
    new 
kid read_data(1)    //zabojca
    
    
new vid read_data(2)    // ofiara
    
    
new hs read_data(3)    // ofiara
    
    
if(cs_get_user_team(kid)==CS_TEAM_CT && cs_get_user_team(vid)==CS_TEAM_T){
        
DajExp(kid,get_pcvar_num(pcvar_exp_kill_tt));
        
        new 
name[64];
        
get_user_name(vid,name,charsmax(name));
        
ColorChat(kid,TEAM_COLOR,"Ganaste %d por matar a %s",get_pcvar_num(pcvar_exp_kill_tt),name)
        if(
hs == 1){
            
DajExp(kid,get_pcvar_num(pcvar_exp_hs));
            
ColorChat(kid,TEAM_COLOR,"Ganaste %d por hacer hs",get_pcvar_num(pcvar_exp_hs))
        }
        
    }    
    else if(
cs_get_user_team(kid)==CS_TEAM_T && cs_get_user_team(vid)==CS_TEAM_CT){
        
DajExp(kid,get_pcvar_num(pcvar_exp_kill_ct));
        new 
name[64];
        
get_user_name(vid,name,charsmax(name));
        
ColorChat(kid,TEAM_COLOR,"Ganaste %d por matar a %s",get_pcvar_num(pcvar_exp_kill_ct),name)
        if(
hs == 1){
            
DajExp(kid,get_pcvar_num(pcvar_exp_hs));
            
ColorChat(kid,TEAM_COLOR,"Ganaste %d por hacer hs",get_pcvar_num(pcvar_exp_hs))
        }
    }    

Me da demasiado errores porfavor =)
TheShootSpeed is offline
 



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 20:29.


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