Veteran Member
Join Date: Feb 2013
Location: Rromania
|
11-28-2017
, 14:36
Re: Model Change
|
#15
|
Quote:
Originally Posted by Alexxxxxxxxx
Solved the changing models correctly
But in fwd player spawn post sometimes players are getting overflowed and kicked, why this ?
PHP Code:
new g_ZombieModels[7][] =
{
"classic_model",
"tight_zombie_model",
"red_predator_model",
"mutant_model",
"demon_model",
"burner_model",
"hunter_model"
};
public plugin_precache()
{
new i, buffer[100]
for (i = 0; i < sizeof(g_ZombieModels); i++)
{
formatex(buffer, charsmax(buffer), "models/player/%s/%s.mdl", g_ZombieModels[i], g_ZombieModels[i])
engfunc(EngFunc_PrecacheModel, buffer)
}
}
public EventRoundStart()
{
set_task(12.0, "TaskZombie", TASK_MAKEZOMBIE);
}
public TaskZombie()
{
static iPlayersnum
iPlayersnum = fnGetAlive()
if (iPlayersnum < 1)
{
set_task(2.0, "TaskZombie", TASK_MAKEZOMBIE)
return;
}
start_infection_mode(0, MODE_NONE)
}
zombieme(id, infector, nemesis, silentmode, rewards, assassin)
{
g_zombie[id] = true;
static currentmodel[32], tempmodel[32], already_has_model, i
already_has_model = false
fm_cs_get_user_model(id, currentmodel, charsmax(currentmodel))
for (i = 0; i < sizeof(g_ZombieModels); i++)
{
copy(tempmodel, charsmax(tempmodel), g_ZombieModels[i])
if (equal(currentmodel, tempmodel)) already_has_model = true
}
if (!already_has_model)
{
formatex(g_playermodel[id], charsmax(g_playermodel[]), g_ZombieModels[g_zombieclass[id]])
}
if (!already_has_model)
{
if (g_newround)
set_task(5.0 * 0.2, "fm_user_model_update", id+TASK_MODEL)
else
fm_user_model_update(id+TASK_MODEL)
}
}
start_infection_mode(id, mode)
{
static iPlayersnum
iPlayersnum = fnGetAlive()
static forward_id
g_currentmode = MODE_INFECTION
g_lastmode = MODE_INFECTION
g_allowinfection = true
if (mode == MODE_NONE)
id = fnGetRandomAlive(random_num(1, iPlayersnum))
zombieme(id, 0, 0, 0, 0, 0)
forward_id = id
for (id = 1; id <= g_maxplayers; id++)
{
if (!g_isalive[id])
continue;
if (g_zombie[id])
continue;
if (fm_cs_get_user_team(id) != FM_CS_TEAM_CT)
{
remove_task(id+TASK_TEAM)
fm_cs_set_user_team(id, FM_CS_TEAM_CT)
fm_user_team_update(id)
}
}
set_hudmessage(255, 0, 0, -1.00, 0.17, 0, 0.00, 5.00, 1.00, 1.00, -1)
ShowSyncHudMsg(0, g_iTopMessageSync, "%s is the first zombie !!", g_playername[forward_id])
g_modestarted = true
g_newround = false
ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_INFECTION, forward_id);
}
public fm_cs_set_user_model(taskid)
{
set_user_info(ID_MODEL, "model", g_playermodel[ID_MODEL])
}
stock fm_cs_get_user_model(player, model[], len)
{
get_user_info(player, "model", model, len)
}
public fm_user_model_update(taskid)
{
static Float:current_time
current_time = get_gametime()
if (current_time - g_models_targettime >= 0.2)
{
fm_cs_set_user_model(taskid)
g_models_targettime = current_time
}
else
{
set_task((g_models_targettime + 0.2) - current_time, "fm_cs_set_user_model", taskid)
g_models_targettime = g_models_targettime + 0.2
}
}
|
how much are you going to try to reinvent the wheel until you finally use that API and replace your code with cs_set_player_model ? all problems you are complaining of are fixed by it
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
|
|
|
|