Hats zp, ayuda
#1
Código PHP:
new g_hats[33]

new 
g_hats_ent[33]
new 
g_reset[33]

new const 
g_hats_modes[][] =  // 30 modelos
{
    
"models/hat/jason.mdl",
    
"models/hat/ushanka.mdl",
    
"models/hat/viking.mdl",
    
"models/hat/santahat.mdl",
    
"models/hat/scream.mdl",
    
"models/hat/tv.mdl",
    
"models/hat/tophat.mdl",
    
"models/hat/sumbraro2.mdl",
    
"models/hat/sortinghat.mdl",
    
"models/hat/ShoopDaWhoop.mdl",
    
"models/hat/pirate2.mdl",
    
"models/hat/pillsburyhat.mdl",
    
"models/hat/paperbag.mdl",
    
"models/hat/pbbears.mdl",
    
"models/hat/merlin.mdl",
    
"models/hat/jamacahat2.mdl",
    
"models/hat/jackolantern.mdl",
    
"models/hat/jackinbox.mdl",
    
"models/hat/hood.mdl",
    
"models/hat/headphones.mdl",
    
"models/hat/giantscap.mdl",
    
"models/hat/earth.mdl",
    
"models/hat/dunce.mdl",
    
"models/hat/dodgerscap.mdl",
    
"models/hat/darth.mdl",
    
"models/hat/cheesehead.mdl",
    
"models/hat/bighead.mdl",
    
"models/hat/beerhat.mdl",
    
"models/hat/arrow.mdl",
    
"models/hat/afro.mdl"
}
public 
plugin_precache()
{
    static 
i
    
for(0sizeof g_hats_modesi++)
        
precache_model(g_hats_modes[i])
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
}

// Sombreritos!
public dar_sombrero(id
{
    if(!
g_reset[id])
        return;

    switch(
g_reset[id]) 
    {
        case 
1..2g_hats[id] = 1
        
case 3..5g_hats[id] = 2
        
case 6..7g_hats[id] = 3
        
case 8..10g_hats[id] = 4
        
case 11..15g_hats[id] = 5
        
case 16..20g_hats[id] = 6
        
case 21..25g_hats[id] = 7
        
case 26..30g_hats[id] = // 30 casos osea los casos 1 - 30 serian los numeros de reset y los iguales a 1 2 3 etc. serian los models q seteas
    
}

    if(!
g_hats_ent[id] || !is_valid_ent(g_hats_ent[id])) 
    {
        new 
ent create_entity("info_target")
        
entity_set_int(entEV_INT_movetypeMOVETYPE_FOLLOW)
        
entity_set_edict(entEV_ENT_aimentid)
        
g_hats_ent[id] = ent
    
}

    
entity_set_model(g_hats_ent[id], g_hats_modes[g_hats[id]])
}

public 
del_sombrero(id
{
    if(
is_valid_ent(g_hats_ent[id]))
        
remove_entity(g_hats_ent[id])

    
g_hats_ent[id] = 0
}
client_putinserver(id)
{
    
g_hats[id] = 0


Use eso para poner models por reset, solo que reduci los models a 3, y bueno.. el problema basicamente es que al darme un hat al reset 1, me da el hat que vendria siendo el 2 (que corresponde desde el reset 4 al 8 y no el que deberia, que seria del 1 al 3)

Código PHP:
public dar_sombrero(id
{
    if(!
g_reset[id])
        return;

    switch(
g_reset[id]) 
    {
        case 
1..3g_hats[id] = 1
        
case 4..8g_hats[id] = 2
        
case 9..21g_hats[id] = 3
    
}

    if(!
g_hats_ent[id] || !is_valid_ent(g_hats_ent[id])) 
    {
        new 
ent create_entity("info_target")
        
entity_set_int(entEV_INT_movetypeMOVETYPE_FOLLOW)
        
entity_set_edict(entEV_ENT_aimentid)
        
g_hats_ent[id] = ent
    
}

    
entity_set_model(g_hats_ent[id], g_hats_modes[g_hats[id]])
}

public 
del_sombrero(id
{
    if(
is_valid_ent(g_hats_ent[id]))
        
remove_entity(g_hats_ent[id])

    
g_hats_ent[id] = 0


Asi lo tengo.. y bueno, para saber.. en que parte se desconecta el player para quitarle los hats¿ (me refiero donde poner del_sombrero)
Responder
#2
Código PHP:
case 1..3g_hats[id] = 0
case 4..8g_hats[id] = 1
case 9..21g_hats[id] = 

Código PHP:
public client_disconnect(iddel_sombrero(id); 
[Imagen: bvpq9q-6.png]

NO DOY AYUDA VIA MENSAJE PRIVADO

* Si requieres algún servicio de pago puedes contactarme vía MP o en mi facebook
Responder
#3
(07/09/2018, 04:12 AM)kikizon2 escribió:
Código PHP:
case 1..3g_hats[id] = 0
case 4..8g_hats[id] = 1
case 9..21g_hats[id] = 

Código PHP:
public client_disconnect(iddel_sombrero(id); 

no se si la hora, o que, pero te juro que buscaba client disconnect y no lo encontraba por eso pregunte Genius

claro tengo q contar a partir del 0, gracias.Thats what she said
Responder
#4
(07/09/2018, 04:12 AM)kikizon2 escribió:
Código PHP:
case 1..3g_hats[id] = 0
case 4..8g_hats[id] = 1
case 9..21g_hats[id] = 

Código PHP:
public client_disconnect(iddel_sombrero(id); 

Tambien tendría que removerlo al morir
Responder
#5
(07/09/2018, 06:31 AM)AGustiN escribió:
(07/09/2018, 04:12 AM)kikizon2 escribió:
Código PHP:
case 1..3g_hats[id] = 0
case 4..8g_hats[id] = 1
case 9..21g_hats[id] = 

Código PHP:
public client_disconnect(iddel_sombrero(id); 

Tambien tendría que removerlo al morir

pero siendo un deathmatch con respawn cada 1 o 2 segundos, es necesario? xd
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)