Scripting bug
Posted: 28 Aug 2018, 13:38
Help me i got 2 errors in this special models code:
and i want to work with darkness round it's bugged some times it apprears on first round when map changed. also with these steps.
// Set counter to 0 first round
g_iRoundNum = 10 //
// Set counter to 0 first round
g_iRoundNum = 0
i want the round appears after 10 rounds when map changed.
Code: Select all
#include <zombie_escape>
// Setting File
new const ZE_SETTING_RESOURCES[] = "zombie_escape.ini"
// Defines
#define MODEL_MAX_LENGTH 64
#define PLAYERMODEL_MAX_LENGTH 32
#define ACCESS_MAX_LENGTH 32
#define ADMIN_MODELS_ACCESS ADMIN_LEVEL_H
// Default Models
new const szAdminZombieModel[][] =
{
"zombie_admin"
}
new const v_szAdminHumanKnifeModel[][] =
{
"models/zombie_escape/v_knife_human_admin.mdl"
}
new const v_szAdminZombieKnifeModel[][] =
{
"models/zombie_escape/v_knife_zombie_admin.mdl"
}
// Dynamic Arrays: Models
new Array:g_szAdminZombieModel, Array:g_v_szAdminHumanKnifeModel, Array:g_v_szAdminZombieKnifeModel,
public plugin_init()
{
register_plugin("[ZE] Special Models", ZE_VERSION, AUTHORS)
}
public plugin_precache()
{
// Initialize Arrays
g_szAdminZombieModel = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
g_v_szAdminHumanKnifeModel = ArrayCreate(MODEL_MAX_LENGTH, 1)
g_v_szAdminZombieKnifeModel = ArrayCreate(MODEL_MAX_LENGTH, 1)
// Load From External File
amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "ZOMBIE VIP", g_szAdminZombieModel)
amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE HUMAN VIP", g_v_szAdminHumanKnifeModel)
amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE ZOMBIE VIP", g_v_szAdminZombieKnifeModel)
// Load our Default Values
new iIndex
if(ArraySize(g_szAdminZombieModel) == 0)
{
for(iIndex = 0; iIndex < sizeof szAdminZombieModel; iIndex++)
ArrayPushString(g_szAdminZombieModel, szAdminZombieModel[iIndex])
// Save to external file
amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "ZOMBIE VIP", g_szAdminZombieModel)
}
if(ArraySize(g_v_szAdminHumanKnifeModel) == 0)
{
for(iIndex = 0; iIndex < sizeof v_szAdminHumanKnifeModel; iIndex++)
ArrayPushString(g_v_szAdminHumanKnifeModel, v_szAdminHumanKnifeModel[iIndex])
// Save to external file
amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE HUMAN VIP", g_v_szAdminHumanKnifeModel)
}
if(ArraySize(g_v_szAdminZombieKnifeModel) == 0)
{
for(iIndex = 0; iIndex < sizeof v_szAdminZombieKnifeModel; iIndex++)
ArrayPushString(g_v_szAdminZombieKnifeModel, v_szAdminZombieKnifeModel[iIndex])
// Save to external file
amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE ZOMBIE VIP", g_v_szAdminZombieKnifeModel)
}
// Precache
new szPlayerModel[PLAYERMODEL_MAX_LENGTH], szModel[MODEL_MAX_LENGTH], szModelPath[128]
for (iIndex = 0; iIndex < ArraySize(g_szAdminZombieModel); iIndex++)
{
ArrayGetString(g_szAdminZombieModel, iIndex, szPlayerModel, charsmax(szPlayerModel))
formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
precache_model(szModelPath)
}
for (iIndex = 0; iIndex < ArraySize(g_v_szAdminHumanKnifeModel); iIndex++)
{
ArrayGetString(g_v_szAdminHumanKnifeModel, iIndex, szModel, charsmax(szModel))
precache_model(szModel)
}
for (iIndex = 0; iIndex < ArraySize(g_v_szAdminZombieKnifeModel); iIndex++)
{
ArrayGetString(g_v_szAdminZombieKnifeModel, iIndex, szModel, charsmax(szModel))
precache_model(szModel)
}
}
public ze_user_humanized(id)
{
if(ze_is_user_zombie(id) || !is_user_alive(id))
return
new szPlayerModel[PLAYERMODEL_MAX_LENGTH], szModel[MODEL_MAX_LENGTH]
// Player Admin?
if(get_user_flags(id) & ADMIN_MODELS_ACCESS)
{
// Set Admin Human Knife Model
ArrayGetString(g_v_szAdminHumanKnifeModel, random_num(0, ArraySize(g_v_szAdminHumanKnifeModel) - 1), szModel, charsmax(szModel))
cs_set_player_view_model(id, CSW_KNIFE, szModel)
}
}
public ze_user_infected(iVictim, iInfector)
{
if(!is_user_alive(iVictim))
return
// Set Zombie Models
new szPlayerModel[PLAYERMODEL_MAX_LENGTH], szModel[MODEL_MAX_LENGTH]
// Player Admin?
if(get_user_flags(iVictim) & ADMIN_MODELS_ACCESS)
{
// Set Zombie Admin Model
ArrayGetString(g_szAdminZombieModel, random_num(0, ArraySize(g_szAdminZombieModel) - 1), szPlayerModel, charsmax(szPlayerModel))
rg_set_user_model(iVictim, szPlayerModel)
// Set Admin Zombie Knife Model
ArrayGetString(g_v_szAdminZombieKnifeModel, random_num(0, ArraySize(g_v_szAdminZombieKnifeModel) - 1), szModel, charsmax(szModel))
cs_set_player_view_model(iVictim, CSW_KNIFE, szModel)
cs_set_player_weap_model(iVictim, CSW_KNIFE, "") // Leave Blank so knife not appear with zombies
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
*/
// Set counter to 0 first round
g_iRoundNum = 10 //
// Set counter to 0 first round
g_iRoundNum = 0
i want the round appears after 10 rounds when map changed.
Code: Select all
#include <zombie_escape>
#define DEFAULT_LIGHT "d"
new g_pCvarRoundTime, g_pCvarMapTime, g_iRandomRoundNum, g_iRoundNum, bool:g_bDarkRoundCome
public plugin_init()
{
register_plugin("[ZE] Darkness Round", "1.0", "Raheem")
// Pointers
g_pCvarRoundTime = get_cvar_pointer("mp_roundtime")
g_pCvarMapTime = get_cvar_pointer("mp_timelimit")
// Check rounds number
new iRoundsNumber = get_pcvar_num(g_pCvarMapTime) / get_pcvar_num(g_pCvarRoundTime)
// Get random round
g_iRandomRoundNum = random_num(0, 10)
// Set counter to 0 first round
g_iRoundNum = 10
// Dark round false
g_bDarkRoundCome = false
}
public ze_game_started()
{
if (g_iRoundNum == g_iRandomRoundNum)
{
for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
{
if (!is_user_connected(id))
continue
}
server_cmd("ze_lighting_style a")
g_bDarkRoundCome = true
ze_colored_print(0, "!tIt's too late!y, !tSurvive the darkness if you can!g!!")
}
g_iRoundNum++
}
public ze_roundend(WinTeam)
{
if (g_bDarkRoundCome == true)
{
server_cmd("ze_lighting_style %s", DEFAULT_LIGHT)
g_bDarkRoundCome = false
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
*/