AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   I have probles whit this shop in set_user_maxspeed :S! (https://forums.alliedmods.net/showthread.php?t=113630)

MouseSplash! 12-28-2009 18:33

I have probles whit this shop in set_user_maxspeed :S!
 
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <fun>

#define PLUGIN "[JB] Tienda"
#define VERSION "2.1"
#define AUTHOR "[M]aNuC[s]_"

new OnOffprecio1precio2precio3precio4precio5precio6precio7
new bool:UnaSola[33
new 
bool:Ronda[33]
new 
g_iMsgSayText 
new vida
new armor


public plugin_init() 
{
    
register_clcmd("say /tienda""Tienda")
    
register_clcmd("say !tienda""Tienda")
    
register_clcmd("say_team /tienda""Tienda")
    
register_clcmd("say_team !tienda""Tienda")
    
RegisterHam(Ham_Spawn"player""Fwd_PlayerSpawn_Post"1)
    
    
OnOff register_cvar("jb_tienda""1"//1(ON) 0(OFF) 
    
precio1 register_cvar("jb_pFlash""2000")
    
precio2    register_cvar("jb_pHe""3000")
    
precio3    register_cvar("jb_pHEFL""6000")
    
precio4    register_cvar("jb_pSilencio""8000")
    
precio5    register_cvar("jb_pRapido""10000")
    
precio6    register_cvar("jb_pDrogas""12000")
    
precio7    register_cvar("jb_pGlock""16000")
    
vida register_cvar("jb_dVida""200")
    
armor register_cvar("jb_dArmor""200")
    
g_iMsgSayText get_user_msgid("SayText"
}

public 
plugin_precache() 
{
  
precache_sound("[JB]Tienda/Si.wav")
  
precache_sound("[JB]Tienda/No.wav")

  return 
PLUGIN_CONTINUE
}

public 
Tienda(id)
{
        if(
get_pcvar_num(OnOff) && UnaSola[id] == true)
        {
            if(
get_pcvar_num(OnOff) && Ronda[id] == false)
            {
                if(
is_user_alive(id))
                {
                    if (
cs_get_user_team(id) == CS_TEAM_T )
                    {
                    new 
contador=0;
                    new 
players[32], numtempid;

                    
get_players(playersnum)

                    for (new 
i=0i<numi++)
                    {
                    
tempid players[i]
        
                    if (
get_user_team(tempid)==&& is_user_alive(tempid))
                    {
                        
contador++;
                    }
                    }
                    if ( 
contador == )
                    {
                        
ChatColor(id"!team[TiendaJB]: !gEres El Ultimo !teamConvicto!g, Usa !team/lr ")
                    }
                    else if ( 
contador >= )
                    {
                    static 
Item[64]
    
                    
formatex(Itemcharsmax(Item),"\w[JB] \rTienda:"
                    new 
Menu menu_create(Item"TiendaHandler")
    
                    
formatex(Itemcharsmax(Item),"\wGranada Flash \r%d$"get_pcvar_num(precio1))
                    
menu_additem(MenuItem"1")
    
                    
formatex(Itemcharsmax(Item),"\wGranada He \r%d$"get_pcvar_num(precio2))
                    
menu_additem(MenuItem"2")
    
                    
formatex(Itemcharsmax(Item),"\wGranada He + Flash \r%d$"get_pcvar_num(precio3))
                    
menu_additem(MenuItem"3")
    
                    
formatex(Itemcharsmax(Item),"\wPasos Silenciosos \r%d$"get_pcvar_num(precio4))
                    
menu_additem(MenuItem"4")
    
                    
formatex(Itemcharsmax(Item),"\wCorrer Mas Rapido \r%d$"get_pcvar_num(precio5))
                    
menu_additem(MenuItem"5")
                    
                    
formatex(Itemcharsmax(Item),"\wDrogarse \r%d$"get_pcvar_num(precio6))
                    
menu_additem(MenuItem"6")
    
                    
formatex(Itemcharsmax(Item),"\wGlock \r%d$"get_pcvar_num(precio7))
                    
menu_additem(MenuItem"7")
    
                    
menu_setprop(MenuMPROP_EXITMEXIT_ALL)
                    
menu_display(idMenu)
                    }
                }
                    else
                    {
                    
ChatColor(id"!team[TiendaJB]: !gSolo Los !teamTerroristas !gPueden Comprar")
                    }
                }
                else
                {
                    
ChatColor(id"!team[TiendaJB]: !gEstas Muerto No Puedes Abrir La !teamTienda")
                }
            }
            else
            {
                
ChatColor(id"!team[TiendaJB]: !gSolo Puedes Comprar Una Sola Vez Por Ronda")
            }
        }
        else
        {
        
ChatColor(id"!team[TiendaJB]: !gLa Tienda Esta !teamDesactivada")
        }
}


public 
TiendaHandler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    new 
vivo is_user_alive(id)
    new 
dinero cs_get_user_money(id
    new 
gmsg_SetFOV get_user_msgid("SetFOV"
    
    new 
Obtener1 get_pcvar_num(precio1)
    new 
Obtener2 get_pcvar_num(precio2)
    new 
Obtener3 get_pcvar_num(precio3)
    new 
Obtener4 get_pcvar_num(precio4)
    new 
Obtener5 get_pcvar_num(precio5)
    new 
Obtener6 get_pcvar_num(precio6)
    new 
Obtener7 get_pcvar_num(precio7)
    new 
vida1 get_user_health(id)
    new 
vida2 get_pcvar_num(vida)
    new 
armor1 get_user_armor(id)
    new 
armor2 get_pcvar_num(armor)
    new 
key str_to_num(data);
    switch(
key)
    {
    case 
1:
    {
        if (
dinero >= Obtener1 && vivo)
            {
            
cs_set_user_money(iddinero Obtener1)
            
ChatColor(id"!team[TiendaJB]: !gCompraste Una Granada De Flash")
            
give_item(id"weapon_flashbang")
            
give_item(id"weapon_flashbang")
            
client_cmd(id,"spk [JB]Tienda/Si")
            
Ronda[id] = true
            
}
        else
            {
            
ChatColor(id"!team[TiendaJB]: !gNo Tienes Suficiente Dinero")   
            
client_cmd(id,"spk [JB]Tienda/No")
            }
    }
    case 
2:
    {

        if (
dinero >= Obtener2 && vivo)
            {
            
cs_set_user_money(iddinero Obtener2)
            
ChatColor(id"!team[TiendaJB]: !gCompraste Una Granada He ")
            
give_item(id"weapon_hegrenade")
            
client_cmd(id,"spk [JB]Tienda/Si")
            
Ronda[id] = true
            
}
        else
            {
            
ChatColor(id"!team[TiendaJB]: !gNo Tienes Suficiente Dinero"
            
client_cmd(id,"spk [JB]Tienda/No")
            }
    }
    case 
3:
    {

        if (
dinero >= Obtener3 && vivo)
            {
            
cs_set_user_money(iddinero Obtener3)
            
ChatColor(id"!team[TiendaJB]: !gCompraste Una Granada He + Flash")
            
give_item(id"weapon_hegrenade")
            
give_item(id"weapon_flashbang")
            
give_item(id"weapon_flashbang")
            
client_cmd(id,"spk [JB]Tienda/Si")
            
Ronda[id] = true
            
}
        else
            {
            
ChatColor(id"!team[TiendaJB]: !gNo Tienes Suficiente Dinero"
            
client_cmd(id,"spk [JB]Tienda/No")
            }
    }
    case 
4:
    {

        if (
dinero >= Obtener4 && vivo)
            {
            
cs_set_user_money(iddinero Obtener4)
            
ChatColor(id"!team[TiendaJB]: !gCompraste Pasos Silenciosos")
            
set_user_footsteps(id1)
            
client_cmd(id,"spk [JB]Tienda/Si")
            
Ronda[id] = true
            
}
        else
            {
            
ChatColor(id"!team[TiendaJB]: !gNo Tienes Suficiente Dinero"
            
client_cmd(id,"spk [JB]Tienda/No")
            }
    }
    case 
5:
    {        
        if (
dinero >= Obtener5 && vivo)
            {
            
cs_set_user_money(iddinero Obtener5)
            
ChatColor(id"!team[TiendaJB]: !gCompraste Velocidad"
            
Speed[id] = 1
            set_user_maxspeed
(id500.0)
            
client_cmd(id,"spk [JB]Tienda/Si")
            
Ronda[id] = true
            
}
        else
            {
            
ChatColor(id"!team[TiendaJB]: !gNo Tienes Suficiente Dinero")    
            
client_cmd(id,"spk [JB]Tienda/No")
            }
    }
    case 
6:
    {    
        if (
dinero >= Obtener6 && vivo)
            {
            
cs_set_user_money(iddinero Obtener6)
            
ChatColor(id"!team[TiendaJB]: !gCompraste Drogas"
            
set_user_armor(idarmor1 armor2)
            
set_user_health(idvida1 vida2)
            
set_user_maxspeed(id380.0)
            
message_beginMSG_ONEgmsg_SetFOV, { 00}, id )
            
write_byte180 )
            
message_end( )  
            
client_cmd(id,"spk [JB]Tienda/Si")
            
Ronda[id] = true
            
}
        else
            {
            
ChatColor(id"!team[TiendaJB]: !gNo Tienes Suficiente Dinero")   
            
client_cmd(id,"spk [JB]Tienda/No")
            }
    }
    case 
7:
    {
        if (
dinero >= Obtener7 && vivo)
            {
            
cs_set_user_money(iddinero Obtener7)    
            
ChatColor(id"!team[TiendaJB]: !gCompraste Una Glock"
            
give_item(id"weapon_glock18")
            
cs_set_user_bpammo(idCSW_GLOCK180)
            
client_cmd(id,"spk [JB]Tienda/Si")
            
Ronda[id] = true
            
}
        else
            {
            
ChatColor(id"!team[TiendaJB]: !gNo Tienes Suficiente Dinero")   
            
client_cmd(id,"spk [JB]Tienda/No")
            }
    }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}  

public 
Fwd_PlayerSpawn_Post(id)
{
    if (
is_user_alive(id))
    {
    
set_user_footsteps(id0)
    
set_user_maxspeed(id320.0)
    
UnaSola[id] = true
    Ronda
[id] = false
    
}
}


stock ChatColor(const id, const input[], any:...)
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4"// Green Color
    
replace_all(msg190"!y""^1"// Default Color
    
replace_all(msg190"!team""^3"// Team Color
    
replace_all(msg190"!team2""^0"// Team2 Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch")
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
        
message_begin(MSG_ONE_UNRELIABLEg_iMsgSayText_players[i])  
        
write_byte(players[i]);
        
write_string(msg);
        
message_end();
            }
        }
    }


i have problems in the case 5 and 6.. the problem is the peaplo spawn with much velocity

kikifrh 12-28-2009 18:53

Re: I have probles whit this shop in set_user_maxspeed :S!
 
You mean in next round? Because I think you must put Ronda[id] = false on new round
edit: public Fwd_PlayerSpawn_Post(id)
{
if (
is_user_alive(id
))
{
set_user_footsteps(id, 0
)
set_user_maxspeed(id, 320.0
) (<- ?)
UnaSola[id] =
true
Ronda
[id] =
false
}
}


MouseSplash! 12-28-2009 19:00

Re: I have probles whit this shop in set_user_maxspeed :S!
 
so what its the problem ?

edit: i go to test...

kikifrh 12-28-2009 19:07

Re: I have probles whit this shop in set_user_maxspeed :S!
 
I'm not good on script, I know somethings, I'll try to fix, but if someone post here other code, I suggest you to use it ^_^
Code:

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <fun>

#define PLUGIN "[JB] Tienda"
#define VERSION "2.1"
#define AUTHOR "[M]aNuC[s]_"

new OnOff, precio1, precio2, precio3, precio4, precio5, precio6, precio7
new bool:UnaSola[33]
new bool:Ronda[33]
new g_iMsgSayText
new vida
new armor


public plugin_init()
{
    register_clcmd("say /tienda", "Tienda")
    register_clcmd("say !tienda", "Tienda")
    register_clcmd("say_team /tienda", "Tienda")
    register_clcmd("say_team !tienda", "Tienda")
    RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1)
   
    OnOff = register_cvar("jb_tienda", "1") //1(ON) 0(OFF)
    precio1 = register_cvar("jb_pFlash", "2000")
    precio2    = register_cvar("jb_pHe", "3000")
    precio3    = register_cvar("jb_pHEFL", "6000")
    precio4    = register_cvar("jb_pSilencio", "8000")
    precio5    = register_cvar("jb_pRapido", "10000")
    precio6    = register_cvar("jb_pDrogas", "12000")
    precio7    = register_cvar("jb_pGlock", "16000")
    vida = register_cvar("jb_dVida", "200")
    armor = register_cvar("jb_dArmor", "200")
    g_iMsgSayText = get_user_msgid("SayText")
}
public plugin_precache()
{
  precache_sound("[JB]Tienda/Si.wav")
  precache_sound("[JB]Tienda/No.wav")
  return PLUGIN_CONTINUE
}
public Tienda(id)
{
        if(get_pcvar_num(OnOff) && UnaSola[id] == true)
        {
            if(get_pcvar_num(OnOff) && Ronda[id] == false)
            {
                if(is_user_alive(id))
                {
                    if (cs_get_user_team(id) == CS_TEAM_T )
                    {
                    new contador=0;
                    new players[32], num, tempid;
                    get_players(players, num)
                    for (new i=0; i<num; i++)
                    {
                    tempid = players[i]
       
                    if (get_user_team(tempid)==1 && is_user_alive(tempid))
                    {
                        contador++;
                    }
                    }
                    if ( contador == 1 )
                    {
                        ChatColor(id, "!team[TiendaJB]: !gEres El Ultimo !teamConvicto!g, Usa !team/lr ")
                    }
                    else if ( contador >= 2 )
                    {
                    static Item[64]
   
                    formatex(Item, charsmax(Item),"\w[JB] \rTienda:")
                    new Menu = menu_create(Item, "TiendaHandler")
   
                    formatex(Item, charsmax(Item),"\wGranada Flash \r%d$", get_pcvar_num(precio1))
                    menu_additem(Menu, Item, "1")
   
                    formatex(Item, charsmax(Item),"\wGranada He \r%d$", get_pcvar_num(precio2))
                    menu_additem(Menu, Item, "2")
   
                    formatex(Item, charsmax(Item),"\wGranada He + Flash \r%d$", get_pcvar_num(precio3))
                    menu_additem(Menu, Item, "3")
   
                    formatex(Item, charsmax(Item),"\wPasos Silenciosos \r%d$", get_pcvar_num(precio4))
                    menu_additem(Menu, Item, "4")
   
                    formatex(Item, charsmax(Item),"\wCorrer Mas Rapido \r%d$", get_pcvar_num(precio5))
                    menu_additem(Menu, Item, "5")
                   
                    formatex(Item, charsmax(Item),"\wDrogarse \r%d$", get_pcvar_num(precio6))
                    menu_additem(Menu, Item, "6")
   
                    formatex(Item, charsmax(Item),"\wGlock \r%d$", get_pcvar_num(precio7))
                    menu_additem(Menu, Item, "7")
   
                    menu_setprop(Menu, MPROP_EXIT, MEXIT_ALL)
                    menu_display(id, Menu)
                    }
                }
                    else
                    {
                    ChatColor(id, "!team[TiendaJB]: !gSolo Los !teamTerroristas !gPueden Comprar")
                    }
                }
                else
                {
                    ChatColor(id, "!team[TiendaJB]: !gEstas Muerto No Puedes Abrir La !teamTienda")
                }
            }
            else
            {
                ChatColor(id, "!team[TiendaJB]: !gSolo Puedes Comprar Una Sola Vez Por Ronda")
            }
        }
        else
        {
        ChatColor(id, "!team[TiendaJB]: !gLa Tienda Esta !teamDesactivada")
        }
}

public TiendaHandler(id, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    new data[6], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
    new vivo = is_user_alive(id)
    new dinero = cs_get_user_money(id)
    new gmsg_SetFOV = get_user_msgid("SetFOV")
   
    new Obtener1 = get_pcvar_num(precio1)
    new Obtener2 = get_pcvar_num(precio2)
    new Obtener3 = get_pcvar_num(precio3)
    new Obtener4 = get_pcvar_num(precio4)
    new Obtener5 = get_pcvar_num(precio5)
    new Obtener6 = get_pcvar_num(precio6)
    new Obtener7 = get_pcvar_num(precio7)
    new vida1 = get_user_health(id)
    new vida2 = get_pcvar_num(vida)
    new armor1 = get_user_armor(id)
    new armor2 = get_pcvar_num(armor)
    new key = str_to_num(data);
    switch(key)
    {
    case 1:
    {
        if (dinero >= Obtener1 && vivo)
            {
            cs_set_user_money(id, dinero - Obtener1)
            ChatColor(id, "!team[TiendaJB]: !gCompraste Una Granada De Flash")
            give_item(id, "weapon_flashbang")
            give_item(id, "weapon_flashbang")
            client_cmd(id,"spk [JB]Tienda/Si")
            Ronda[id] = true
            }
        else
            {
            ChatColor(id, "!team[TiendaJB]: !gNo Tienes Suficiente Dinero") 
            client_cmd(id,"spk [JB]Tienda/No")
            }
    }
    case 2:
    {
        if (dinero >= Obtener2 && vivo)
            {
            cs_set_user_money(id, dinero - Obtener2)
            ChatColor(id, "!team[TiendaJB]: !gCompraste Una Granada He ")
            give_item(id, "weapon_hegrenade")
            client_cmd(id,"spk [JB]Tienda/Si")
            Ronda[id] = true
            }
        else
            {
            ChatColor(id, "!team[TiendaJB]: !gNo Tienes Suficiente Dinero")
            client_cmd(id,"spk [JB]Tienda/No")
            }
    }
    case 3:
    {
        if (dinero >= Obtener3 && vivo)
            {
            cs_set_user_money(id, dinero - Obtener3)
            ChatColor(id, "!team[TiendaJB]: !gCompraste Una Granada He + Flash")
            give_item(id, "weapon_hegrenade")
            give_item(id, "weapon_flashbang")
            give_item(id, "weapon_flashbang")
            client_cmd(id,"spk [JB]Tienda/Si")
            Ronda[id] = true
            }
        else
            {
            ChatColor(id, "!team[TiendaJB]: !gNo Tienes Suficiente Dinero")
            client_cmd(id,"spk [JB]Tienda/No")
            }
    }
    case 4:
    {
        if (dinero >= Obtener4 && vivo)
            {
            cs_set_user_money(id, dinero - Obtener4)
            ChatColor(id, "!team[TiendaJB]: !gCompraste Pasos Silenciosos")
            set_user_footsteps(id, 1)
            client_cmd(id,"spk [JB]Tienda/Si")
            Ronda[id] = true
            }
        else
            {
            ChatColor(id, "!team[TiendaJB]: !gNo Tienes Suficiente Dinero")
            client_cmd(id,"spk [JB]Tienda/No")
            }
    }
    case 5:
    {       
        if (dinero >= Obtener5 && vivo)
            {
            cs_set_user_money(id, dinero - Obtener5)
            ChatColor(id, "!team[TiendaJB]: !gCompraste Velocidad")
            Speed[id] = 1
            set_user_maxspeed(id, 500.0)
            client_cmd(id,"spk [JB]Tienda/Si")
            Ronda[id] = true
            }
        else
            {
            ChatColor(id, "!team[TiendaJB]: !gNo Tienes Suficiente Dinero")   
            client_cmd(id,"spk [JB]Tienda/No")
            }
    }
    case 6:
    {   
        if (dinero >= Obtener6 && vivo)
            {
            cs_set_user_money(id, dinero - Obtener6)
            ChatColor(id, "!team[TiendaJB]: !gCompraste Drogas")
            set_user_armor(id, armor1 + armor2)
            set_user_health(id, vida1 + vida2)
            set_user_maxspeed(id, 380.0)
            message_begin( MSG_ONE, gmsg_SetFOV, { 0, 0, 0 }, id )
            write_byte( 180 )
            message_end( ) 
            client_cmd(id,"spk [JB]Tienda/Si")
            Ronda[id] = true
            }
        else
            {
            ChatColor(id, "!team[TiendaJB]: !gNo Tienes Suficiente Dinero") 
            client_cmd(id,"spk [JB]Tienda/No")
            }
    }
    case 7:
    {
        if (dinero >= Obtener7 && vivo)
            {
            cs_set_user_money(id, dinero - Obtener7)   
            ChatColor(id, "!team[TiendaJB]: !gCompraste Una Glock")
            give_item(id, "weapon_glock18")
            cs_set_user_bpammo(id, CSW_GLOCK18, 0)
            client_cmd(id,"spk [JB]Tienda/Si")
            Ronda[id] = true
            }
        else
            {
            ChatColor(id, "!team[TiendaJB]: !gNo Tienes Suficiente Dinero") 
            client_cmd(id,"spk [JB]Tienda/No")
            }
    }
    }
    menu_destroy(menu);
    return PLUGIN_HANDLED;

public Fwd_PlayerSpawn_Post(id)
{
    if (is_user_alive(id))
    {
    set_user_footsteps(id, 0)
    set_user_maxspeed(id, 320.0)
    UnaSola[id] = true
    Ronda[id] = false
    Speed[id] = 0
    }
}

stock ChatColor(const id, const input[], any:...)
{
    new count = 1, players[32]
    static msg[191]
    vformat(msg, 190, input, 3)
   
    replace_all(msg, 190, "!g", "^4") // Green Color
    replace_all(msg, 190, "!y", "^1") // Default Color
    replace_all(msg, 190, "!team", "^3") // Team Color
    replace_all(msg, 190, "!team2", "^0") // Team2 Color
   
    if (id) players[0] = id; else get_players(players, count, "ch")
    {
        for (new i = 0; i < count; i++)
        {
            if (is_user_connected(players[i]))
            {
        message_begin(MSG_ONE_UNRELIABLE, g_iMsgSayText, _, players[i]) 
        write_byte(players[i]);
        write_string(msg);
        message_end();
            }
        }
    }



try this, hope it work :D

MouseSplash! 12-28-2009 19:18

Re: I have probles whit this shop in set_user_maxspeed :S!
 
i question speed is??
PHP Code:

(speed[id])
{
set_user_maxspeed(id380.0)
}

or 
(
speed[id])
{
set_user_maxspeed(id500.0)



kikifrh 12-28-2009 19:31

Re: I have probles whit this shop in set_user_maxspeed :S!
 
Sorry, I didn't understand :S

but I'll edit something in my previous post


All times are GMT -4. The time now is 04:14.

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