Raised This Month: $32 Target: $400
 8% 

Crear Base De Datos


  
 
 
Thread Tools Display Modes
Author Message
Juli.Cs
Junior Member
Join Date: Aug 2008
Old 03-27-2012 , 20:24   Crear Base De Datos
#1

Hola, bueno miren, tengo un problema, necesito conectar este plugins a una BASE DE DATOS, y también crear la BASE DE DATOS, pero no tengo mucha idea en esto, estuve intentando y leyendo guías, pero no funciono mucho.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>
#include <fun>
#include <sqlx>

#define MOD    "Escondidas MOD + XP"

#define HOST    "127.0.0.1"
#define USER    ""
#define PASS    ""
#define DB    "hns"

#define MAX_ITEMS    11
#define MAX_LVL    100
#define next_level(%1)    (%1 * 15)
#define cost_hp(%1)    (100 + g_level[%1])
#define fm_get_user_money(%1)    get_pdata_int(%1, 115)

new const sound_level_up[] = { "mv/up.wav" }
new const 
sound_hh[] = { "sound/mv/hh.mp3" }
new const 
sound_party[] = { "buttons/bell1.wav" }

new const 
numeros[][] = { "1""2" "3""4""5""6""7""8""9""0" };

new 
g_team_names[][] = { """TERRORIST""CT""SPECTATOR" }

new 
g_msgTeamInfog_msgSayTextg_MsgSyncg_MsgSync2g_MsgSync3g_MsgSync4g_MsgSync5g_msgMoneyg_maxplayers;

new 
Handle:g_hTuple

new happyhour_time[2] = { 1
new 
bool:is_happyhour[2]
new 
HAPPYHOUR_MULTIPLIER

new g_playername[33][32]
new 
g_password[33][32]
new 
g_msn[33][32]
new 
g_registro[33]
new 
g_level[33], g_frags[33], frags_carn[33]
new 
create_day[33][11], create_hour[33][11]
new 
hud_registro[33][200]

new 
item_name[MAX_ITEMS][32]
new 
item_cost[MAX_ITEMS]
new 
item_level[MAX_ITEMS]
new 
Float:item_time[MAX_ITEMS]
new 
item_i

new tiempo_jugado[33][3]
new 
g_matados[33][2]

new 
g_data[33][3]

new 
g_items[33]

new 
g_velocidad[33], g_danio[33], g_leap[33]

new 
g_Leap_forceg_Leap_height

#define next_point(%1)        ((%1 + 1) * 10)
#define porciento_mejora(%1)        (%1 * 20)

#define MAX_VIDA 5
#define MAX_DANIO 5
#define MAX_VIDA_M 50
#define MAX_DANIO_M 50

#define MAX_TOP    1010

new const g_top_names[][] =
{
    
"Nivel",
    
"M. Knife",
    
"M. Laser",
    
"Horas Jugadas"
}

new const 
g_top_orden[][] =
{
    
"Niveles",
    
"M. Knifes",
    
"M. Lasers",
    
"T. Jugado"
}

new const 
g_top_consulta[][] =
{
    
"lvls",
    
"mknife",
    
"mlaser",
    
"ths"
}

new const 
g_top_consulta2[][] =
{
    
"frags",
    
"mknife",
    
"mlaser",
    
"tmin"
}

new const 
g_top_columna[] =
{
    
1,
    
7,
    
8,
    
11
}

new 
g_top[33]
new 
g_party[33]
new 
g_combo_party[33]

new 
g_puntos_vida[33], g_puntos_danio[33], g_puntos[33], g_puntos_g[33]

#define CARNAGE_ROUND 5

new g_round
new g_carnage

#define ITEMS_STARTID g_data[id][0]
#define ITEMS_SELECTION (g_data[id][0]+key)

#define WPN_TOPID g_data[id][1]
#define WPN_MAXTOP g_data[id][2]

enum
{
    
KNIFE 0,
    
LASER
}

enum
{
    
SEGUNDOS 0,
    
MINUTOS,
    
HORAS
}

enum
{
    
M_TEAM 0,
    
M_REGISTRO
}

enum Color
{
    
YELLOW 1,
    
GREEN,
    
TEAM_COLOR,
    
GREY,
    
RED,
    
BLUE
}

enum (+= 100)
{
    
TASK_SHOWHUD 2000
}

#define ID_SHOWHUD (taskid - TASK_SHOWHUD)

const PEV_SPEC_TARGET pev_iuser2

const KEYSMENU = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)

public 
plugin_precache()
{
    
precache_sound(sound_level_up)
        
precache_generic(sound_hh)
    
precache_sound(sound_party)

    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink")
}

public 
plugin_natives()
{
    
native_items("Granada HE"300051.0)
    
native_items("Gravedad"80001015.0)
    
native_items("Velocidad"90002010.0)
    
native_items("Extra Damage"90003020.0)
    
native_items("Pasos Silencios"50004030.0)
    
native_items("Invisible"100005015.0)
    
native_items("200 HP"9500601.0)
    
native_items("AK-47 (3 balas)"13000701.0)
    
native_items("Salto Largo"130008015.0)
    
native_items("Respawn"16000901.0)
    
native_items("Inmunidad"160001005.0)

    
register_native("hnsxp_frag""native_hnsxp_frag"1)
    
register_native("hnsxp_carnage""native_hnsxp_carnage"1)
}

public 
native_hnsxp_frag(idamount)
{
    if (
amount == 1)
        
g_matados[id][LASER]++

    if (
g_party[id])
    {
        static 
i
        
for(032i++)
            if ((
1<<i) & g_party[id])
            {
                
g_combo_party[i+1] += amount HAPPYHOUR_MULTIPLIER
                ColorChat
(i+1BLUE"^4<Mv>^1 : Combo party ^3%d^1 de ^3%s^1 al terminar la ronda recibe^3 %d%% ^1del combo"g_playername[i+1], g_combo_party[i+1], floatround(porciento_party(i+1)))
                
client_cmd(i+1"spk ^"%s^""sound_party)
            }
    }
    else
        
g_frags[id] += amount HAPPYHOUR_MULTIPLIER

    check_level
(id)
    
guardar_datos(id)
}

public 
native_hnsxp_carnage()
{
    return 
g_carnage
}

public 
plugin_init()
{
    
g_msgTeamInfo get_user_msgid("TeamInfo")
    
g_msgSayText get_user_msgid("SayText")

    
register_clcmd("LOGUEAR_PASSWORD""loguear_password")
    
register_clcmd("CREAR_PASSWORD""crear_password")
    
register_clcmd("CONFIRMAR_PASSWORD""confirmar_password")
    
register_clcmd("CAMBIAR_PASSWORD""cambiar_password")
    
register_clcmd("CONFIRMAR_NUEVA_PASSWORD""confirmar_nueva_password")
    
register_clcmd("CREAR_MSN""crear_msn")

    
register_menu("menu registro"KEYSMENU"registro")
    
register_menu("menu shop"KEYSMENU"shop")
    
register_menu("menu game"KEYSMENU"game")
    
register_menu("menu mejoras"KEYSMENU"mejoras")
    
register_menu("menu estadisticas"KEYSMENU"estadisticas")
    
register_menu("menu top"KEYSMENU"top")
    
register_menu("menu party"KEYSMENU"party")


    
register_message(get_user_msgid("VGUIMenu"), "vgui")
    
register_clcmd("jointeam""change_team")
    
register_clcmd("chooseteam""change_team")

    
register_event("HLTV" "round_start" "a""1=0""2=0")
    
register_logevent("round_end"2"1=Round_End")

    
g_Leap_force register_cvar("zp_zclass_leap_force""570")
    
g_Leap_height register_cvar("zp_zclass_leap_height""275")

    
register_clcmd("say""hook_say")

    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1)
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")

    
register_forward(FM_ClientUserInfoChanged"ClientUserInfoChanged")

        
register_event("StatusValue""showStatus""be""1=2""2!0")
    
register_event("StatusValue""hideStatus""be""1=1""2=0")

    
g_MsgSync CreateHudSyncObj()
    
g_MsgSync2 CreateHudSyncObj()
    
g_MsgSync3 CreateHudSyncObj()
    
g_MsgSync4 CreateHudSyncObj()
    
g_MsgSync5 CreateHudSyncObj()

    
g_maxplayers get_maxplayers()

    
g_msgMoney get_user_msgid("Money")

    
MySQLx_Init()

    
g_round 0
}

public 
vgui(msg_idmsg_destmsg_entity)
{
    
menu_registro(msg_entity)

    return 
PLUGIN_HANDLED
}

public 
change_team(id)
{
    switch (
g_registro[id])
    {
        case 
M_TEAMmenu_game(id)
        case 
M_REGISTROmenu_registro(id)
    }
    return 
PLUGIN_HANDLED
}

public 
plugin_end()
{
    
SQL_FreeHandle(g_hTuple)
}

public 
client_connect(id)
{
    
get_user_name(idg_playername[id], charsmax(g_playername[]))
    
set_task(1.0"ShowHUD"id+TASK_SHOWHUD__"b")

    
reset_datos(id)

    
cargar_datos(id)
    
cargar_cuenta(id)
    
remove_item(id)
}

public 
client_disconnect(id)
{
    
remove_task(id+TASK_SHOWHUD)

    
reset_datos(id)

    
clear_registro_HUD(id)
}

public 
reset_datos(id)
{
    
g_party[id] = 0
    g_combo_party
[id] = 0

    g_level
[id] = 1
    g_frags
[id] = 0
    frags_carn
[id] = 0

    g_puntos_vida
[id] = 0
    g_puntos_danio
[id] = 0
    g_puntos
[id] = 0
    g_puntos_g
[id] = 0

    create_day
[id][0] = 0
    create_hour
[id][0] = 0

    g_matados
[id][KNIFE] = 0
    g_matados
[id][LASER] = 0

    tiempo_jugado
[id][SEGUNDOS] = 0
    tiempo_jugado
[id][MINUTOS] = 0
    tiempo_jugado
[id][HORAS] = 0

    g_registro
[id] = M_REGISTRO
    client_cmd
(id"setinfo _vgui_menus 1")    
}

public 
ClientUserInfoChanged(idbuffer)
{
    if(!
is_user_connected(id))
        return 
FMRES_IGNORED;

    static 
newname[32]

    
engfunc(EngFunc_InfoKeyValuebuffer"name"newnamecharsmax(newname))

    
get_user_name(idg_playername[id], charsmax(g_playername[]))

    if (
equal(newnameg_playername[id]))
    {
        return 
FMRES_IGNORED;
    }

    
engfunc(EngFunc_SetClientKeyValueidbuffer"name"g_playername[id])

    return 
FMRES_SUPERCEDE;
}

public 
fw_PlayerSpawn_Post(id)
{
    if (!
is_user_alive(id) || !cs_get_user_team(id))
        return;

    if (
g_registro[id] != M_TEAM)
    {
        
server_cmd("kick #%d ^"<MvMotivoIntento de bug de cuentas.^""get_user_userid(id))
    }

    
g_items[id] = 1

    fm_set_user_health
(idmejora_vida(idcost_hp(id)))

    
set_task(12.0"check_carnage"id)
}

public 
check_carnage(id)
{
    if (!
g_carnage)
        return;

    
set_user_health(id100)
    
fm_strip_user_weapons(id)
    
give_item(id"weapon_knife")
    
give_item(id"weapon_awp")
    
cs_set_weapon_ammo(fm_find_ent_by_owner(-1"weapon_awp"id), 10)
}


public 
fw_PlayerKilled(victimattackershouldgib)
{
    if (
victim == attacker || !is_user_connected(attacker))
        return;

    if (
g_carnage)
    {
        static 
hh
        hh 
HAPPYHOUR_MULTIPLIER

        frags_carn
[attacker] += hh

        
if (frags_carn[attacker] > 9)
        {
            
g_puntos[attacker] += hh
            frags_carn
[attacker] = 0

            ColorChat
(attackerTEAM_COLOR"^4<Mv> ^1: Ganaste^3 %d ^1 puntos."hh)
            
client_print(attackerprint_center"Ganaste %d puntos."hh)
            
client_cmd(attacker"mp3 play %s"sound_hh)
        }
        else
        {
            
ColorChat(attackerTEAM_COLOR"^4<Mv> ^1: Ganaste^3 %d ^1 carnage-frags."hh)
            
client_print(attackerprint_center"Tenes %d/10 Carnage-Frags."frags_carn[attacker])
            
client_cmd(attacker"spk ^"%s^""sound_party)
        }    
    }
    else
    {
        if (
g_party[attacker])
        {
            static 
i
            
for(032i++)
                if ((
1<<i) & g_party[attacker])
                {
                    
g_combo_party[i+1] += HAPPYHOUR_MULTIPLIER
                    ColorChat
(i+1BLUE"^4<Mv>^1 : Combo party ^3%d^1 de ^3%s^1 al terminar la ronda recibe^3 %d%% ^1del combo"g_playername[i+1], g_combo_party[i+1], floatround(porciento_party(i+1)))
                    
client_cmd(i+1"spk ^"%s^""sound_party)
                }
        }
        else
            
g_frags[attacker] += HAPPYHOUR_MULTIPLIER
    
}

    if (
get_user_weapon(attacker) == CSW_KNIFE)
        
g_matados[attacker][KNIFE]++

    
check_level(attacker)
    
guardar_datos(attacker)
}

public 
round_start()
{
    static 
id
    
for (id 1id <= g_maxplayersid++)
        if (
g_party[id])
            
g_combo_party[id] = 0

    check_happyhour
()

    
g_round++
    
g_carnage 0

    
if (g_round == CARNAGE_ROUND)
    {
        
g_round 0
        g_carnage 
1
    
}
}

public 
round_end()
{
    static 
id
    
for (id 1id <= g_maxplayersid++)
        if (
g_party[id])
        {
            static 
frags
            frags 
= (g_combo_party[id] / bit_total(g_party[id]))
            
g_frags[id]+= frags
            ColorChat
(0BLUE"^4<Mv> ^1: Combo party finalizado! Ganas %d frags."frags)
            
client_cmd(id"spk ^"%s^""sound_party)
            
check_level(id)
        }
}

check_level(id)
{
    if (
g_level[id] == MAX_LVL)
        return

    while (
g_frags[id] >= next_level(g_level[id]))
    {
        
g_frags[id] = 0
        g_level
[id]++
        
ColorChat(0TEAM_COLOR"^4<Mv> ^1: El Player^4 %s ^1a subido a nivel^3 %d"g_playername[id], g_level[id])
        
client_cmd(id"spk ^"%s^""sound_level_up)
    }
}

check_happyhour()
{
    static 
szhour[4], hour
    format_time
(szhourcharsmax(szhour), "%H")
    
    
hour str_to_num(szhour)
    
    new 
startend
    
    start 
happyhour_time[0]
    
end happyhour_time[1]
    
    new 
bool:_hh
    
while (start != end)
    {
        if (
start == 24)
            
start 0
        
        
if (start == hour)
        {
            
_hh true
            
break;
        }
        
start++
    } 
    
    if (
_hh)
    {
        if (!
is_happyhour[0])
        {
            
is_happyhour[0] = true
            ColorChat
(0TEAM_COLOR"^4<Mv> ^1: Ha comenzado ^3HappyHour^1.")
            
client_print(0print_center"Comenzo la HAPPY-HOUR !!!")
            
client_cmd(0"mp3 play %s"sound_hh)
        }
        else
                {
            
HAPPYHOUR_MULTIPLIER 2

            
return;  
        }
    }
    else if(
happyhour_time[1] == hour)
    {
        if (!
is_happyhour[1])
        {
            
is_happyhour[1] = true
            ColorChat
(0TEAM_COLOR"^4<Mv> ^1: Ha terminado ^3HappyHour^1.")
            
client_print(0print_center"Termino la HAPPY-HOUR !!!")
            
client_cmd(0"mp3 play %s"sound_hh)
        }
    }  
    
HAPPYHOUR_MULTIPLIER 1
}

public 
ShowHUD(taskid)
{
    static 
id
    id 
ID_SHOWHUD;

    if (
g_registro[id] != M_TEAM)
    {
        
set_hudmessage(002500.020.220.110.00.051.01)
        
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync3hud_registro[ID_SHOWHUD])
        
        return;
    }

    if (
is_user_connected(id))
    {
        if (
tiempo_jugado[id][SEGUNDOS] > 59)
        {
            
tiempo_jugado[id][SEGUNDOS] = 0
            tiempo_jugado
[id][MINUTOS]++
        }
        else
        {
            
tiempo_jugado[id][SEGUNDOS]++
        }
        if (
tiempo_jugado[id][MINUTOS] > 59)
        {
            
tiempo_jugado[id][MINUTOS] = 0
            tiempo_jugado
[id][HORAS]++
        }
    }

    if (!
is_user_alive(id))
    {
        
id pev(idPEV_SPEC_TARGET)

        if (!
is_user_alive(id)) return;
    }

    static 
hud[256], lenfull[72]

    if (
g_level[id] == MAX_LVL)
        
formatex(full71"FULL")
    else
        
formatex(full71"/ %d - Restantes: %d - Completo: %0.2f%%"next_level(g_level[id]), next_level(g_level[id])  - g_frags[id], porciento_nivel(id))

    if (
id != ID_SHOWHUD)
    {
        
len 0
        
        len 
+= formatex(hud[len], charsmax(hud) - len"- Especteando a: %s^n^n- Nivel: %d | Frags: %d %s"g_playername[id], g_level[id], g_frags[id], full)

        
set_hudmessage(02552550.020.206.01.10.00.0, -1)        
        
        
ShowSyncHudMsg(ID_SHOWHUDg_MsgSynchud)
    }
    else
    {
        
len 0    
        
        set_hudmessage
(0501000.020.801.01.01.01.0)
        
        
len 0
        hud
[0] = '^0'

        
for (new 032i++)
        {
            if ((
1<<i) & g_party[id])
                
len += formatex(hud[len], charsmax(hud) - len"%s - Nivel: %d - Completo: %0.2f%%^n"g_playername[i+1], g_level[i+1], porciento_nivel(i+1));
        }

        
len += formatex(hud[len], charsmax(hud) - len"^nNivel: %d | Frags: %d %s"g_level[id], g_frags[id], full)
        
        
ShowSyncHudMsg(idg_MsgSynchud)

        if (
HAPPYHOUR_MULTIPLIER >= 2)
        {
            
set_hudmessage(0501000.050.0211.01.01.01.0)
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync4"HappyHour: ganas el doble de frags.")
        }

        
set_hudmessage(255000.050.05g_carnage 11.01.01.01.0)
        if (
g_carnage)
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync5"Modo Carnage !!!")
        else
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync5"Modo Carnage: falta %d rondas."CARNAGE_ROUND g_round)
    }
}

public 
showStatus(id)
{
    if (!
is_user_connected(id))
        return;

    static 
target
    target 
read_data(2)

    if (!
is_user_connected(target))
        return;        

    
set_hudmessage(050100, -1.00.6010.013.00.010.01)
    
ShowSyncHudMsg(idg_MsgSync2"- %s^n- Nivel: %d"g_playername[target], g_level[target])
}

public 
hideStatus(id)
{
    
ClearSyncHud(idg_MsgSync2)
}

clear_registro_HUD(id)
{
    
ClearSyncHud(idg_MsgSync3)
    
hud_registro[id][0] = '^0'
}

public 
hook_say(id)
{
    new 
say[256], alive
    read_args
(say255)
    
remove_quotes(say)

    
alive = !is_user_alive(id)

    if(
equal(say""))
        return 
PLUGIN_HANDLED

    
if(equal(say"/shop"))
    {
        
menu_shop(id)
        
ColorChat(0BLUE"^4<Mv> ^1: Escribi ^3/shop^1 para comprar items.")
    }


    if(
equal(say"/yo"))
    {
        
menu_estadisticas(id)
        
ColorChat(0BLUE"^4<Mv> ^1: Escribi ^3/yo^1 para mirar tus estadisticas.")
    }

    if(
equal(say"/top"))
    {
        
clcmd_top(id)
        
ColorChat(0BLUE"^4<Mv> ^1: Escribi ^3/top^1 para mirar el top jugadores.")
    }

    if(
contain(say"happy") != -1)
        
ColorChat(0BLUE"^4<Mv> ^1: la ^3HAPPY-HOUR^1 Comienza a las^4 %d^1 y Termina a las^4 %d^1."happyhour_time[0], happyhour_time[1])

    for(new 
0sizeof(numeros); i++)
    {
        if(
contain(saynumeros[i]) != -1)
        {
            
ColorChat(idBLUE"^4<Mv> ^1: Prohibido los numeros")
            return 
PLUGIN_HANDLED
        
}
    }

    switch(
cs_get_user_team(id))
    {
        case 
CS_TEAM_UNASSIGNEDColorChat(0GREY"^1*MUERTO* ^4[^3%d^4] ^3%s ^1: %s"g_playername[id], say)
        case 
CS_TEAM_TColorChat(0RED"%s ^4[^3%d^4] ^3%s ^1: %s"alive "^1*MUERTO*" ""g_level[id], g_playername[id], say)
        case 
CS_TEAM_CTColorChat(0BLUE"%s ^4[^3%d^4] ^3%s ^1: %s"alive "^1*MUERTO*" ""g_level[id], g_playername[id], say)
        case 
CS_TEAM_SPECTATORColorChat(0GREY"^1*MUERTO* ^4[^3%d^4] ^3%s ^1: %s"g_playername[id], say)
    }

    static 
data[256]
    
formatex(datasizeof data 1"| %s : %s"g_playername[id], say)
    
log_to_file("say.log"data)

    return 
PLUGIN_HANDLED
}

public 
ColorChat(idColor:type, const msg[], {Float,Sql,Result,_}:...)
{
    static 
message[256]
    switch(
type)
    {
        case 
YELLOW
        {
            
message[0] = 01
        
}
        case 
GREEN:
        {
            
message[0] = 04
        
}
        default:
        {
            
message[0] = 03
        
}
    }
    
    
vformat(message[1], 251msg4)
    
    
message[192] = '^0'
    
    
new teamColorChangeindexMSG_Type

    
if(id)
    {
        
MSG_Type MSG_ONE_UNRELIABLE
        index 
id
    
}
    else
    {
        
index FindPlayer()
        
MSG_Type MSG_BROADCAST
    
}

    
team get_user_team(index)
    
    
ColorChange ColorSelection(indexMSG_Typetype)
    
    
ShowColorMessage(indexMSG_Typemessage)
    
    if(
ColorChange)
    {
        
Team_Info(indexMSG_Typeg_team_names[team])
    }
}

FindPlayer()
{
    new 
= -1
    
    
while(<= get_maxplayers())
    {
        if(
is_user_connected(++i))
        {
            return 
i
        
}
    }
    
    return -
1
}

ShowColorMessage(idtypemessage[])
{
    
message_begin(typeg_msgSayText_id)
    
write_byte(id)        
    
write_string(message)
    
message_end()
}

Team_Info(idtypeteam[])
{
    
message_begin(typeg_msgTeamInfo_id)
    
write_byte(id)
    
write_string(team)
    
message_end()
    return 
1
}

ColorSelection(indextypeColor:Type)
{
    switch(
Type)
    {
        case 
RED:
        {
            return 
Team_Info(indextypeg_team_names[1])
        }
        case 
BLUE:
        {
            return 
Team_Info(indextypeg_team_names[2])
        }
        case 
GREY:
        {
            return 
Team_Info(indextypeg_team_names[0])
        }
    }
    
    return 
0;
}

stock fm_set_user_health(idhealth)
{
    (
health 0) ? set_pev(idpev_healthfloat(health)) : dllfunc(DLLFunc_ClientKillid);
}

stock fm_find_ent_by_owner(entity, const classname[], owner)
{
    while ((
entity engfunc(EngFunc_FindEntityByStringentity"classname"classname)) && pev(entitypev_owner) != owner) {}
    
    return 
entity;
}

public 
menu_shop(id)
{
    if (!
is_user_connected(id))
        return;
    
    static 
menu[400], leni
    len 
0

    
new money fm_get_user_money(id);

    
len += formatex(menu[len], sizeof menu len"\yMenu \rSHOP^n^n")

    for (
ITEMS_STARTIDmin(ITEMS_STARTID+7min(ITEMS_STARTID+7item_i)); i++)
    {
        if (
g_level[id] >= item_level[i])
        {
            if (
g_items[id])
                
len += formatex(menu[len], sizeof menu len"\d%d. %s %s[$%d]^n"i-ITEMS_STARTID+1item_name[i], money >= item_cost[i] ? "\y" "\r"item_cost[i])
            else
                
len += formatex(menu[len], sizeof menu len"\d%d. %s^n"i-ITEMS_STARTID+1item_name[i])
        }
        else
            
len += formatex(menu[len], sizeof menu len"\d%d. %s \r(nivel %d)^n"i-ITEMS_STARTID+1item_name[i], item_level[i])
    }

    
len += formatex(menu[len], sizeof menu len"^n\r8.\w Anterior^n\r9.\w Siguiente ^n^n\r0.\w Salir del menu")
    
    
show_menu(idKEYSMENUmenu, -1"menu shop")
}

public 
shop(idkey)
{
    if (
key >= || ITEMS_SELECTION >= item_i)
    {
        switch (
key)
        {
            case 
7: if (ITEMS_STARTID->= 0ITEMS_STARTID -= 7
            
case 8: if (ITEMS_STARTID+item_iITEMS_STARTID += 7
            
case 9: return PLUGIN_HANDLED;
        }

        
menu_shop(id)
        return 
PLUGIN_HANDLED;
    }

    
buy_item(idITEMS_SELECTION);
    
    return 
PLUGIN_HANDLED;
}

buy_item(iditemid)
{
    new 
money fm_get_user_money(id)

    if (
g_carnage)
    {
        
ColorChat(idGREY"^4<Mv> ^1: no podes comprar items en ^3CARNAGE^1.")
        return;
    }

    if (!
g_items[id])
    {
        
ColorChat(idTEAM_COLOR"^4<Mv> ^1: solo podes comprar 1 item por ronda.")
        return;
    }

    if (
g_level[id] < item_level[itemid])
    {
        
ColorChat(idTEAM_COLOR"^4<Mv> ^1: no tenes suficiente nivel para comprar este item."
        return;
    }

    if (
money item_cost[itemid])
    {
        
ColorChat(idTEAM_COLOR"^4<Mv> ^1: no tenes suficiente plata para comprar este item.")
        return;
    }

    if (
itemid != 9)
    {
        if (!
is_user_alive(id))
        {
            
ColorChat(idTEAM_COLOR"^4<Mv> ^1: tenes que estar vivo para poder comprar este item.")
            return;
        }
    }
    else
    {
        if (
is_user_alive(id))
        {
            
ColorChat(idTEAM_COLOR"^4<Mv> ^1: tenes que estar muerto para poder comprar este item.")
            return;
        }
    }

    switch (
itemid)
    {
        case 
0give_item(id"weapon_hegrenade")
        case 
1set_pev(idpev_gravity0.1)
        case 
2g_velocidad[id] = true
        
case 3g_danio[id] = true
        
case 4set_user_footsteps(id1)
        case 
5set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha10)
        case 
6set_user_health(id200)
        case 
7:
        {
            
give_item(id"weapon_ak47")
            
cs_set_weapon_ammo(fm_find_ent_by_owner(-1"weapon_ak47"id), 3)
        }
        case 
8g_leap[id] = true
        
case 9ExecuteHamB(Ham_CS_RoundRespawnid)
        case 
10set_user_godmode(id0)
    }

    
set_task(Float:item_time[itemid], "remove_item"id)
    
ColorChat(idTEAM_COLOR"^4<Mv> ^1: has comprado ^3%s^1, Recuerda que solo podes comprar 1 item por ronda."item_name[itemid])
    
fm_set_user_money(idmoney item_cost[itemid])
    
g_items[id]--
}

public 
remove_item(id)
{
    
set_pev(idpev_gravity1.0)
    
set_user_godmode(id0)
    
set_user_footsteps(id0)
    
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha250);

    
g_velocidad[id] = false
    g_danio
[id] = false
    g_leap
[id] = false
}

public 
fw_PlayerPreThink(id)
{
    if (!
is_user_alive(id))
        return;

    if (
g_velocidad[id])
        
set_pev(idpev_maxspeed350.0)

    if (
allowed_Leap(id))
    {
        
g_leap[id] = true
        
        
static Float:velocity[3]
        
velocity_by_aim(idget_pcvar_num(g_Leap_force), velocity)
        
        
velocity[2] = get_pcvar_float(g_Leap_height)
        
        
set_pev(idpev_velocityvelocity)
    }
}

allowed_Leap(id)
{        
    if (!
g_leap[id])
        return 
false

    
static buttons
    buttons 
pev(idpev_button)
    
    if (!(
pev(idpev_flags) & FL_ONGROUND) || fm_get_speed(id) < 20 || !(buttons IN_JUMP) || !(buttons IN_DUCK))
        return 
false
    
    
return true
}

stock fm_get_speed(entity)
{
    static 
Float:velocity[3]
    
pev(entitypev_velocityvelocity)
    
    return 
floatround(vector_length(velocity))
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    if (!
is_user_alive(attacker))
        return;

    if (
g_danio[attacker])
        
damage *= 3.0
    
else
        
damage *= mejora_danio(attacker1.0)

    
SetHamParamFloat(4damage)
}

native_items(const name[], costlevelFloat:time)
{
    if (
item_i >= sizeof item_name)
        return;

    
copy(item_name[item_i], sizeof item_name[] - 1name)
    
item_cost[item_i] = cost
    item_level
[item_i] = level
    item_time
[item_i] = time

    item_i
++
}

public 
fm_set_user_money (indexi_Money)
{
    
set_pdata_int (index115i_Money);

    
message_begin (MSG_ONEg_msgMoney_index);
    
write_long (i_Money);
    
write_byte (1);
    
message_end ();
}

public 
MySQLx_Init() 
{
    
g_hTuple SQL_MakeDbTuple(HOSTUSERPASSDB)
}

public 
guardar_datos(id
{
    static 
szQuery[912];
    
formatex(szQuery911"REPLACE INTO `mv_datos` (`nick`, `lvls`, `frags`, `pts`, `ptsg`, `mvida`, `mdanio`, `mknife`, `mlaser`, `tseg`, `tmin`, `ths`, `cfrags`) VALUES ('%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d');"g_playername[id], g_level[id], g_frags[id], g_puntos[id], g_puntos_g[id], g_puntos_vida[id], g_puntos_danio[id], g_matados[id][KNIFE], g_matados[id][LASER], tiempo_jugado[id][SEGUNDOS], tiempo_jugado[id][MINUTOS], tiempo_jugado[id][HORAS], frags_carn[id])

    
SQL_ThreadQuery(g_hTuple"query_guardar"szQuery)
}

public 
cargar_datos(id)
{
    static 
szQuery[256], iData[1]; 

    
formatex(szQuery255"SELECT * FROM `mv_datos` WHERE (`nick` = '%s');"g_playername[id]);   

    
iData[0] = id
    
SQL_ThreadQuery(g_hTuple"query_load"szQueryiData1);
}

public 
query_guardar(iFailStateHandle:hQueryszError[], iErroriData[], iDataSizeFloat:fQueueTime

    if(
iFailState == TQUERY_CONNECT_FAILED || iFailState == TQUERY_QUERY_FAILED
    { 
        
log_amx("%s"szError)
        return
    }
}

public 
query_load(iFailStateHandle:hQueryszError[], iErroriData[], iDataSizeFloat:fQueueTime

    if(
iFailState == TQUERY_CONNECT_FAILED || iFailState == TQUERY_QUERY_FAILED
    { 
        
log_amx("%s"szError)
        return
    } 
    else 
    {
        new 
id iData[0]

        
g_level[id] = SQL_ReadResult(hQuery1)
        
g_frags[id] = SQL_ReadResult(hQuery2)
        
g_puntos[id] = SQL_ReadResult(hQuery3)
        
g_puntos_g[id] = SQL_ReadResult(hQuery4)
        
g_puntos_vida[id] = SQL_ReadResult(hQuery5)
        
g_puntos_danio[id] = SQL_ReadResult(hQuery6)
        
g_matados[id][KNIFE] = SQL_ReadResult(hQuery7)
        
g_matados[id][LASER] = SQL_ReadResult(hQuery8)
        
tiempo_jugado[id][SEGUNDOS] = SQL_ReadResult(hQuery9)
        
tiempo_jugado[id][MINUTOS] = SQL_ReadResult(hQuery10)
        
tiempo_jugado[id][HORAS] = SQL_ReadResult(hQuery11)
        
frags_carn[id] = SQL_ReadResult(hQuery12)
    } 
}

public 
menu_registro(id)
{
    static 
menu[999], len
    len 
0
    
    len 
+= formatex(menu[len], sizeof menu len"\w______________________________^n")
    
len += formatex(menu[len], sizeof menu len"\yBienvenido(a) Usuario^n\y%s \dNuestra Web \rwww.branca-team.com.ar^n"MOD)
    
len += formatex(menu[len], sizeof menu len"\w______________________________^n^n")

    
len += formatex(menu[len], sizeof menu len"\r1.\w LOGEARME^n")
    
len += formatex(menu[len], sizeof menu len"\r2.\w CREAR CUENTA")
    
    
show_menu(idKEYSMENUmenu, -1"menu registro")
}

public 
registro(idkey)
{
        switch(
key)
        {
        case 
0check_loguear(id)
        case 
1check_crear(id)
        }
    return 
PLUGIN_HANDLED
}

public 
check_crear(id)
{
    static 
query[256], data[1]
    
formatex(query255"SELECT `cuenta` FROM `mv_cuentas` WHERE ( `cuenta` = '%s' );"g_playername[id])
            
    
data[0] = id
    SQL_ThreadQuery
(g_hTuple"query_crear"querydata1)
}

public 
query_crear(iFailStateHandle:hQueryszError[], iErrordata[], iDataSizeFloat:fQueueTime
{
    if(
iFailState == TQUERY_CONNECT_FAILED || iFailState == TQUERY_QUERY_FAILED
    {
        
log_amx("%s"szError)
        return
    }
    else
    {
        new 
id data[0]
            
        if(
SQL_NumResults(hQuery))
        {
            
menu_registro(id)
            
clear_registro_HUD(id)
            
formatex(hud_registro[id], charsmax(hud_registro[]), "La Cuenta %s^nya existe."g_playername[id])
        }
        else
        {
            
client_cmd(id"messagemode CREAR_PASSWORD")
            
clear_registro_HUD(id)
            
formatex(hud_registro[id], charsmax(hud_registro[]), "Ingresa una Password^npara tu Cuenta.")
        }
    }
}

public 
crear_password(id)
{
    new 
pw[64]
    
read_args(pwcharsmax(pw))
    
remove_quotes(pw)
    
trim(pw)
            
    if(!
pw[0])
        
client_cmd(id"messagemode CREAR_PASSWORD")
    else
    {        
        
copy(g_password[id], charsmax(g_password[]), pw)
        
client_cmd(id"messagemode CONFIRMAR_PASSWORD")
        
clear_registro_HUD(id)
        
formatex(hud_registro[id], charsmax(hud_registro[]), "Ingresa nuevamente la password^npara confirmarla.")
    }
}

public 
confirmar_password(id)
{
    new 
pw[64]
    
read_args(pwcharsmax(pw))
    
remove_quotes(pw)
    
trim(pw)
            
    if(!
pw[0])
        
client_cmd(id"messagemode CREAR_PASSWORD")
    else
    {        
        if(
equal(pwg_password[id]))
        {
            
clear_registro_HUD(id)
            
formatex(hud_registro[id], charsmax(hud_registro[]), "Te has registrado.^nTu cuenta es: %s con la passowrd: %s"g_playername[id], g_password[id])

            
client_cmd(id"messagemode CREAR_MSN")
            
clear_registro_HUD(id)
            
formatex(hud_registro[id], charsmax(hud_registro[]), "Es MUY IMPORTANTE que pongas tu mail real^nDe lo contrario no podras recuperar tu cuenta^nPulsando shft+2 aparece la arroba^nPulsando shift+? aparece el guion bajo")
        }
        else
        {
            
clear_registro_HUD(id)
            
formatex(hud_registro[id], charsmax(hud_registro[]), "Las password^nno coinciden.")
            
client_cmd(id"messagemode CREAR_PASSWORD")
            
menu_registro(id)
        }
    }
}

public 
crear_msn(id)
{
    new 
pw[64]
    
read_args(pwcharsmax(pw))
    
remove_quotes(pw)
    
trim(pw)
            
    if(!
pw[0])
        
client_cmd(id"messagemode CREAR_MSN")
    else
    {        
        
copy(g_msn[id], charsmax(g_msn[]), pw)

        
guardar_cuenta(id)

        
engclient_cmd(id"jointeam""5")
        
engclient_cmd(id"joinclass""5")

        
g_registro[id] = M_TEAM
        menu_game
(id)
    }
}

public 
guardar_cuenta(id)
{
    static 
szQuery[712], iData[1]

    
get_time("%d/%m/%Y"create_day[id], charsmax(create_day[]))
    
get_time("%H:%M:%S"create_hour[id], charsmax(create_hour[]))

    
formatex(szQuery711"INSERT INTO `mv_cuentas` (`cuenta`, `password`, `msn`, `cday`, `chour`) VALUES('%s', '%s', '%s', '%s', '%s');"g_playername[id], g_password[id], g_msn[id], create_day[id], create_hour[id])

    
iData[0] = id
    SQL_ThreadQuery
(g_hTuple"query_guardar"szQuery)
}

public 
check_loguear(id)
{
    static 
szQuery[128], iData[1]
    
formatex(szQuery128"SELECT `password` FROM `mv_cuentas` WHERE ( `cuenta` = '%s' );"g_playername[id])
            
    
iData[0] = id
    SQL_ThreadQuery
(g_hTuple"query_loguear"szQueryiData1)
}

public 
query_loguear(iFailStateHandle:hQueryszError[], iErroriData[], iDataSizeFloat:fQueueTime

    if(
iFailState == TQUERY_CONNECT_FAILED || iFailState == TQUERY_QUERY_FAILED
    { 
        
log_amx("%s"szError)
        return
    } 
    else 
    { 
        new 
id iData[0]
                
        if(
SQL_NumResults(hQuery))
            
password(id)
        else
        {
            
menu_registro(id)
            
clear_registro_HUD(id)
            
formatex(hud_registro[id], charsmax(hud_registro[]), "La Cuenta %s^n no existe."g_playername[id])
        }
    }
}

public 
password(id)
{
    static 
szQuery[256], iData[1]

    
formatex(szQuery255"SELECT `password` FROM `mv_cuentas` WHERE ( `cuenta` = '%s' );"g_playername[id])

    
iData[0] = id
    SQL_ThreadQuery
(g_hTuple"query_password"szQueryiData1)
}

public 
query_password(iFailStateHandle:hQueryszError[], iErroriData[], iDataSizeFloat:fQueueTime

    if(
iFailState == TQUERY_CONNECT_FAILED || iFailState == TQUERY_QUERY_FAILED
    { 
        
log_amx("%s"szError)
        return
    }
    else
    {
        new 
id iData[0]

        new 
ip SQL_FieldNameToNum(hQuery"password"
        
        while (
SQL_MoreResults(hQuery)) 
        {
            
SQL_ReadResult(hQueryip,g_password[id], charsmax(g_password[]))
            
SQL_NextRow(hQuery)
        }

        
client_cmd(id"messagemode LOGUEAR_PASSWORD")
        
clear_registro_HUD(id)
        
formatex(hud_registro[id], charsmax(hud_registro[]), "Ingresa la Password^nde tu Cuenta.")
    }
}

public 
loguear_password(id)
{
    new 
pass[64]
    
read_args(passcharsmax(pass))
    
remove_quotes(pass)
    
trim(pass)
            
    if(!
pass[0])
        
client_cmd(id"messagemode LOGUEAR_PASSWORD")
    else
    {        
        if(
equal(passg_password[id]))
        {
            
clear_registro_HUD(id)
            
formatex(hud_registro[id], charsmax(hud_registro[]), "Te has logueado.^nTu cuenta es: %s."g_playername[id])

            
engclient_cmd(id"jointeam""5")
            
engclient_cmd(id"joinclass""5")

            
g_registro[id] = M_TEAM
            menu_game
(id)
        }
        else
        {
            
clear_registro_HUD(id)
            
formatex(hud_registro[id], charsmax(hud_registro[]), "La password es incorrecta.^ntu cuenta es: %s"g_playername[id])
            
menu_registro(id)
        }
    }
}

public 
cambiar_password(id)
{
    new 
npw[64]
    
read_args(npwcharsmax(npw))
    
remove_quotes(npw)
    
trim(npw)
            
    if(!
npw[0])
        
client_cmd(id"messagemode CAMBIAR_PASSWORD")
    else
    {        
        
copy(g_password[id], charsmax(g_password[]), npw)
        
client_cmd(id"messagemode CONFIRMAR_NUEVA_PASSWORD")
        
clear_registro_HUD(id)
        
formatex(hud_registro[id], charsmax(hud_registro[]), "Ingresa la nueva password.^npara confirmarla")
    }
}

public 
confirmar_nueva_password(id)
{
    new 
npw[64]
    
read_args(npwcharsmax(npw))
    
remove_quotes(npw)
    
trim(npw)
            
    if(!
npw[0])
        
client_cmd(id"messagemode CAMBIAR_PASSWORD")
    else
    {        
        if(
equal(npwg_password[id]))
            
check_npassword(id)
        else
        {
            
clear_registro_HUD(id)
            
formatex(hud_registro[id], charsmax(hud_registro[]), "Las passwords no coinciden.")
            
menu_game(id)
        }
    }
}

public 
check_npassword(id)
{
    static 
szQuery[256], iData[1]
    
formatex(szQuery255"UPDATE `mv_cuentas` SET `password` = '%s' WHERE ( `cuenta` = '%s' );"g_password[id], g_playername[id])

    
iData[0] = id
    SQL_ThreadQuery
(g_hTuple"query_npassword"szQuery)
}

public 
query_npassword(iFailStateHandle:hQueryszError[], iErroriData[], iDataSizeFloat:fQueueTime

    if(
iFailState == TQUERY_CONNECT_FAILED || iFailState == TQUERY_QUERY_FAILED
    { 
        
log_amx("%s"szError)
        return
    }
    else
    {
        new 
id iData[0]

        
clear_registro_HUD(id)
        
formatex(hud_registro[id], charsmax(hud_registro[]), "Has cambiado tu password.^nTu password actual es: %s"g_password[id])

        
menu_game(id)
    }
}

public 
cargar_cuenta(id)
{
    static 
szQuery[256], iData[1]

    
formatex(szQuery255"SELECT `cday`, `chour` FROM `mv_cuentas` WHERE ( `cuenta` = '%s' );"g_playername[id])

    
iData[0] = id
    SQL_ThreadQuery
(g_hTuple"query_data"szQueryiData1)
}

public 
query_data(iFailStateHandle:hQueryszError[], iErroriData[], iDataSizeFloat:fQueueTime

    if(
iFailState == TQUERY_CONNECT_FAILED || iFailState == TQUERY_QUERY_FAILED
    { 
        
log_amx("%s"szError)
        return
    }
    else
    {
        new 
id iData[0]

        new 
icday SQL_FieldNameToNum(hQuery"cday"
        new 
ichour SQL_FieldNameToNum(hQuery"chour")
        
        while (
SQL_MoreResults(hQuery)) 
        {
            
SQL_ReadResult(hQueryicdaycreate_day[id], charsmax(create_day[]))
            
SQL_ReadResult(hQueryichourcreate_hour[id], charsmax(create_hour[]))
            
SQL_NextRow(hQuery)
        }
    }
}

public 
menu_game(id)
{
    static 
menu[999], len
    len 
0

    
new day[10], hour[10]
    
get_time("%d/%m"daycharsmax(day))
    
get_time("%H:%M"hourcharsmax(hour))

    
len += formatex(menu[len], sizeof menu len"\w______________________________^n")
    
len += formatex(menu[len], sizeof menu len"\ywww.MafiaVirtual.com.ar ^n\y%s ^n"MOD)
    
len += formatex(menu[len], sizeof menu len"\w______________________________^n^n")

    
len += formatex(menu[len], sizeof menu len"\r-\w La Fecha actual es \y%s %s^n^n"hourday)

    
len += formatex(menu[len], sizeof menu len"%s Menu SHOP^n"g_carnage "\d1." "\r1.\w")
    
len += formatex(menu[len], sizeof menu len"\r2.\w Estadisticas^n")
    
len += formatex(menu[len], sizeof menu len"\r3.\w Cambiar Password^n")
    
len += formatex(menu[len], sizeof menu len"\r4.\w Mejoras^n")
    
//len += formatex(menu[len], sizeof menu - 1 - len, "\r5.\w PARTY \r(BETA)^n")

    
len += formatex(menu[len], sizeof menu len"^n^n\r0.\w Salir del Menu")

    
show_menu(idKEYSMENUmenu, -1"menu game")
}

public 
game(idkey)
{
    switch (
key)
    {
        case 
0:    menu_shop(id)
        case 
1menu_estadisticas(id)
        case 
2:
        {
            
client_cmd(id"messagemode CAMBIAR_PASSWORD")
            
clear_registro_HUD(id)
            
formatex(hud_registro[id], charsmax(hud_registro[]), "Ingresa la nueva password.^nTu password actual es: %s"g_password[id])
        }
        case 
3menu_mejoras(id)
        
//case 4: menu_party(id)
        
case 4..8menu_game(id)
    }
    
    return 
PLUGIN_HANDLED;
}

public 
Float:porciento_nivel(id)
{
    new 
Float:number

    number 
= ((g_frags[id] * 100.0) / next_level(g_level[id]))
    
    return 
number
}

public 
menu_lvls(id)
{
    new 
niveles[50], Posicion[10]
    new 
menu menu_create("\yLista de Niveles""lvls")
    
    for(new 
1MAX_LVL 1i++)
    {
        
formatex(nivelescharsmax(niveles), "\wNivel %d \d|%s Frags: %d"ig_level[id] >= "\y" "\r"next_level(i))
        
num_to_str(iPosicioncharsmax(Posicion))
        
menu_additem(menunivelesPosicion)
    }
    
    
menu_setprop(menuMPROP_BACKNAME"Anterior")
    
menu_setprop(menuMPROP_NEXTNAME"Siguiente")
    
menu_setprop(menuMPROP_EXITNAME"Salir del Menu")
    
    
menu_display(idmenu0)
    return 
PLUGIN_HANDLED;
}

public 
lvls(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64], accesscallback
    menu_item_getinfo
(menuitemaccessdata5iName63callback)
    
    switch(
str_to_num(data))
    {
        case 
0..MAX_LVLmenu_lvls(id)
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED
}

stock fm_strip_user_weapons(id)
{
    static 
ent
    ent 
engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"player_weaponstrip"))
    if (!
pev_valid(ent)) return;
    
    
dllfunc(DLLFunc_Spawnent)
    
dllfunc(DLLFunc_Useentid)
    
engfunc(EngFunc_RemoveEntityent)
}

public 
menu_mejoras(id)
{
    static 
menu[999], len
    len 
0

    len 
+= formatex(menu[len], sizeof menu len"\yMenu de mejoras^n^n\yTenes \w%d \ypuntos para gastar^n"g_puntos[id])
    
len += formatex(menu[len], sizeof menu len"\yGanaras tu proximo punto al matar en \rCARNAGE^n^n")

    if (
g_puntos_vida[id] >= MAX_VIDA)
        
len += formatex(menu[len], sizeof menu len"\r1.\d Aumentar vida (%d) (MAX) (\w%d%%\d)^n"g_puntos_vida[id], porciento_mejora(g_puntos_vida[id]))
    else
    {
        if (
g_puntos[id] >=  next_point(g_puntos_vida[id]))
            
len += formatex(menu[len], sizeof menu len"\r1.\w Aumentar vida \d(\y%d\d) \d(\y%d puntos\d) (\w%d%%\d)^n"g_puntos_vida[id], next_point(g_puntos_vida[id]), porciento_mejora(g_puntos_vida[id]))
        else
            
len += formatex(menu[len], sizeof menu len"\r1.\d Aumentar vida (%d) (\r%d puntos\d) (\w%d%%\d)^n"g_puntos_vida[id],  next_point(g_puntos_vida[id]), porciento_mejora(g_puntos_vida[id]))
    }

    if (
g_puntos_danio[id] >= MAX_DANIO)
        
len += formatex(menu[len], sizeof menu len"\r2.\d Aumentar danio (%d) (MAX) (\w%d%%\d)^n"g_puntos_danio[id], porciento_mejora(g_puntos_danio[id]))
    else
    {
        if (
g_puntos[id] >= next_point(g_puntos_danio[id]))
            
len += formatex(menu[len], sizeof menu len"\r2.\w Aumentar danio \d(\y%d\d) \d(\y%d puntos\d) (\w%d%%\d)^n"g_puntos_danio[id], next_point(g_puntos_danio[id]), porciento_mejora(g_puntos_danio[id]))
        else
            
len += formatex(menu[len], sizeof menu len"\r2.\d Aumentar danio (%d) (\r%d puntos\d) (\w%d%%\d)^n"g_puntos_danio[id], next_point(g_puntos_danio[id]), porciento_mejora(g_puntos_danio[id]))
    }


    
len += formatex(menu[len], sizeof menu len"^n\r8.%s Reestablecer mejoras^n"g_puntos_g[id] ? "\w" "\d")
    
len += formatex(menu[len], sizeof menu len"\r0.\w Salir del menu")

    
show_menu(idKEYSMENUmenu, -1"menu mejoras")
}

public 
mejoras(idkey)
{
    switch (
key)
    {
        case 
0:
        {
            if (
g_puntos_vida[id] >= MAX_VIDA)
            {
                
menu_mejoras(id)
                return 
PLUGIN_HANDLED;
            }

            if (
g_puntos[id] >=  next_point(g_puntos_vida[id]))
            {
                
g_puntos_g[id] += next_point(g_puntos_vida[id])
                
g_puntos[id] -= next_point(g_puntos_vida[id])
                
g_puntos_vida[id]++
                
menu_mejoras(id)
            }
            else
                
menu_mejoras(id)
        }
        case 
1:
        {
            if (
g_puntos_danio[id] >= MAX_DANIO)
            {
                
menu_mejoras(id)
                return 
PLUGIN_HANDLED;
            }

            if (
g_puntos[id] >= next_point(g_puntos_danio[id]))
            {
                
g_puntos_g[id] += next_point(g_puntos_danio[id])
                
g_puntos[id] -= next_point(g_puntos_danio[id])
                
g_puntos_danio[id]++
                
menu_mejoras(id)
            }
            else
                
menu_mejoras(id)
        }
        case 
2..6menu_mejoras(id)
        case 
7:
        {
            if (
g_puntos_g[id] > 0)
            {
                
g_puntos_danio[id] = 0
                g_puntos_vida
[id] = 0
                g_puntos
[id] += g_puntos_g[id]
                
g_puntos_g[id] = 0
                menu_mejoras
(id)
            }
            else
                
menu_mejoras(id)
        }
        case 
8menu_mejoras(id)
    }
    
    return 
PLUGIN_HANDLED;
}

mejora_vida(idbase)
{
    new 
total = (MAX_VIDA_M base) / 100

    total 
total MAX_VIDA
    
    total 
base total g_puntos_vida[id]
    
    return 
total
}

Float:mejora_danio(idFloat:base)
{
    new 
Float:total = (MAX_DANIO_M base) / 100.0

    total 
total MAX_DANIO
        
    total 
base + (total g_puntos_danio[id])

    return 
total
}

public 
menu_estadisticas(id)
{
    static 
menu[999], len
    len 
0

    
new horasminutos
    horas 
tiempo_jugado[id][HORAS]
    
minutos tiempo_jugado[id][MINUTOS]
    
    
len += formatex(menu[len], sizeof menu len"\yEstadisticas de jugador^n^n")

    
len += formatex(menu[len], sizeof menu len"\yAlias: \w%s^n"g_playername[id])
    
len += formatex(menu[len], sizeof menu len"\yFrags: \w%d \y(\w%d%%\y)^n"g_frags[id], floatround(porciento_nivel(id)))
    
len += formatex(menu[len], sizeof menu len"\yFrags para proximo nivel: \w%d^n"next_level(g_level[id])  - g_frags[id])
    
len += formatex(menu[len], sizeof menu len"\yCarnage-Frags: \w%d / 10^n"frags_carn[id])
    
len += formatex(menu[len], sizeof menu len"\yPuntos: \w%d^n"g_puntos[id])
    
len += formatex(menu[len], sizeof menu len"\yDanio: \w%d %d%% \yVida: \w%d %d%% ^n"g_puntos_danio[id], porciento_mdanio(id), g_puntos_vida[id], porciento_mvida(id))
    
len += formatex(menu[len], sizeof menu len"\yM. Knife: \w%d \yM. Laser: \w%d^n"g_matados[id][KNIFE], g_matados[id][LASER])
    
len += formatex(menu[len], sizeof menu len"\ySos miembro desde el \w%s %s^n"create_day[id], create_hour[id])
    
len += formatex(menu[len], sizeof menu len"\yJugaste durante \w%s%d horas %s%d minutis^n^n"horas "" "0"horasminutos "" "0"minutos)

    
len += formatex(menu[len], sizeof menu len"\r1.\w Lista de niveles^n")
    
len += formatex(menu[len], sizeof menu len"\r2.\w Lista de Top jugadores^n^n")

    
len += formatex(menu[len], sizeof menu len"\r0.\w Salir")

    
show_menu(idKEYSMENUmenu, -1"menu estadisticas")
}

public 
estadisticas(idkey)
{
        switch(
key)
        {
        case 
0menu_lvls(id)
        case 
1clcmd_top(id)
        }
    return 
PLUGIN_HANDLED
}

public 
clcmd_top(id)
{
    static 
szQuery[256], iData[1]
    
    
formatex(szQuery255"SELECT * FROM `mv_datos` ORDER BY `%s` DESC, `%s` DESC LIMIT %d"g_top_consulta[g_top[id]], g_top_consulta2[g_top[id]], MAX_TOP)

    
iData[0] = id
    SQL_ThreadQuery
(g_hTuple"menu_top"szQueryiData1)
    
    return 
PLUGIN_CONTINUE;
}

public 
menu_top(iFailStateHandle:hQueryszError[], iErroriData[], iDataSizeFloat:fQueueTime

    if(
iFailState == TQUERY_CONNECT_FAILED || iFailState == TQUERY_QUERY_FAILED
    { 
        
log_amx("%s"szError)
        return
    }
    else
    {
        new 
id iData[0]

        if(
SQL_NumResults(hQuery))
        {
            new 
menu[1750], lenweapmaxloopscuenta[33]
            
len 0
            
            maxloops 
min(WPN_TOPID+10SQL_NumResults(hQuery))
            
            
WPN_MAXTOP SQL_NumResults(hQuery)
            
            
len += formatex(menu[len], sizeof menu len"\yLista Top Jugadores^n^n")
            
            
weap WPN_TOPID
            
            
for(new 0;weap;i++)
                
SQL_NextRow(hQuery)
            
            while(
SQL_MoreResults(hQuery))
            {
                if(
weap maxloops)
                {
                    
SQL_ReadResult(hQuery0cuenta32)

                    
weap++
                        
                    
len += formatex(menu[len], sizeof menu len"\r%d.\y %s   \w%s: \r%d^n"weapcuentag_top_names[g_top[id]], SQL_ReadResult(hQueryg_top_columna[g_top[id]]))
                        
                    
SQL_NextRow(hQuery)
                }
                else
                    break;
            }
            
len += formatex(menu[len], sizeof menu len"^n\r7.\w Ordenar por \y[%s]^n^n", (g_top[id] > 2) ? (g_top_orden[0]) : (g_top_orden[(g_top[id])]))

            
len += formatex(menu[len], sizeof menu len"\r8.\w Anterior^n")
            
len += formatex(menu[len], sizeof menu len"\r9.\w Siguiente^n")
            
len += formatex(menu[len], sizeof menu len"\r0.\w Salir")
            
show_menu(idKEYSMENUmenu, -1"menu top")
        }
    }
    
    return
}

public 
top(idkey)
{
    switch(
key)
    {
        case 
6: (g_top[id] > 2) ? (g_top[id] = 0) : (g_top[id] += 1)
        case 
7: ((WPN_TOPID 10) < 0) ? (WPN_TOPID 0) : (WPN_TOPID -= 10)
        case 
8: ((WPN_TOPID 10) >= WPN_MAXTOP) ? (WPN_TOPID) : (WPN_TOPID += 10)
        case 
9: return PLUGIN_HANDLED
    
}
    
    
clcmd_top(id)
    
    return 
PLUGIN_HANDLED
}

public 
menu_party(id)
{
    static 
Menu[999], iLen
    iLen 
0

    iLen 
+= formatex(Menu[iLen], sizeof Menu iLen"\yMenu \rPARTY \d(BETA)^n^n")

    
iLen += formatex(Menu[iLen], sizeof Menu iLen"\d--------------------^n^n")
    
    if (
g_party[id])
    {
        for (new 
032i++)
            if ((
1<<i) & g_party[id])
                
iLen += formatex(Menu[iLen], sizeof Menu iLen"\r- \w%s^n"g_playername[i+1]);
    }
    else
    {
        
iLen += formatex(Menu[iLen], sizeof Menu iLen"\dNo estas en party^n");
    }

    
iLen += formatex(Menu[iLen], sizeof Menu iLen"^n\d--------------------^n^n")

    if (
g_party[id])
    {
        
iLen += formatex(Menu[iLen], sizeof Menu iLen"\r5.\w Invitar al Party^n")
        
iLen += formatex(Menu[iLen], sizeof Menu iLen"\r6.\w Salir del Party^n")
    }
    else
    {
        
iLen += formatex(Menu[iLen], sizeof Menu iLen"\r5.\w Crear Party^n")
    }

    
show_menu(idKEYSMENUMenu, -1"menu party")
}

public 
party(idkey)
{
    switch (
key)
    {
        case 
0..3menu_party(id)
        case 
4form_party(id)
        case 
5:
        {
            if (
g_party[id])
                
remove_from_team(id)
        }
        case 
6..8menu_party(id)
        case 
9: return PLUGIN_HANDLED
    
}

    return 
PLUGIN_HANDLED
}

public 
form_party(id)
{
    new 
targetbody
    get_user_aiming
(idtargetbody)

    if (
is_user_connected(target))
    {
        if (
g_party[target])
        {
            
client_print(idprint_center"%s ya esta en party"g_playername[target])
        }
        else
        {
            
client_print(idprint_center"Has invitado a %s"g_playername[target])
            
add_to_team(idtarget)
        }
    }
    else
    {
        
client_print(idprint_center"No estas apuntando a nadie")
    }
    
    
menu_party(id)
}

add_to_team(idplayer)
{
    new 
buffer[64];
    
format(buffercharsmax(buffer), "PARTY: Invitacion de %s"g_playername[id]);
    new 
menu menu_create(buffer"confirm_handle");
    new 
tinybuff[3];
    
tinybuff[0] = 1;
    
tinybuff[1] = id;
    
tinybuff[2] = 0

    
menu_additem(menu"Aceptar"tinybuff);

    
tinybuff[2] = 1;
    
menu_additem(menu"Cancelar"tinybuff);

    
menu_display(playermenu0);
}

public 
remove_from_team(id)
{
    new 
menu menu_create("PARTY: Salir del party ?""confirm_handle");
    new 
tinybuff[3];
    
tinybuff[0] = 0;
    
tinybuff[1] = id;

    
tinybuff[2] = 0
    
menu_additem(menu"Aceptar"tinybuff);

    
tinybuff[2] = 1;
    
menu_additem(menu"Cancelar"tinybuff);

    
menu_display(idmenu0);
}

public 
confirm_handle(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    new 
data[4];
    new 
accesscallbackkeyteam;
    
menu_item_getinfo(menuitemaccessdatacharsmax(data), __callback);

    
team data[1];
    
key data[2];
 
    if (
data[0] == 1)
    {  
        if (
key == 0)
        {  
            new 
lineup g_party[team];
            
lineup |= (1<<(id-1));

            for(new 
032i++)
            {
                if ((
1<<i) & lineup)
                {
                    
g_party[i+1] = lineup;

                    if (
g_party[i+1] == 1)
                        
menu_confirm(team)
                }
            }
        }
        else  
client_print(teamprint_center"%s Cancelo la invitacion"g_playername[id]);
    }
    else
    {
        if (
key == 0)
            
remove_team(id);
    }
 
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}

menu_confirm(id)
{
    new 
Name[33], menu[128], menuid
    get_user_name
(idName 32)
    
    
formatex(menucharsmax(menu), "PARTY: ah sido creado")
    
menuid menu_create(menu"confirmt")
    
    
formatex(menucharsmax(menu), "\yContinuar")
    
menu_additem(menuidmenu"7")
    
    
menu_display(idmenuid)
}

remove_team(id)
{
    new 
lineup g_party[id];
    
g_party[id] = 0;

    
lineup &= ~(1<<(id-1));
   
    for(new 
032i++)
        if ((
1<<i) & lineup)
            
g_party[i+1] = lineup;
}

bit_total(value)
{
    static 
totalitotal 0;
    for (
032i++)
        if ((
1<<i) & valuetotal++;

    return 
total;
}

public 
Float:porciento_party(id)
{
    new 
Float:number

    number 
= (100.0 bit_total(g_party[id]))
    
    return 
number
}

porciento_mvida(id)
{
    return 
g_puntos_vida[id] * MAX_VIDA_M MAX_VIDA
}

porciento_mdanio(id)
{
    return 
g_puntos_danio[id] * MAX_DANIO_M MAX_DANIO

Si alguien me puede tirar una mano, sería de gran ayuda

Last edited by Juli.Cs; 03-27-2012 at 21:43.
Juli.Cs is offline
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 03-27-2012 , 20:37   Re: Crear Base De Datos
#2

es Base de datos
__________________

www.amxmodx-es.com

Steam: Luchokoldo
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
Geoslide
Senior Member
Join Date: Jun 2011
Location: Chilean player
Old 03-27-2012 , 21:01   Re: Crear Base De Datos
#3

1. Sabes que tienes que tener un hosting ?

2. El plugin no le veo problema, si dices que no te funciona (despues de crear el db con las caracteristicas que defines en el plugin) algo debiste hacer mal ?, seguiste algun tutorial sobre esto ?

3. En este foro se encierran los codigos en las etiquetas [*PHP] Copia y pega tu codigo entre estas etiquetas sin el * [*/PHP]

Ejemplo :

PHP Code:
public plugin_init( ) { // Aqui acabo de encerrar mi codigo entre las etiquetas 
4. Si es " un " codigo el que posteas, lo mencionamos singularmente osea " plugin ", ahora ya sea mas de un codigo el que quieres postear lo mencionamos pluralmente osea " plugins "

PD: Porque te explique todo esto ?

Porque en este foro hay reglas las cuales se siguen al pie de la letra. ¿ Porque no te deje el link ?

Porque mucha gente no quiere perder 5 miserables minutos de su vida leyendo minimo un parrafo.

Disculpa mi exageración pero es la verdad ...

Si quieres leer las reglas aqui están.

http://forums.alliedmods.net/showthread.php?t=149597

Salúdos.
__________________
Basebuilder V6 - plugin for sale
Jailbreak V6 - plugin for sale
more plugins in progress ...

Geoslide ?

Last edited by Geoslide; 03-27-2012 at 21:04.
Geoslide is offline
Juli.Cs
Junior Member
Join Date: Aug 2008
Old 03-27-2012 , 21:44   Re: Crear Base De Datos
#4

a listo, pero el tema, tengo el hosting, pero no se crear las base de datos, y no se como hacerlos, me podrían ayudar?
Juli.Cs is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 03-28-2012 , 11:46   Re: Crear Base De Datos
#5

Si el problema es crear la base de datos, el tema va en offtopic. Y otra cosa es code está MUY buguiado, te digo porque lo probé hace tiempo y lo tire a la mierda y hice uno desde 0.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Old 04-01-2012, 22:07
capozblack
This message has been deleted by lucas_7_94. Reason: Pagar por conectar a una base de datos? No way.
 



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 11:53.


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