Shop HNS
#1
Hola gente necesitaria q me ayuden a hacer un shop para el hns.. q se puede comprar un item por ronda, quisiera q tenga:

Granada 1000 $
Gravedad (15 segundos) 5000 $
Velocidad (15 segundos) 7000 $
Pasos silenciosos (15 segundos) $ 8000
Vida (50 hp) 9000 $
Pack de granadas 10000 $
Deagle (1 bala) 12000 $
Respawn/Revivir 13000 $
Inmunidad (15 segundos) 14000 $
Awp (1 bala) 15000 $

La verdad q nose como hacerlo! asique si me puede ayudar seria genial, saludos!
Responder
#2
Código PHP:
#include <amxmodx>
#include <fakemeta>

#pragma semicolon 1

/* Hide'n'Seek Shop 
 *    by xPaw & Grim
 * 
 *  Credits:
 *    Grim - for original code/Godmode Key actviation - added pcvars
 *    Ven  - His tutorial for Player Spawn
 */

#define VERSION "2.0"

#define fm_get_user_money(%1)    get_pdata_int( %1, 115 )
#define fm_create_entity(%1)    engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))

#define MAX_CLIENTS 32

enum Color {
    
NORMAL 1,    // clients scr_concolor cvar color
    
GREEN,        // Green
    
TEAM_COLOR,    // Red, grey, blue
    
GREY,        // grey
    
RED,        // Red
    
BLUE,        // Blue
};

new 
TeamName[][] = {
    
"",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
};
    

// Pcvars
new plugin_onsilentcoststealthcostnoflashcosthpcostarmorcostgrenadecostgravitycostspeedcostgodmodecost;
new 
allowsilentallowstealthallownoflashallowhpallowarmorallowgrenadeallowgravityallowspeedallowgodmode;
new 
usersilent[33], userstealth[33], usernoflash[33], userhp[33], userarmor[33], usergrenade[33], usergravity[33], userspeed[33];
new 
hpcvararmorcvarmenuhasspeed[33], hassilent[33], gotgodmode[33], hasgodmode[33], mess[33], mess2[33];
new 
g_msgScreenFadeg_msgMoneygrenade[32], last;

new 
Float:g_gametimeg_owner;
new 
Float:g_gametime2;

new 
bool:g_bPlayerNonSpawnEvent[MAX_CLIENTS 1];
new 
bool:g_track_enemy;
new 
bool:g_track[33];

new 
g_iFwFmClientCommandPost;
new 
g_sync_check_data;

public 
plugin_init() {
    
register_plugin("HnS Shop"VERSION"xPaw & Grim");
    
register_cvar("hns_shop_version"VERSIONFCVAR_SERVER);
    
set_cvar_string("hns_shop_version"VERSION);

    
// Player Spawn
    
register_event("ResetHUD""fwEvResetHUD""b");
    
register_event("TextMsg""fwEvGameWillRestartIn""a""2=#Game_will_restart_in");
    
register_clcmd("fullupdate""fwCmdClFullupdate");

    
// Events
    
register_event("DeathMsg""eDeath""a");
    
register_event("CurWeapon""speed_on""be");
    
register_event("ScreenFade""eventFlash""be""4=255""5=255""6=255""7>199");
    
register_event("TextMsg""fire_in_the_hole""b""2&#Game_radio""4&#Fire_in_the_hole");
    
register_event("TextMsg""fire_in_the_hole2""b""3&#Game_radio""5&#Fire_in_the_hole");
    
register_event("99""grenade_throw""b");

    
// Pcvars
    
plugin_on    register_cvar("hns_shop""1");
    
silentcost    register_cvar("hns_shop_silentcost",        "4500");
    
stealthcost    register_cvar("hns_shop_stealthcost",        "9500");
    
noflashcost    register_cvar("hns_shop_noflashcost",        "8000");
    
grenadecost    register_cvar("hns_shop_grenadecost",        "1500");
    
gravitycost    register_cvar("hns_shop_gravitycost",        "13000");
    
speedcost    register_cvar("hns_shop_speedcost",        "7000");
    
hpcost        register_cvar("hns_shop_hpcost",        "8000");
    
armorcost    register_cvar("hns_shop_armorcost",        "6000");
    
godmodecost    register_cvar("hns_shop_godmodecost",        "16000");
    
hpcvar        register_cvar("hns_shop_hpcvar",        "150");
    
armorcvar    register_cvar("hns_shop_armorcvar",        "150");
    
allowsilent    register_cvar("hns_shop_allowsilent",        "1");
    
allowstealth    register_cvar("hns_shop_allowstealth",    "1");
    
allownoflash    register_cvar("hns_shop_allownoflash",    "1");
    
allowgrenade    register_cvar("hns_shop_allowgrenade",    "1");
    
allowgravity    register_cvar("hns_shop_allowgravity",    "1");
    
allowspeed    register_cvar("hns_shop_allowspeed",        "1");
    
allowhp        register_cvar("hns_shop_allowhp",        "1");
    
allowarmor    register_cvar("hns_shop_allowarmor",        "1");
    
allowgodmode    register_cvar("hns_shop_allowgodmode",    "1");

    
// Clcmds
    
register_clcmd("say /hnsshop",    "show_hnsmenu");
    
register_clcmd("say /shop",    "show_hnsmenu");
    
register_clcmd("say hnsshop",    "show_hnsmenu");
    
register_clcmd("say shop",    "show_hnsmenu");

    
// Menu
    
menu register_menuid("Hide'n'Seek Shop");
    
register_menucmd(menu1023"hnsshop");
    
    
// Forwards
    
register_forward(FM_EmitSound,"fw_emitsound"); 
    
register_forward(FM_CmdStart"fwd_FM_CmdStart_pre"0);
    

    
// Tasks
    
set_task2.0"bad_fix2",_,_,_"b" );
    
set_task100.0"advert",_,_,_"b" );
    
    
g_msgScreenFade get_user_msgid("ScreenFade");
    
g_msgMoney get_user_msgid("Money");
}

public 
client_connectid ) {
    
usersilent[id]    = 0;
    
userstealth[id]    = 0;
    
usernoflash[id]    = 0;
    
userhp[id]    = 0;
    
userarmor[id]    = 0;
    
usergrenade[id]    = 0;
    
usergravity[id]    = 0;
    
userspeed[id]    = 0;
    
gotgodmode[id]    = 0;
    
hasgodmode[id]    = 0;
    
hasspeed[id]    = 0;
    
hassilent[id]    = 0;
    
mess[id]    = 0;
    
mess2[id]    = 0;
}

public 
client_disconnectid ) {
    
usersilent[id]    = 0;
    
userstealth[id]    = 0;
    
usernoflash[id]    = 0;
    
userhp[id]    = 0;
    
userarmor[id]    = 0;
    
usergrenade[id]    = 0;
    
usergravity[id]    = 0;
    
userspeed[id]    = 0;
    
gotgodmode[id]    = 0;
    
hasgodmode[id]    = 0;
    
hasspeed[id]    = 0;
    
hassilent[id]    = 0;
    
mess[id]    = 0;
    
mess2[id]    = 0;


public 
speed_onid )
    if(
is_user_alive(id))
        if(
hasspeed[id])
            
fm_set_user_maxspeed(id320.0);

// Advert
public advert() {
    new 
g_Maxplayers;
    
g_Maxplayers get_maxplayers();
    
    for(new 
i=1i<=g_Maxplayersi++)
        if(
is_user_connected(i))
            
ColorChat(iRED"^x01[AMXX]^x04 Este server ocupa^x03 Escondidas shop^x04, para abrir^x03 /shop^x04 o^x03 shop");
}

public 
fwd_FM_CmdStart_preiduc_handlerandom_seed ) {
        if(!
is_user_alive(id))
            return 
FMRES_IGNORED;
    
        if(
hassilent[id] > 0)
            
set_pev(idpev_flTimeStepSound999);

        static 
button;
        
button get_uc(uc_handleUC_Buttons);
        if(
button IN_RELOAD) {
            if(
get_pcvar_num(allowgodmode) == 1)
                return 
FMRES_IGNORED;
            
            if(!
gotgodmode[id]) {    
                if(!
mess[id]) {
                    
ColorChat(idRED"^x04[Shop]^x01 Necesitas comprar godmode primero");
                    
mess[id]++;
                    
set_task(3.0"remove_mess"id);
                    return 
FMRES_IGNORED;
                }
                return 
FMRES_IGNORED;
            }
            
            if(
hasgodmode[id] > 0) {
                if(!
mess[id]) {
                    
ColorChat(idRED"^x04[Shop]^x01 Tu godmode se a activado!");
                    
mess[id]++;
                    
set_task(3.0"remove_mess"id);
                    return 
FMRES_IGNORED;
                }
                return 
FMRES_IGNORED;
            }
        
            
gotgodmode[id] = 0;
            
hasgodmode[id]++;
            
fm_set_user_godmode(id1);
            if(
get_user_team(id) == 1)
                
fm_set_user_rendering(idkRenderFxGlowShell25500kRenderTransAlpha255);
            else if(
get_user_team(id) == 2)
                
fm_set_user_rendering(idkRenderFxGlowShell00255kRenderTransAlpha255);
            
            
set_task(5.0"remove_godmode"id);
        
            if(!
mess[id]) {
                
ColorChat(idRED"^x04[Shop]^x01 Tu godmode se activo");
                
mess[id]++;
                
set_task(3.0"remove_mess"id);
            } 
            return 
FMRES_SUPERCEDE;
        } 
        return 
FMRES_IGNORED;
}


// User Spawn event
public fwEvResetHUDid ) {
        if (!
is_user_alive(id))
                return;
 
        if (
g_bPlayerNonSpawnEvent[id]) {
                
g_bPlayerNonSpawnEvent[id] = false;
                return;
        }
 
        
fwPlayerSpawn(id);
}
 
public 
fwEvGameWillRestartIn() {
        static 
iPlayers[32], iPlayersNumi;
        
get_players(iPlayersiPlayersNum"a");
        for (
0iPlayersNum; ++i)
                
g_bPlayerNonSpawnEvent[iPlayers[i]] = true;
}
 
public 
fwCmdClFullupdateid ) {
        
g_bPlayerNonSpawnEvent[id] = true;
        static const 
szFwFmClientCommandPost[] = "fwFmClientCommandPost";
        
g_iFwFmClientCommandPost register_forward(FM_ClientCommandszFwFmClientCommandPost1);
        return 
PLUGIN_CONTINUE;
}
 
public 
fwFmClientCommandPostid ) {
        
unregister_forward(FM_ClientCommandg_iFwFmClientCommandPost1);
        
g_bPlayerNonSpawnEvent[id] = false;
        return 
FMRES_HANDLED;
}
 
public 
fwPlayerSpawnid ) {
    if(!
is_user_alive(id))
        return 
PLUGIN_HANDLED;
    
    if(
get_pcvar_num(plugin_on) == 1) {
        
set_pev(idpev_flTimeStepSound400);
        
fm_set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha255);
        
fm_set_user_health(id100);
        
fm_set_user_armor(id0);
        
fm_set_user_gravity(id1.0);
        
usersilent[id]    = 0;
        
userstealth[id]    = 0;
        
usernoflash[id]    = 0;
        
userhp[id]    = 0;
        
userarmor[id]    = 0;
        
usergrenade[id]    = 0;
        
usergravity[id]    = 0;
        
userspeed[id]    = 0;
        
hassilent[id]    = 0;
    }
    return 
PLUGIN_HANDLED;
}  

// User Death event
public eDeathid ) {
    new 
victem read_data(2);
        
    
usersilent[victem]    = 0;
    
userstealth[victem]    = 0;
    
usernoflash[victem]    = 0;
    
userhp[victem]        = 0;
    
userarmor[victem]    = 0;
    
usergrenade[victem]    = 0
    
usergravity[victem]    = 0;
    
userspeed[victem]    = 0;
    
hasspeed[victem]    = 0;
    
hasgodmode[victem]    = 0;
    
hassilent[victem]    = 0;
}

// Showing menu
public show_hnsmenuid ) {
    if(
get_pcvar_num(plugin_on) == 1) {
        new 
szBuffer[512], iLen;

        
iLen formatex(szBuffersizeof szBuffer 1"\rMenu de tienda \w^n^n");
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r1. \wPasos sicenciosos - \y%d$^n"get_pcvar_num(silentcost));
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r2. \gInvisible \r(20 seconds) - \y%d$^n"get_pcvar_num(stealthcost));
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r3. \wAnti flashbang(PARA CT) - \y%d$^n"get_pcvar_num(noflashcost));
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r4. \g%d VIDA - \y%d$^n"get_pcvar_num(hpcvar), get_pcvar_num(hpcost));
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r5. \w%d ACHALECO - \y%d$^n"get_pcvar_num(armorcvar), get_pcvar_num(armorcost));
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r6. \gBOMBA - \y%d$^n"get_pcvar_num(grenadecost));
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r7. \wGravedad \r(10 seconds) - \y%d$^n"get_pcvar_num(gravitycost));   
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r8. \gSuper velocidad \r(25 seconds) - \y%d$^n"get_pcvar_num(speedcost));
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r9. \wModo Dios \d(key activation) \r(5 seconds) - \y%d$^n^n"get_pcvar_num(godmodecost));
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r0. \rSalir"); 

        new 
iKeys = ( 1<<1<<1<<1<<1<<1<<1<<1<<1<< 1<<);
        
show_menu(idiKeysszBuffer, -1"Hide'n'Seek Shop");
    } else
        
ColorChat(idBLUE"^x04[Shop]^x01 Shop se desactivo por GAY.");
    return 
PLUGIN_HANDLED;
}

// Shop actions
public hnsshopidkey ) {
    switch( 
key ) {
        case 
0// Silent Footsteps
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED;  
            }
            if(
usersilent[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allowsilent) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
    
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(silentcost);
    
            if(
money cost || money == cost) {
                
set_pev(idpev_flTimeStepSound999);
                
fm_set_user_money(idmoney cost);
                
usersilent[id]++;
                
hassilent[id]++;
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted compro^x03 Pasos Silenciosos,^x04 El enemigo no lo oye.");
            } else {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto");
            }
        }
        case 
1// Stealth Suit
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED;
            }
            if(
userstealth[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allowstealth) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
    
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(stealthcost);
    
            if(
money cost || money == cost) {
                
fm_set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha15);
                
fm_set_user_money(idmoney cost);
                
userstealth[id]++;
                
set_task(20.0"remove_stealth"id);
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted compro^x03 Invisible,^x04 Ahora eres invisible por 20segundos "),
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto ");
            }
        }
        case 
2// NoFlash Blinding
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED;
            }
            if(
usernoflash[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allownoflash) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
    
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(noflashcost);
    
            if(
money cost || money == cost) {
                
fm_set_user_money(idmoney cost);
                
usernoflash[id]++;
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted compro^x03 Anti flashbang .");
            } else {  
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto ");
            } 
        }
        case 
3// HP
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED;
            }
            if(
userhp[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allowhp) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
    
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(hpcost);
    
            if(
money cost || money == cost) {
                new 
health get_pcvar_num(hpcvar);
                
fm_set_user_money(idmoney cost);
                
fm_set_user_health(idhealth);
                
userhp[id]++;
                
client_cmd(id"spk items/medshot4");
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted compro^x03 %d de vida."get_pcvar_num(hpcvar));
            } else {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto ");
            }
        }
        case 
4// Armor
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED;
            }
            if(
userarmor[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allowarmor) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
    
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(armorcost);
        
            if(
money cost || money == cost) {
                new 
armor get_pcvar_num(armorcvar);
                
fm_set_user_money(idmoney cost);
                
fm_set_user_armor(idarmor);
                
userarmor[id]++;
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted comprox03 %d de chaleco."get_pcvar_num(armorcvar));
            } else {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto ");
            }
        }
        case 
5// HE Grenade
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED;
            }
            if(
usergrenade[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allowgrenade) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
    
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(grenadecost);
    
            if(
money cost || money == cost) {
                
fm_set_user_money(idmoney cost);
                
fm_give_item(id"weapon_hegrenade");
                
usergrenade[id]++;
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted compro una^x03 BOMBA");
            } else {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto ");
            }
        }
        case 
6// Gravity
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED;
            }
            if(
usergravity[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allowgravity) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
    
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(gravitycost);
        
            if(
money cost || money == cost) {
                
fm_set_user_money(idmoney cost);
                
fm_set_user_gravity(id0.63);
                
usergravity[id]++;
                
set_task(10.0"remove_gravity"id);
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted compro^x03 Gravedad^x04 por 10 segundos");
            } else {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto ");
            }
        }
        case 
7// Faster Speed
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED
            }
            if(
userspeed[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allowspeed) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
    
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(speedcost);
    
            if(
money cost || money == cost) {
                
fm_set_user_money(idmoney cost);
                
userspeed[id]++;
                
hasspeed[id]++;
                
fm_set_user_maxspeed(id320.0);
                
set_task(25.0"remove_speed"id);
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted compro^x03 Super velocidad.");
            } else {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto ");
            }
        }
        case 
8// Godmode
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED
            }
            if(
gotgodmode[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allowgodmode) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
        
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(godmodecost);
         
            if(
money cost || money == cost) {
                
gotgodmode[id]++;
                
fm_set_user_money(idmoney cost);
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted compro^x03 Modo dios,^x04 aprete R^x01 Para activar.");
            } else {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto ");
            }
        }
        case 
9// Exit
            
return PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;
}

// Remove Gravity
public remove_gravityid ) {
    
fm_set_user_gravity(id1.0);
    
ColorChat(idBLUE"^x04[Shop]^x01 Su gravedad es normal");
}  

// Remove Stealth
public remove_stealthid ) {
    
fm_set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha255);
    
ColorChat(idBLUE"^x04[Shop]^x01 Usted esta^x03 visible^x01 como otros.");
}

// Remove Speed
public remove_speedid ) {
    
fm_set_user_maxspeed(id250.0);
    
hasspeed[id] = 0;
    
ColorChat(idBLUE"^x04[Shop]^x01 Su velocidad es normal.");
}

// Remove Godmode
public remove_godmodeid ) {
    
hasgodmode[id] = 0;
    
fm_set_user_godmode(id0);
    if(!
mess2[id]) {
        
ColorChat(idRED"^x04[Shop]^x01 Usted ya no tiene ms modo dios.");
        
mess2[id]++;
        
fm_set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha255);
        
set_task(3.0"remove_mess2"id);
    }
}

public 
remove_messid )        mess[id]    = 0;
public 
remove_mess2id )    mess2[id]    = 0;

/// NoFlash Blinding - Start
public bad_fix2() {
    new 
Float:gametime get_gametime();
    if(
gametime g_gametime2 2.5)
        for(new 
032i++)
            
grenade[i] = 0;
}

public 
eventFlashid ) {
    new 
Float:gametime get_gametime();
    if(
gametime != g_gametime) { 
        
g_owner get_grenade_owner();
        
g_gametime gametime;
        for(new 
033i++) 
            
g_track[i] = false;
        
g_track_enemy false;
    }    
    if(
is_user_connected(g_owner) && usernoflash[id] > 0) {
        
g_track_enemy true;

        
message_begin(MSG_ONEg_msgScreenFade, {0,0,0}, id);
        
write_short(1);
        
write_short(1);
        
write_short(1);
        
write_byte(0);
        
write_byte(0);
        
write_byte(0);
        
write_byte(255);
        
message_end();
    }
}

public 
flash_delay() {
    if(
g_track_enemy == false) {
        for(new 
033i++) {
            if(
g_track[i] == true && is_user_connected(i)) {
                
message_begin(MSG_ONEg_msgScreenFade, {0,0,0}, i) ;
                
write_short(1);
                
write_short(1);
                
write_short(1);
                
write_byte(0);
                
write_byte(0);
                
write_byte(0);
                
write_byte(255);
                
message_end();
            }
        }
    }
}

public 
grenade_throw() {
    if(
g_sync_check_data == 0)
        return 
PLUGIN_CONTINUE;
    
g_sync_check_data--;
    if(
read_datanum() < 2)
        return 
PLUGIN_HANDLED_MAIN;

    if(
read_data(1) == 11 && (read_data(2) == || read_data(2) == 1))
        
add_grenade_owner(last);

    return 
PLUGIN_CONTINUE;
}

public 
fire_in_the_hole() {
    new 
name[32];
    
read_data(3name31);
    new 
temp_last get_user_index(name);
    new 
junk;
    if((
temp_last == 0) || (!is_user_connected(temp_last)))
        return 
PLUGIN_CONTINUE;
    if(
get_user_weapon(temp_last,junk,junk) == CSW_FLASHBANG) {
        
last temp_last;
        
g_sync_check_data 2
    }
    return 
PLUGIN_CONTINUE;
}

public 
fire_in_the_hole2() {
    new 
name[32];
    
read_data(4name31);
    new 
temp_last get_user_index(name);
    new 
junk;
    if((
temp_last == 0) || (!is_user_connected(temp_last)))
        return 
PLUGIN_CONTINUE;
    if(
get_user_weapon(temp_last,junk,junk) == CSW_FLASHBANG) {    
        
last temp_last;
        
g_sync_check_data 2;
    }
    return 
PLUGIN_CONTINUE;
}

add_grenade_owner(owner) {
    new 
Float:gametime get_gametime();
    
g_gametime2 gametime;
    for(new 
032i++) {
        if(
grenade[i] == 0) {
            
grenade[i] = owner;
            return;
        }
    }
}

get_grenade_owner() {
    new 
which grenade[0];
    for(new 
132i++)  
        
grenade[i-1] = grenade[i];
    
grenade[31] = 0;
    return 
which;
}

// from XxAvalanchexX "Flashbang Dynamic Light"
public fw_emitsound(entity,channel,const sample[],Float:volume,Float:attenuation,fFlags,pitch) {
    if(!
equali(sample,"weapons/flashbang-1.wav") && !equali(sample,"weapons/flashbang-2.wav"))
        return 
FMRES_IGNORED;

    new 
Float:gametime get_gametime();

    
//in case no one got flashed, the sound happens after all the flashes, same game time
    
if(gametime != g_gametime) {
        
g_owner get_grenade_owner();
        return 
FMRES_IGNORED;
    }
    return 
FMRES_IGNORED;
}
// NoFlash Blinding - End 

// Stocks - Start
public fm_set_user_money indexi_Money ) { 
    
set_pdata_int index115i_Money ); 

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

stock fm_get_user_godmodeindex ) {
    new 
Float:val;
    
pev(indexpev_takedamageval);

    return (
val == DAMAGE_NO);
}

stock fm_set_user_godmodeindexgodmode ) {
    
set_pev(indexpev_takedamagegodmode == DAMAGE_NO DAMAGE_AIM);

    return 
1;
}

stock fm_set_user_healthindexhealth ) {
    
health set_pev(indexpev_healthfloat(health)) : dllfunc(DLLFunc_ClientKillindex);

    return 
1;
}

stock fm_set_user_rendering(indexfx kRenderFxNone255255255render kRenderNormalamount 16) {
    return 
fm_set_rendering(indexfxrgbrenderamount);
}

stock fm_set_user_maxspeedindexFloat:speed = -1.0 ) {
    
engfunc(EngFunc_SetClientMaxspeedindexspeed);
    
set_pev(indexpev_maxspeedspeed);

    return 
1;
}

stock fm_set_user_armorindexarmor ) {
    
set_pev(indexpev_armorvaluefloat(armor));

    return 
1;
}

stock fm_set_user_gravityindexFloat:gravity 1.0 ) {
    
set_pev(indexpev_gravitygravity);

    return 
1;
}

stock fm_give_itemindex, const item[] ) {
    if (!
equal(item"weapon_"7) && !equal(item"ammo_"5) && !equal(item"item_"5))
        return 
0;

    new 
ent fm_create_entity(item);
    if (!
pev_valid(ent))
        return 
0;

    new 
Float:origin[3];
    
pev(indexpev_originorigin);
    
set_pev(entpev_originorigin);
    
set_pev(entpev_spawnflagspev(entpev_spawnflags) | SF_NORESPAWN);
    
dllfunc(DLLFunc_Spawnent);

    new 
save pev(entpev_solid);
    
dllfunc(DLLFunc_Touchentindex);
    if (
pev(entpev_solid) != save)
        return 
ent;

    
engfunc(EngFunc_RemoveEntityent);

    return -
1;
}

stock fm_set_rendering(entityfx kRenderFxNone255255255render kRenderNormalamount 16) {
    new 
Float:RenderColor[3];
    
RenderColor[0] = float(r);
    
RenderColor[1] = float(g);
    
RenderColor[2] = float(b);

    
set_pev(entitypev_renderfxfx);
    
set_pev(entitypev_rendercolorRenderColor);
    
set_pev(entitypev_rendermoderender);
    
set_pev(entitypev_renderamtfloat(amount));

    return 
1;
}
// Stocks - End

// ColorChat - Start
ColorChat(idColor:type, const msg[], {Float,Sql,Result,_}:...) {
    new 
message[256];

    switch(
type) {
        case 
NORMAL:    message[0] = 0x01;
        case 
GREEN:    message[0] = 0x04;
        default:    
message[0] = 0x03;
    }

    
vformat(message[1], 251msg4);

    
// Make sure message is not longer than 192 character. Will crash the server.
    
message[192] = '^0';

    new 
teamColorChangeindexMSG_Type;
    
    if(
id) {
        
MSG_Type MSG_ONE;
        
index id;
    } else {
        
index FindPlayer();
        
MSG_Type MSG_ALL;
    }
    
    
team get_user_team(index);
    
ColorChange ColorSelection(indexMSG_Typetype);

    
ShowColorMessage(indexMSG_Typemessage);
        
    if(
ColorChange)
        
Team_Info(indexMSG_TypeTeamName[team]);
}

ShowColorMessage(idtypemessage[]) {
    static 
bool:saytext_used;
    static 
get_user_msgid_saytext;
    if(!
saytext_used) {
        
get_user_msgid_saytext get_user_msgid("SayText");
        
saytext_used true;
    }
    
message_begin(typeget_user_msgid_saytext_id);
    
write_byte(id);
    
write_string(message);
    
message_end();    
}

Team_Info(idtypeteam[]) {
    static 
bool:teaminfo_used;
    static 
get_user_msgid_teaminfo;
    if(!
teaminfo_used) {
        
get_user_msgid_teaminfo get_user_msgid("TeamInfo");
        
teaminfo_used true;
    }
    
message_begin(typeget_user_msgid_teaminfo_id);
    
write_byte(id);
    
write_string(team);
    
message_end();

    return 
1;
}

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

    return 
0;
}

FindPlayer(){
    new 
= -1;

    while(
<= get_maxplayers())
        if(
is_user_connected(++i))
            return 
i;
    
    return -
1;

Rainbow PD : Si Necesitas Mas Ayuda Escribeme [MP]
Responder
#3
Te recomiendo esto
Saludos
cLi;^

c++ [5%]
@2007

Responder
#4
Código PHP:
#include <amxmodx>
#include <fakemeta>

#pragma semicolon 1

/* Hide'n'Seek Shop 
 *    by xPaw & Grim
 * 
 *  Credits:
 *    Grim - for original code/Godmode Key actviation - added pcvars
 *    Ven  - His tutorial for Player Spawn
 */

#define VERSION "2.0"

#define fm_get_user_money(%1)    get_pdata_int( %1, 115 )
#define fm_create_entity(%1)    engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))

#define MAX_CLIENTS 32

enum Color {
    
NORMAL 1,    // clients scr_concolor cvar color
    
GREEN,        // Green
    
TEAM_COLOR,    // Red, grey, blue
    
GREY,        // grey
    
RED,        // Red
    
BLUE,        // Blue
};

new 
TeamName[][] = {
    
"",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
};
    

// Pcvars
new plugin_onsilentcoststealthcostnoflashcosthpcostarmorcostgrenadecostgravitycostspeedcostgodmodecost;
new 
allowsilentallowstealthallownoflashallowhpallowarmorallowgrenadeallowgravityallowspeedallowgodmode;
new 
usersilent[33], userstealth[33], usernoflash[33], userhp[33], userarmor[33], usergrenade[33], usergravity[33], userspeed[33];
new 
hpcvararmorcvarmenuhasspeed[33], hassilent[33], gotgodmode[33], hasgodmode[33], mess[33], mess2[33];
new 
g_msgScreenFadeg_msgMoneygrenade[32], last;

new 
Float:g_gametimeg_owner;
new 
Float:g_gametime2;

new 
bool:g_bPlayerNonSpawnEvent[MAX_CLIENTS 1];
new 
bool:g_track_enemy;
new 
bool:g_track[33];

new 
g_iFwFmClientCommandPost;
new 
g_sync_check_data;

public 
plugin_init() {
    
register_plugin("HnS Shop"VERSION"xPaw & Grim");
    
register_cvar("hns_shop_version"VERSIONFCVAR_SERVER);
    
set_cvar_string("hns_shop_version"VERSION);

    
// Player Spawn
    
register_event("ResetHUD""fwEvResetHUD""b");
    
register_event("TextMsg""fwEvGameWillRestartIn""a""2=#Game_will_restart_in");
    
register_clcmd("fullupdate""fwCmdClFullupdate");

    
// Events
    
register_event("DeathMsg""eDeath""a");
    
register_event("CurWeapon""speed_on""be");
    
register_event("ScreenFade""eventFlash""be""4=255""5=255""6=255""7>199");
    
register_event("TextMsg""fire_in_the_hole""b""2&#Game_radio""4&#Fire_in_the_hole");
    
register_event("TextMsg""fire_in_the_hole2""b""3&#Game_radio""5&#Fire_in_the_hole");
    
register_event("99""grenade_throw""b");

    
// Pcvars
    
plugin_on    register_cvar("hns_shop""1");
    
silentcost    register_cvar("hns_shop_silentcost",        "4500");
    
stealthcost    register_cvar("hns_shop_stealthcost",        "9500");
    
noflashcost    register_cvar("hns_shop_noflashcost",        "8000");
    
grenadecost    register_cvar("hns_shop_grenadecost",        "1500");
    
gravitycost    register_cvar("hns_shop_gravitycost",        "13000");
    
speedcost    register_cvar("hns_shop_speedcost",        "7000");
    
hpcost        register_cvar("hns_shop_hpcost",        "8000");
    
armorcost    register_cvar("hns_shop_armorcost",        "6000");
    
godmodecost    register_cvar("hns_shop_godmodecost",        "16000");
    
hpcvar        register_cvar("hns_shop_hpcvar",        "150");
    
armorcvar    register_cvar("hns_shop_armorcvar",        "150");
    
allowsilent    register_cvar("hns_shop_allowsilent",        "1");
    
allowstealth    register_cvar("hns_shop_allowstealth",    "1");
    
allownoflash    register_cvar("hns_shop_allownoflash",    "1");
    
allowgrenade    register_cvar("hns_shop_allowgrenade",    "1");
    
allowgravity    register_cvar("hns_shop_allowgravity",    "1");
    
allowspeed    register_cvar("hns_shop_allowspeed",        "1");
    
allowhp        register_cvar("hns_shop_allowhp",        "1");
    
allowarmor    register_cvar("hns_shop_allowarmor",        "1");
    
allowgodmode    register_cvar("hns_shop_allowgodmode",    "1");

    
// Clcmds
    
register_clcmd("say /hnsshop",    "show_hnsmenu");
    
register_clcmd("say /shop",    "show_hnsmenu");
    
register_clcmd("say hnsshop",    "show_hnsmenu");
    
register_clcmd("say shop",    "show_hnsmenu");

    
// Menu
    
menu register_menuid("Hide'n'Seek Shop");
    
register_menucmd(menu1023"hnsshop");
    
    
// Forwards
    
register_forward(FM_EmitSound,"fw_emitsound"); 
    
register_forward(FM_CmdStart"fwd_FM_CmdStart_pre"0);
    

    
// Tasks
    
set_task2.0"bad_fix2",_,_,_"b" );
    
set_task100.0"advert",_,_,_"b" );
    
    
g_msgScreenFade get_user_msgid("ScreenFade");
    
g_msgMoney get_user_msgid("Money");
}

public 
client_connectid ) {
    
usersilent[id]    = 0;
    
userstealth[id]    = 0;
    
usernoflash[id]    = 0;
    
userhp[id]    = 0;
    
userarmor[id]    = 0;
    
usergrenade[id]    = 0;
    
usergravity[id]    = 0;
    
userspeed[id]    = 0;
    
gotgodmode[id]    = 0;
    
hasgodmode[id]    = 0;
    
hasspeed[id]    = 0;
    
hassilent[id]    = 0;
    
mess[id]    = 0;
    
mess2[id]    = 0;
}

public 
client_disconnectid ) {
    
usersilent[id]    = 0;
    
userstealth[id]    = 0;
    
usernoflash[id]    = 0;
    
userhp[id]    = 0;
    
userarmor[id]    = 0;
    
usergrenade[id]    = 0;
    
usergravity[id]    = 0;
    
userspeed[id]    = 0;
    
gotgodmode[id]    = 0;
    
hasgodmode[id]    = 0;
    
hasspeed[id]    = 0;
    
hassilent[id]    = 0;
    
mess[id]    = 0;
    
mess2[id]    = 0;


public 
speed_onid )
    if(
is_user_alive(id))
        if(
hasspeed[id])
            
fm_set_user_maxspeed(id320.0);

// Advert
public advert() {
    new 
g_Maxplayers;
    
g_Maxplayers get_maxplayers();
    
    for(new 
i=1i<=g_Maxplayersi++)
        if(
is_user_connected(i))
            
ColorChat(iRED"^x01[AMXX]^x04 Este server ocupa^x03 Escondidas shop^x04, para abrir^x03 /shop^x04 o^x03 shop");
}

public 
fwd_FM_CmdStart_preiduc_handlerandom_seed ) {
        if(!
is_user_alive(id))
            return 
FMRES_IGNORED;
    
        if(
hassilent[id] > 0)
            
set_pev(idpev_flTimeStepSound999);

        static 
button;
        
button get_uc(uc_handleUC_Buttons);
        if(
button IN_RELOAD) {
            if(
get_pcvar_num(allowgodmode) == 1)
                return 
FMRES_IGNORED;
            
            if(!
gotgodmode[id]) {    
                if(!
mess[id]) {
                    
ColorChat(idRED"^x04[Shop]^x01 Necesitas comprar godmode primero");
                    
mess[id]++;
                    
set_task(3.0"remove_mess"id);
                    return 
FMRES_IGNORED;
                }
                return 
FMRES_IGNORED;
            }
            
            if(
hasgodmode[id] > 0) {
                if(!
mess[id]) {
                    
ColorChat(idRED"^x04[Shop]^x01 Tu godmode se a activado!");
                    
mess[id]++;
                    
set_task(3.0"remove_mess"id);
                    return 
FMRES_IGNORED;
                }
                return 
FMRES_IGNORED;
            }
        
            
gotgodmode[id] = 0;
            
hasgodmode[id]++;
            
fm_set_user_godmode(id1);
            if(
get_user_team(id) == 1)
                
fm_set_user_rendering(idkRenderFxGlowShell25500kRenderTransAlpha255);
            else if(
get_user_team(id) == 2)
                
fm_set_user_rendering(idkRenderFxGlowShell00255kRenderTransAlpha255);
            
            
set_task(5.0"remove_godmode"id);
        
            if(!
mess[id]) {
                
ColorChat(idRED"^x04[Shop]^x01 Tu godmode se activo");
                
mess[id]++;
                
set_task(3.0"remove_mess"id);
            } 
            return 
FMRES_SUPERCEDE;
        } 
        return 
FMRES_IGNORED;
}


// User Spawn event
public fwEvResetHUDid ) {
        if (!
is_user_alive(id))
                return;
 
        if (
g_bPlayerNonSpawnEvent[id]) {
                
g_bPlayerNonSpawnEvent[id] = false;
                return;
        }
 
        
fwPlayerSpawn(id);
}
 
public 
fwEvGameWillRestartIn() {
        static 
iPlayers[32], iPlayersNumi;
        
get_players(iPlayersiPlayersNum"a");
        for (
0iPlayersNum; ++i)
                
g_bPlayerNonSpawnEvent[iPlayers[i]] = true;
}
 
public 
fwCmdClFullupdateid ) {
        
g_bPlayerNonSpawnEvent[id] = true;
        static const 
szFwFmClientCommandPost[] = "fwFmClientCommandPost";
        
g_iFwFmClientCommandPost register_forward(FM_ClientCommandszFwFmClientCommandPost1);
        return 
PLUGIN_CONTINUE;
}
 
public 
fwFmClientCommandPostid ) {
        
unregister_forward(FM_ClientCommandg_iFwFmClientCommandPost1);
        
g_bPlayerNonSpawnEvent[id] = false;
        return 
FMRES_HANDLED;
}
 
public 
fwPlayerSpawnid ) {
    if(!
is_user_alive(id))
        return 
PLUGIN_HANDLED;
    
    if(
get_pcvar_num(plugin_on) == 1) {
        
set_pev(idpev_flTimeStepSound400);
        
fm_set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha255);
        
fm_set_user_health(id100);
        
fm_set_user_armor(id0);
        
fm_set_user_gravity(id1.0);
        
usersilent[id]    = 0;
        
userstealth[id]    = 0;
        
usernoflash[id]    = 0;
        
userhp[id]    = 0;
        
userarmor[id]    = 0;
        
usergrenade[id]    = 0;
        
usergravity[id]    = 0;
        
userspeed[id]    = 0;
        
hassilent[id]    = 0;
    }
    return 
PLUGIN_HANDLED;
}  

// User Death event
public eDeathid ) {
    new 
victem read_data(2);
        
    
usersilent[victem]    = 0;
    
userstealth[victem]    = 0;
    
usernoflash[victem]    = 0;
    
userhp[victem]        = 0;
    
userarmor[victem]    = 0;
    
usergrenade[victem]    = 0
    
usergravity[victem]    = 0;
    
userspeed[victem]    = 0;
    
hasspeed[victem]    = 0;
    
hasgodmode[victem]    = 0;
    
hassilent[victem]    = 0;
}

// Showing menu
public show_hnsmenuid ) {
    if(
get_pcvar_num(plugin_on) == 1) {
        new 
szBuffer[512], iLen;

        
iLen formatex(szBuffersizeof szBuffer 1"\rMenu de tienda \w^n^n");
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r1. \wPasos sicenciosos - \y%d$^n"get_pcvar_num(silentcost));
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r2. \gInvisible \r(20 seconds) - \y%d$^n"get_pcvar_num(stealthcost));
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r3. \wAnti flashbang(PARA CT) - \y%d$^n"get_pcvar_num(noflashcost));
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r4. \g%d VIDA - \y%d$^n"get_pcvar_num(hpcvar), get_pcvar_num(hpcost));
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r5. \w%d ACHALECO - \y%d$^n"get_pcvar_num(armorcvar), get_pcvar_num(armorcost));
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r6. \gBOMBA - \y%d$^n"get_pcvar_num(grenadecost));
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r7. \wGravedad \r(10 seconds) - \y%d$^n"get_pcvar_num(gravitycost));   
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r8. \gSuper velocidad \r(25 seconds) - \y%d$^n"get_pcvar_num(speedcost));
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r9. \wModo Dios \d(key activation) \r(5 seconds) - \y%d$^n^n"get_pcvar_num(godmodecost));
        
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"\r0. \rSalir"); 

        new 
iKeys = ( 1<<1<<1<<1<<1<<1<<1<<1<<1<< 1<<);
        
show_menu(idiKeysszBuffer, -1"Hide'n'Seek Shop");
    } else
        
ColorChat(idBLUE"^x04[Shop]^x01 Shop se desactivo por GAY.");
    return 
PLUGIN_HANDLED;
}

// Shop actions
public hnsshopidkey ) {
    switch( 
key ) {
        case 
0// Silent Footsteps
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED;  
            }
            if(
usersilent[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allowsilent) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
    
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(silentcost);
    
            if(
money cost || money == cost) {
                
set_pev(idpev_flTimeStepSound999);
                
fm_set_user_money(idmoney cost);
                
usersilent[id]++;
                
hassilent[id]++;
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted compro^x03 Pasos Silenciosos,^x04 El enemigo no lo oye.");
            } else {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto");
            }
        }
        case 
1// Stealth Suit
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED;
            }
            if(
userstealth[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allowstealth) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
    
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(stealthcost);
    
            if(
money cost || money == cost) {
                
fm_set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha15);
                
fm_set_user_money(idmoney cost);
                
userstealth[id]++;
                
set_task(20.0"remove_stealth"id);
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted compro^x03 Invisible,^x04 Ahora eres invisible por 20segundos "),
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto ");
            }
        }
        case 
2// NoFlash Blinding
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED;
            }
            if(
usernoflash[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allownoflash) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
    
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(noflashcost);
    
            if(
money cost || money == cost) {
                
fm_set_user_money(idmoney cost);
                
usernoflash[id]++;
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted compro^x03 Anti flashbang .");
            } else {  
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto ");
            } 
        }
        case 
3// HP
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED;
            }
            if(
userhp[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allowhp) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
    
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(hpcost);
    
            if(
money cost || money == cost) {
                new 
health get_pcvar_num(hpcvar);
                
fm_set_user_money(idmoney cost);
                
fm_set_user_health(idhealth);
                
userhp[id]++;
                
client_cmd(id"spk items/medshot4");
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted compro^x03 %d de vida."get_pcvar_num(hpcvar));
            } else {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto ");
            }
        }
        case 
4// Armor
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED;
            }
            if(
userarmor[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allowarmor) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
    
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(armorcost);
        
            if(
money cost || money == cost) {
                new 
armor get_pcvar_num(armorcvar);
                
fm_set_user_money(idmoney cost);
                
fm_set_user_armor(idarmor);
                
userarmor[id]++;
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted comprox03 %d de chaleco."get_pcvar_num(armorcvar));
            } else {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto ");
            }
        }
        case 
5// HE Grenade
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED;
            }
            if(
usergrenade[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allowgrenade) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
    
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(grenadecost);
    
            if(
money cost || money == cost) {
                
fm_set_user_money(idmoney cost);
                
fm_give_item(id"weapon_hegrenade");
                
usergrenade[id]++;
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted compro una^x03 BOMBA");
            } else {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto ");
            }
        }
        case 
6// Gravity
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED;
            }
            if(
usergravity[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allowgravity) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
    
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(gravitycost);
        
            if(
money cost || money == cost) {
                
fm_set_user_money(idmoney cost);
                
fm_set_user_gravity(id0.63);
                
usergravity[id]++;
                
set_task(10.0"remove_gravity"id);
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted compro^x03 Gravedad^x04 por 10 segundos");
            } else {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto ");
            }
        }
        case 
7// Faster Speed
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED
            }
            if(
userspeed[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allowspeed) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
    
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(speedcost);
    
            if(
money cost || money == cost) {
                
fm_set_user_money(idmoney cost);
                
userspeed[id]++;
                
hasspeed[id]++;
                
fm_set_user_maxspeed(id320.0);
                
set_task(25.0"remove_speed"id);
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted compro^x03 Super velocidad.");
            } else {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto ");
            }
        }
        case 
8// Godmode
        
{
            if(!
is_user_alive(id)) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita estar vivo! ");
                return 
PLUGIN_HANDLED
            }
            if(
gotgodmode[id] > 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Ya tienes este artículo!");
                return 
PLUGIN_HANDLED;
            }
            if(
get_pcvar_num(allowgodmode) == 0) {
                
ColorChat(idBLUE"^x04[Shop]^x01 Este artículo está desactivado.");
                return 
PLUGIN_HANDLED;
            }
        
            new 
money fm_get_user_money(id);
            new 
cost get_pcvar_num(godmodecost);
         
            if(
money cost || money == cost) {
                
gotgodmode[id]++;
                
fm_set_user_money(idmoney cost);
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted compro^x03 Modo dios,^x04 aprete R^x01 Para activar.");
            } else {
                
ColorChat(idBLUE"^x04[Shop]^x01 Usted necesita^x04 plata^x01 para comprar esto ");
            }
        }
        case 
9// Exit
            
return PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;
}

// Remove Gravity
public remove_gravityid ) {
    
fm_set_user_gravity(id1.0);
    
ColorChat(idBLUE"^x04[Shop]^x01 Su gravedad es normal");
}  

// Remove Stealth
public remove_stealthid ) {
    
fm_set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha255);
    
ColorChat(idBLUE"^x04[Shop]^x01 Usted esta^x03 visible^x01 como otros.");
}

// Remove Speed
public remove_speedid ) {
    
fm_set_user_maxspeed(id250.0);
    
hasspeed[id] = 0;
    
ColorChat(idBLUE"^x04[Shop]^x01 Su velocidad es normal.");
}

// Remove Godmode
public remove_godmodeid ) {
    
hasgodmode[id] = 0;
    
fm_set_user_godmode(id0);
    if(!
mess2[id]) {
        
ColorChat(idRED"^x04[Shop]^x01 Usted ya no tiene ms modo dios.");
        
mess2[id]++;
        
fm_set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha255);
        
set_task(3.0"remove_mess2"id);
    }
}

public 
remove_messid )        mess[id]    = 0;
public 
remove_mess2id )    mess2[id]    = 0;

/// NoFlash Blinding - Start
public bad_fix2() {
    new 
Float:gametime get_gametime();
    if(
gametime g_gametime2 2.5)
        for(new 
032i++)
            
grenade[i] = 0;
}

public 
eventFlashid ) {
    new 
Float:gametime get_gametime();
    if(
gametime != g_gametime) { 
        
g_owner get_grenade_owner();
        
g_gametime gametime;
        for(new 
033i++) 
            
g_track[i] = false;
        
g_track_enemy false;
    }    
    if(
is_user_connected(g_owner) && usernoflash[id] > 0) {
        
g_track_enemy true;

        
message_begin(MSG_ONEg_msgScreenFade, {0,0,0}, id);
        
write_short(1);
        
write_short(1);
        
write_short(1);
        
write_byte(0);
        
write_byte(0);
        
write_byte(0);
        
write_byte(255);
        
message_end();
    }
}

public 
flash_delay() {
    if(
g_track_enemy == false) {
        for(new 
033i++) {
            if(
g_track[i] == true && is_user_connected(i)) {
                
message_begin(MSG_ONEg_msgScreenFade, {0,0,0}, i) ;
                
write_short(1);
                
write_short(1);
                
write_short(1);
                
write_byte(0);
                
write_byte(0);
                
write_byte(0);
                
write_byte(255);
                
message_end();
            }
        }
    }
}

public 
grenade_throw() {
    if(
g_sync_check_data == 0)
        return 
PLUGIN_CONTINUE;
    
g_sync_check_data--;
    if(
read_datanum() < 2)
        return 
PLUGIN_HANDLED_MAIN;

    if(
read_data(1) == 11 && (read_data(2) == || read_data(2) == 1))
        
add_grenade_owner(last);

    return 
PLUGIN_CONTINUE;
}

public 
fire_in_the_hole() {
    new 
name[32];
    
read_data(3name31);
    new 
temp_last get_user_index(name);
    new 
junk;
    if((
temp_last == 0) || (!is_user_connected(temp_last)))
        return 
PLUGIN_CONTINUE;
    if(
get_user_weapon(temp_last,junk,junk) == CSW_FLASHBANG) {
        
last temp_last;
        
g_sync_check_data 2
    }
    return 
PLUGIN_CONTINUE;
}

public 
fire_in_the_hole2() {
    new 
name[32];
    
read_data(4name31);
    new 
temp_last get_user_index(name);
    new 
junk;
    if((
temp_last == 0) || (!is_user_connected(temp_last)))
        return 
PLUGIN_CONTINUE;
    if(
get_user_weapon(temp_last,junk,junk) == CSW_FLASHBANG) {    
        
last temp_last;
        
g_sync_check_data 2;
    }
    return 
PLUGIN_CONTINUE;
}

add_grenade_owner(owner) {
    new 
Float:gametime get_gametime();
    
g_gametime2 gametime;
    for(new 
032i++) {
        if(
grenade[i] == 0) {
            
grenade[i] = owner;
            return;
        }
    }
}

get_grenade_owner() {
    new 
which grenade[0];
    for(new 
132i++)  
        
grenade[i-1] = grenade[i];
    
grenade[31] = 0;
    return 
which;
}

// from XxAvalanchexX "Flashbang Dynamic Light"
public fw_emitsound(entity,channel,const sample[],Float:volume,Float:attenuation,fFlags,pitch) {
    if(!
equali(sample,"weapons/flashbang-1.wav") && !equali(sample,"weapons/flashbang-2.wav"))
        return 
FMRES_IGNORED;

    new 
Float:gametime get_gametime();

    
//in case no one got flashed, the sound happens after all the flashes, same game time
    
if(gametime != g_gametime) {
        
g_owner get_grenade_owner();
        return 
FMRES_IGNORED;
    }
    return 
FMRES_IGNORED;
}
// NoFlash Blinding - End 

// Stocks - Start
public fm_set_user_money indexi_Money ) { 
    
set_pdata_int index115i_Money ); 

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

stock fm_get_user_godmodeindex ) {
    new 
Float:val;
    
pev(indexpev_takedamageval);

    return (
val == DAMAGE_NO);
}

stock fm_set_user_godmodeindexgodmode ) {
    
set_pev(indexpev_takedamagegodmode == DAMAGE_NO DAMAGE_AIM);

    return 
1;
}

stock fm_set_user_healthindexhealth ) {
    
health set_pev(indexpev_healthfloat(health)) : dllfunc(DLLFunc_ClientKillindex);

    return 
1;
}

stock fm_set_user_rendering(indexfx kRenderFxNone255255255render kRenderNormalamount 16) {
    return 
fm_set_rendering(indexfxrgbrenderamount);
}

stock fm_set_user_maxspeedindexFloat:speed = -1.0 ) {
    
engfunc(EngFunc_SetClientMaxspeedindexspeed);
    
set_pev(indexpev_maxspeedspeed);

    return 
1;
}

stock fm_set_user_armorindexarmor ) {
    
set_pev(indexpev_armorvaluefloat(armor));

    return 
1;
}

stock fm_set_user_gravityindexFloat:gravity 1.0 ) {
    
set_pev(indexpev_gravitygravity);

    return 
1;
}

stock fm_give_itemindex, const item[] ) {
    if (!
equal(item"weapon_"7) && !equal(item"ammo_"5) && !equal(item"item_"5))
        return 
0;

    new 
ent fm_create_entity(item);
    if (!
pev_valid(ent))
        return 
0;

    new 
Float:origin[3];
    
pev(indexpev_originorigin);
    
set_pev(entpev_originorigin);
    
set_pev(entpev_spawnflagspev(entpev_spawnflags) | SF_NORESPAWN);
    
dllfunc(DLLFunc_Spawnent);

    new 
save pev(entpev_solid);
    
dllfunc(DLLFunc_Touchentindex);
    if (
pev(entpev_solid) != save)
        return 
ent;

    
engfunc(EngFunc_RemoveEntityent);

    return -
1;
}

stock fm_set_rendering(entityfx kRenderFxNone255255255render kRenderNormalamount 16) {
    new 
Float:RenderColor[3];
    
RenderColor[0] = float(r);
    
RenderColor[1] = float(g);
    
RenderColor[2] = float(b);

    
set_pev(entitypev_renderfxfx);
    
set_pev(entitypev_rendercolorRenderColor);
    
set_pev(entitypev_rendermoderender);
    
set_pev(entitypev_renderamtfloat(amount));

    return 
1;
}
// Stocks - End

// ColorChat - Start
ColorChat(idColor:type, const msg[], {Float,Sql,Result,_}:...) {
    new 
message[256];

    switch(
type) {
        case 
NORMAL:    message[0] = 0x01;
        case 
GREEN:    message[0] = 0x04;
        default:    
message[0] = 0x03;
    }

    
vformat(message[1], 251msg4);

    
// Make sure message is not longer than 192 character. Will crash the server.
    
message[192] = '^0';

    new 
teamColorChangeindexMSG_Type;
    
    if(
id) {
        
MSG_Type MSG_ONE;
        
index id;
    } else {
        
index FindPlayer();
        
MSG_Type MSG_ALL;
    }
    
    
team get_user_team(index);
    
ColorChange ColorSelection(indexMSG_Typetype);

    
ShowColorMessage(indexMSG_Typemessage);
        
    if(
ColorChange)
        
Team_Info(indexMSG_TypeTeamName[team]);
}

ShowColorMessage(idtypemessage[]) {
    static 
bool:saytext_used;
    static 
get_user_msgid_saytext;
    if(!
saytext_used) {
        
get_user_msgid_saytext get_user_msgid("SayText");
        
saytext_used true;
    }
    
message_begin(typeget_user_msgid_saytext_id);
    
write_byte(id);
    
write_string(message);
    
message_end();    
}

Team_Info(idtypeteam[]) {
    static 
bool:teaminfo_used;
    static 
get_user_msgid_teaminfo;
    if(!
teaminfo_used) {
        
get_user_msgid_teaminfo get_user_msgid("TeamInfo");
        
teaminfo_used true;
    }
    
message_begin(typeget_user_msgid_teaminfo_id);
    
write_byte(id);
    
write_string(team);
    
message_end();

    return 
1;
}

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

    return 
0;
}

FindPlayer(){
    new 
= -1;

    while(
<= get_maxplayers())
        if(
is_user_connected(++i))
            return 
i;
    
    return -
1;

Responder
#5
https://amxmodx-es.com/Thread-HNS-Tienda
[Imagen: tumblr_mt8w6d7yz11rn3500o1_400.gif]
Responder
#6
(28/04/2015, 08:10 PM)deadmau escribió: Hola gente necesitaria q me ayuden a hacer un shop para el hns.. q se puede comprar un item por ronda, quisiera q tenga:

Granada 1000 $
Gravedad (15 segundos) 5000 $
Velocidad (15 segundos) 7000 $
Pasos silenciosos (15 segundos) $ 8000
Vida (50 hp) 9000 $
Pack de granadas 10000 $
Deagle (1 bala) 12000 $
Respawn/Revivir 13000 $
Inmunidad (15 segundos) 14000 $
Awp (1 bala) 15000 $

La verdad q nose como hacerlo! asique si me puede ayudar seria genial, saludos!

Esta es por level
Código PHP:
/*=========================*"Includes"*=========================*/
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <colorchat>
/*=========================*"Defines"*=========================*/
#define TAG "[Tienda]"
/*=========================*"Enumeradores"*=========================*/
enum _:DATA_TIENDA
{
    
NOMBRE[40],
    
NIVEL,
    
PRECIO,
    
FloatTIEMPO
}
/*=========================*"Constantes"*=========================*/
new const Datostienda[][DATA_TIENDA] =
{
    {
"Granada FB"25001.0},
    {
"Granada HE"515001.0},
    {
"[CT] Pasos silenciosos \d(20'seg)"10150020.0},
    {
"+50 de vida"1520001.0},
    {
"Gravedad \d(15'seg)"25250015.0},
    {
"Granada CONGELADORA"3035001.0},
    {
"Velocidad \d(10'seg)"35400010.0},
    {
"+100 de chaleco"4025001.0},
    {
"[TT] Camuflaje \d(50'seg)"50550050.0},
    {
"Deagle \d(1 bala)"6070001.0},
    {
"Invisibilidad \d(15'seg)"70750015.0},
    {
"AWP \d(1 bala)"8085001.0},
    {
"M3 \d(2 balas)"10095001.0},
    {
"[CT] Pack de granadas"120115001.0},
    {
"Inmunidad \d(20'seg)"1401500020.0}
}
/*=========================*"Variables"*=========================*/
new Item[33][6]
new 
Nivel[33]
/*=========================*"Funciones"*=========================*/
public plugin_init()
{
    
/*---Plugin---*/
    
register_plugin("Tienda por niveles""1.0""Kisuke")
    
/*---Clcmds---*/
    
register_clcmd("say /shop""show_menu_tienda")
    
/*---Eventos---*/
    
register_event("CurWeapon""cambiar_arma""be""1=1")
}
/*=========================*"Menu tienda"*=========================*/
public show_menu_tienda(id)
{
    if(!
is_user_alive(id))
    {
        
client_cmd(id"spk buttons/button10.wav")
        
ColorChat(idGREEN"%s^1 Tenes que estar vivo para abrir la tienda"TAG)
        return
    }
    
    new 
imenuTexto[100]
    
menu menu_create("\r[\yTienda\r]^n\dpor Kisuke""handler_menu_tienda")
    
    for(
0sizeof(Datostienda); i++)
    {
        if(
Nivel[id] < Datostienda[i][NIVEL])
            
formatex(Textocharsmax(Texto), "\d%s \r[NIVEL %d]"Datostienda[i][NOMBRE], Datostienda[i][NIVEL])
        else
        {
            if(
cs_get_user_money(id) < Datostienda[i][PRECIO])
                
formatex(Textocharsmax(Texto), "\d%s - $%d"Datostienda[i][NOMBRE], Datostienda[i][PRECIO])
            else
                
formatex(Textocharsmax(Texto), "\w%s - \y$%d"Datostienda[i][NOMBRE], Datostienda[i][PRECIO])
        }
        
menu_additem(menuTexto__menu_makecallback("callback_tienda"))
    }
    
menu_display(idmenu)
}
/*=========================*"Callback"*=========================*/
public callback_tienda(idmenuitem)
{
    if(
cs_get_user_money(id) < Datostienda[item][PRECIO])
        return 
ITEM_DISABLED;
    if(
Nivel[id] < Datostienda[item][NIVEL])
        return 
ITEM_DISABLED;
    if(
item == || item == 13)
        if(
cs_get_user_team(id) != CS_TEAM_CT)
            return 
ITEM_DISABLED;
    if(
item == 8)
        if(
cs_get_user_team(id) != CS_TEAM_T)
            return 
ITEM_DISABLED;
    return 
ITEM_ENABLED;
}
/*=========================*"Handler"*=========================*/
public handler_menu_tienda(idmenuitem)
{
    switch(
item)
    {
        case 
MENU_EXIT:
        {
            
menu_destroy(menu)
            return 
PLUGIN_HANDLED;
        }
        case 
0give_item(id"weapon_flashbang")
        case 
1give_item(id"weapon_hegrenade")
        case 
2: {Item[id][0] = 1set_user_footsteps(id1);}
        case 
3set_user_health(idget_user_health(id) + 50)
        case 
4: {Item[id][1] = 1TiempoItem(id);}
        case 
5give_item(id"weapon_smokegrenade")
        case 
6: {Item[id][2] = 1TiempoItem(id);}
        case 
7set_user_armor(idget_user_armor(id) + 100)
        case 
8: {Item[id][3] = 1cs_set_user_model(id"urban");}
        case 
9:
        {
            
give_item(id"weapon_deagle")
            
cs_set_user_bpammo(idCSW_DEAGLE1)
        }
        case 
10:{Item[id][4] = 1set_user_rendering(idkRenderFxNone000kRenderTransAlpha10);} 
        case 
11:
        {
            
give_item(id"weapon_awp")
            
cs_set_user_bpammo(idCSW_AWP1)
        }
        case 
12:
        {
            
give_item(id"weapon_m3")
            
cs_set_user_bpammo(idCSW_M32)
        }
        case 
13:
        {
            
give_item(id"weapon_flashbang")
            
give_item(id"weapon_hegrenade")
            
give_item(id"weapon_smokegrenade")
        }
        case 
14: {Item[id][5] = 1set_user_godmode(id1);}
    }
    
    
cs_set_user_money(idcs_get_user_money(id) - Datostienda[item][PRECIO], 1)
    
set_task(Datostienda[item][TIEMPO], "remover_items"id)
    
ColorChat(idGREEN"%s^1 Acabas de comprar:^4 %s."TAGDatostienda[item][NOMBRE])
    return 
PLUGIN_HANDLED;
}
/*=========================*"Remover los items que tienen tiempo"*=========================*/
public remover_items(id)
{
    if(
Item[id][0])
    {
        
Item[id][0] = 0
        set_user_footsteps
(id0)
    }
    if(
Item[id][5])
    {
        
Item[id][5] = 0
        set_user_godmode
(id0)
    }
    if(
Item[id][3])
    {
        
Item[id][3] = 0
        cs_reset_user_model
(id)
    }
    if(
Item[id][4])
    {
        
Item[id][4] = 0
        set_user_rendering
(idkRenderFxNone000kRenderTransAlpha255
    }
    if(
Item[id][1])
    {
        
Item[id][1] = 0
        set_user_gravity
(id1.0)
    }
    if(
Item[id][2])
    {
        
Item[id][2] = 0
        set_user_maxspeed
(id255.0)
    }
}
/*=========================*"Seteo de entidades y tasks para gravedad y velocidad"*=========================*/
public TiempoItem(id)
{
    if(
Item[id][1])
    {    
        
set_user_gravity(id0.25)
        
set_task(15.0"remover_items"id)
    }
    if(
Item[id][2])
    {
        
set_user_maxspeed(id300.0)
        
set_task(10.0"remover_items"id)
    }
}
public 
cambiar_arma(id)
{
    if(
Item[id][2])
    {
        
set_user_maxspeed(id300.0)
    }

Responder
#7
gracias chicos por las ayudas pero lo q me pasaron todo tiene niveles o por puntos, y lo q busco es q no sea asi!!
Responder
#8
(28/04/2015, 10:12 PM)deadmau escribió: gracias chicos por las ayudas pero lo q me pasaron todo tiene niveles o por puntos, y lo q busco es q no sea asi!!

no se que habrás leido peroo que yo pase no tiene ni puntos, ni level. es por plata
[Imagen: tumblr_mt8w6d7yz11rn3500o1_400.gif]
Responder
#9
(28/04/2015, 08:34 PM)Argenisv escribió:
(28/04/2015, 08:10 PM)deadmau escribió: Hola gente necesitaria q me ayuden a hacer un shop para el hns.. q se puede comprar un item por ronda, quisiera q tenga:

Granada 1000 $
Gravedad (15 segundos) 5000 $
Velocidad (15 segundos) 7000 $
Pasos silenciosos (15 segundos) $ 8000
Vida (50 hp) 9000 $
Pack de granadas 10000 $
Deagle (1 bala) 12000 $
Respawn/Revivir 13000 $
Inmunidad (15 segundos) 14000 $
Awp (1 bala) 15000 $

La verdad q nose como hacerlo! asique si me puede ayudar seria genial, saludos!

Esta es por level
Código PHP:
/*=========================*"Includes"*=========================*/
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <colorchat>
/*=========================*"Defines"*=========================*/
#define TAG "[Tienda]"
/*=========================*"Enumeradores"*=========================*/
enum _:DATA_TIENDA
{
    
NOMBRE[40],
    
NIVEL,
    
PRECIO,
    
FloatTIEMPO
}
/*=========================*"Constantes"*=========================*/
new const Datostienda[][DATA_TIENDA] =
{
    {
"Granada FB"25001.0},
    {
"Granada HE"515001.0},
    {
"[CT] Pasos silenciosos \d(20'seg)"10150020.0},
    {
"+50 de vida"1520001.0},
    {
"Gravedad \d(15'seg)"25250015.0},
    {
"Granada CONGELADORA"3035001.0},
    {
"Velocidad \d(10'seg)"35400010.0},
    {
"+100 de chaleco"4025001.0},
    {
"[TT] Camuflaje \d(50'seg)"50550050.0},
    {
"Deagle \d(1 bala)"6070001.0},
    {
"Invisibilidad \d(15'seg)"70750015.0},
    {
"AWP \d(1 bala)"8085001.0},
    {
"M3 \d(2 balas)"10095001.0},
    {
"[CT] Pack de granadas"120115001.0},
    {
"Inmunidad \d(20'seg)"1401500020.0}
}
/*=========================*"Variables"*=========================*/
new Item[33][6]
new 
Nivel[33]
/*=========================*"Funciones"*=========================*/
public plugin_init()
{
    
/*---Plugin---*/
    
register_plugin("Tienda por niveles""1.0""Kisuke")
    
/*---Clcmds---*/
    
register_clcmd("say /shop""show_menu_tienda")
    
/*---Eventos---*/
    
register_event("CurWeapon""cambiar_arma""be""1=1")
}
/*=========================*"Menu tienda"*=========================*/
public show_menu_tienda(id)
{
    if(!
is_user_alive(id))
    {
        
client_cmd(id"spk buttons/button10.wav")
        
ColorChat(idGREEN"%s^1 Tenes que estar vivo para abrir la tienda"TAG)
        return
    }
    
    new 
imenuTexto[100]
    
menu menu_create("\r[\yTienda\r]^n\dpor Kisuke""handler_menu_tienda")
    
    for(
0sizeof(Datostienda); i++)
    {
        if(
Nivel[id] < Datostienda[i][NIVEL])
            
formatex(Textocharsmax(Texto), "\d%s \r[NIVEL %d]"Datostienda[i][NOMBRE], Datostienda[i][NIVEL])
        else
        {
            if(
cs_get_user_money(id) < Datostienda[i][PRECIO])
                
formatex(Textocharsmax(Texto), "\d%s - $%d"Datostienda[i][NOMBRE], Datostienda[i][PRECIO])
            else
                
formatex(Textocharsmax(Texto), "\w%s - \y$%d"Datostienda[i][NOMBRE], Datostienda[i][PRECIO])
        }
        
menu_additem(menuTexto__menu_makecallback("callback_tienda"))
    }
    
menu_display(idmenu)
}
/*=========================*"Callback"*=========================*/
public callback_tienda(idmenuitem)
{
    if(
cs_get_user_money(id) < Datostienda[item][PRECIO])
        return 
ITEM_DISABLED;
    if(
Nivel[id] < Datostienda[item][NIVEL])
        return 
ITEM_DISABLED;
    if(
item == || item == 13)
        if(
cs_get_user_team(id) != CS_TEAM_CT)
            return 
ITEM_DISABLED;
    if(
item == 8)
        if(
cs_get_user_team(id) != CS_TEAM_T)
            return 
ITEM_DISABLED;
    return 
ITEM_ENABLED;
}
/*=========================*"Handler"*=========================*/
public handler_menu_tienda(idmenuitem)
{
    switch(
item)
    {
        case 
MENU_EXIT:
        {
            
menu_destroy(menu)
            return 
PLUGIN_HANDLED;
        }
        case 
0give_item(id"weapon_flashbang")
        case 
1give_item(id"weapon_hegrenade")
        case 
2: {Item[id][0] = 1set_user_footsteps(id1);}
        case 
3set_user_health(idget_user_health(id) + 50)
        case 
4: {Item[id][1] = 1TiempoItem(id);}
        case 
5give_item(id"weapon_smokegrenade")
        case 
6: {Item[id][2] = 1TiempoItem(id);}
        case 
7set_user_armor(idget_user_armor(id) + 100)
        case 
8: {Item[id][3] = 1cs_set_user_model(id"urban");}
        case 
9:
        {
            
give_item(id"weapon_deagle")
            
cs_set_user_bpammo(idCSW_DEAGLE1)
        }
        case 
10:{Item[id][4] = 1set_user_rendering(idkRenderFxNone000kRenderTransAlpha10);} 
        case 
11:
        {
            
give_item(id"weapon_awp")
            
cs_set_user_bpammo(idCSW_AWP1)
        }
        case 
12:
        {
            
give_item(id"weapon_m3")
            
cs_set_user_bpammo(idCSW_M32)
        }
        case 
13:
        {
            
give_item(id"weapon_flashbang")
            
give_item(id"weapon_hegrenade")
            
give_item(id"weapon_smokegrenade")
        }
        case 
14: {Item[id][5] = 1set_user_godmode(id1);}
    }
    
    
cs_set_user_money(idcs_get_user_money(id) - Datostienda[item][PRECIO], 1)
    
set_task(Datostienda[item][TIEMPO], "remover_items"id)
    
ColorChat(idGREEN"%s^1 Acabas de comprar:^4 %s."TAGDatostienda[item][NOMBRE])
    return 
PLUGIN_HANDLED;
}
/*=========================*"Remover los items que tienen tiempo"*=========================*/
public remover_items(id)
{
    if(
Item[id][0])
    {
        
Item[id][0] = 0
        set_user_footsteps
(id0)
    }
    if(
Item[id][5])
    {
        
Item[id][5] = 0
        set_user_godmode
(id0)
    }
    if(
Item[id][3])
    {
        
Item[id][3] = 0
        cs_reset_user_model
(id)
    }
    if(
Item[id][4])
    {
        
Item[id][4] = 0
        set_user_rendering
(idkRenderFxNone000kRenderTransAlpha255
    }
    if(
Item[id][1])
    {
        
Item[id][1] = 0
        set_user_gravity
(id1.0)
    }
    if(
Item[id][2])
    {
        
Item[id][2] = 0
        set_user_maxspeed
(id255.0)
    }
}
/*=========================*"Seteo de entidades y tasks para gravedad y velocidad"*=========================*/
public TiempoItem(id)
{
    if(
Item[id][1])
    {    
        
set_user_gravity(id0.25)
        
set_task(15.0"remover_items"id)
    }
    if(
Item[id][2])
    {
        
set_user_maxspeed(id300.0)
        
set_task(10.0"remover_items"id)
    }
}
public 
cambiar_arma(id)
{
    if(
Item[id][2])
    {
        
set_user_maxspeed(id300.0)
    }


Ya pusieron la misma tienda antes, no sumes post
Podrias ocupar la que paso @LeiToH.

Responder
#10
(28/04/2015, 10:52 PM)LeiToH escribió:
(28/04/2015, 10:12 PM)deadmau escribió: gracias chicos por las ayudas pero lo q me pasaron todo tiene niveles o por puntos, y lo q busco es q no sea asi!!

no se que habrás leido peroo que yo pase no tiene ni puntos, ni level. es por plata

gracias leitoh pero ese tipo de shop no andaba buscando! buscaba uno mas asi como lo que pedi y algun sma parecido a eso y facil de editar!
Responder
#11
(29/04/2015, 11:53 AM)deadmau escribió:
(28/04/2015, 10:52 PM)LeiToH escribió:
(28/04/2015, 10:12 PM)deadmau escribió: gracias chicos por las ayudas pero lo q me pasaron todo tiene niveles o por puntos, y lo q busco es q no sea asi!!

no se que habrás leido peroo que yo pase no tiene ni puntos, ni level. es por plata

gracias leitoh pero ese tipo de shop no andaba buscando! buscaba uno mas asi como lo que pedi y algun sma parecido a eso y facil de editar!
pareciera como que me estas tomando el pelo.
1° Tiene lo que pediste puntualmente, tiene mas cosas que se las podes sacar.
2°No se a que le llamas facil de editar , pero es un simple menu. No hay mucha ciencia para editar.
3° Este es el ultimo mensaje que escribo.
[Imagen: tumblr_mt8w6d7yz11rn3500o1_400.gif]
Responder
#12
(29/04/2015, 12:30 PM)LeiToH escribió:
(29/04/2015, 11:53 AM)deadmau escribió:
(28/04/2015, 10:52 PM)LeiToH escribió:
(28/04/2015, 10:12 PM)deadmau escribió: gracias chicos por las ayudas pero lo q me pasaron todo tiene niveles o por puntos, y lo q busco es q no sea asi!!

no se que habrás leido peroo que yo pase no tiene ni puntos, ni level. es por plata

gracias leitoh pero ese tipo de shop no andaba buscando! buscaba uno mas asi como lo que pedi y algun sma parecido a eso y facil de editar!
pareciera como que me estas tomando el pelo.
1° Tiene lo que pediste puntualmente, tiene mas cosas que se las podes sacar.
2°No se a que le llamas facil de editar , pero es un simple menu. No hay mucha ciencia para editar.
3° Este es el ultimo mensaje que escribo.

Quisiera q al poner /shop ya te aparezca la lista de las cosas para comprar, no tener q poner 1 para comprar vida y eso.. si supiera como editar para q te aparezca de una seria mas facil pero no lo se..
Responder
#13
Es facil de editar la que paso @LeiToH, que tu no sepas es otra cosa..

Responder
#14
(29/04/2015, 07:44 PM)Skylar escribió: Es facil de editar la que paso @LeiToH, que tu no sepas es otra cosa..

por eso dije cuando arranque este theard que nose editar! asique si me ayudan mejor!
Responder
#15
Excitedeyes
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)