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(i = 0; i < sizeof g_hats_modes; i++)
precache_model(g_hats_modes[i])
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
}
// Sombreritos!
public dar_sombrero(id)
{
if(!g_reset[id])
return;
switch(g_reset[id])
{
case 1..2: g_hats[id] = 1
case 3..5: g_hats[id] = 2
case 6..7: g_hats[id] = 3
case 8..10: g_hats[id] = 4
case 11..15: g_hats[id] = 5
case 16..20: g_hats[id] = 6
case 21..25: g_hats[id] = 7
case 26..30: g_hats[id] = 8 // 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(ent, EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_edict(ent, EV_ENT_aiment, id)
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..3: g_hats[id] = 1
case 4..8: g_hats[id] = 2
case 9..21: g_hats[id] = 3
}
if(!g_hats_ent[id] || !is_valid_ent(g_hats_ent[id]))
{
new ent = create_entity("info_target")
entity_set_int(ent, EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_edict(ent, EV_ENT_aiment, id)
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)