Resolved Scripting bug

Coding Help/Re-API Supported
Post Reply
User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 565
Joined: 1 Year Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 6 times
Age: 19
Contact:

Scripting bug

#1

Post by Spir0x » 4 Months Ago

Help me i got 2 errors in this special models code:

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 }
*/
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>

#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 }
*/

User avatar
Jack GamePlay
Mod Developer
Mod Developer
Egypt
Posts: 534
Joined: 1 Year Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 42 times
Age: 19
Contact:

#2

Post by Jack GamePlay » 4 Months Ago

I don't understand.
Image

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 565
Joined: 1 Year Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 6 times
Age: 19
Contact:

#3

Post by Spir0x » 4 Months Ago

Bro for the first code of ze_special_models when i want to compile it it shows 2 errors on it.

And for the second code it's a darkness round plugin. sometimes the darkness round starts on first round when i change map. i just want it on round 10 !

User avatar
Jack GamePlay
Mod Developer
Mod Developer
Egypt
Posts: 534
Joined: 1 Year Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 42 times
Age: 19
Contact:

#4

Post by Jack GamePlay » 4 Months Ago

  1. #include <zombie_escape>
  2.  
  3. // Setting File
  4. new const ZE_SETTING_RESOURCES[] = "zombie_escape.ini"
  5.  
  6. // Defines
  7. #define MODEL_MAX_LENGTH 64
  8. #define PLAYERMODEL_MAX_LENGTH 32
  9. #define ACCESS_MAX_LENGTH 32
  10. #define ADMIN_MODELS_ACCESS ADMIN_LEVEL_H
  11.  
  12. // Default Models
  13. new const szAdminZombieModel[][] =
  14. {
  15.     "zombie_admin"
  16. }
  17.  
  18. new const v_szAdminHumanKnifeModel[][] =
  19. {
  20.     "models/zombie_escape/v_knife_human_admin.mdl"
  21. }
  22.  
  23. new const v_szAdminZombieKnifeModel[][] =
  24. {
  25.     "models/zombie_escape/v_knife_zombie_admin.mdl"
  26. }
  27.  
  28. // Dynamic Arrays: Models
  29. new Array:g_szAdminZombieModel, Array:g_v_szAdminHumanKnifeModel, Array:g_v_szAdminZombieKnifeModel
  30.  
  31. public plugin_init()
  32. {
  33.     register_plugin("[ZE] Special Models", ZE_VERSION, AUTHORS)
  34. }
  35.  
  36. public plugin_precache()
  37. {
  38.     // Initialize Arrays
  39.     g_szAdminZombieModel = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
  40.     g_v_szAdminHumanKnifeModel = ArrayCreate(MODEL_MAX_LENGTH, 1)
  41.     g_v_szAdminZombieKnifeModel = ArrayCreate(MODEL_MAX_LENGTH, 1)
  42.    
  43.     // Load From External File
  44.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "ZOMBIE VIP", g_szAdminZombieModel)
  45.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE HUMAN VIP", g_v_szAdminHumanKnifeModel)
  46.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE ZOMBIE VIP", g_v_szAdminZombieKnifeModel)
  47.    
  48.     // Load our Default Values
  49.     new iIndex
  50.    
  51.     if(ArraySize(g_szAdminZombieModel) == 0)
  52.     {
  53.         for(iIndex = 0; iIndex < sizeof szAdminZombieModel; iIndex++)
  54.             ArrayPushString(g_szAdminZombieModel, szAdminZombieModel[iIndex])
  55.        
  56.         // Save to external file
  57.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "ZOMBIE VIP", g_szAdminZombieModel)
  58.     }
  59.    
  60.     if(ArraySize(g_v_szAdminHumanKnifeModel) == 0)
  61.     {
  62.         for(iIndex = 0; iIndex < sizeof v_szAdminHumanKnifeModel; iIndex++)
  63.             ArrayPushString(g_v_szAdminHumanKnifeModel, v_szAdminHumanKnifeModel[iIndex])
  64.        
  65.         // Save to external file
  66.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE HUMAN VIP", g_v_szAdminHumanKnifeModel)
  67.     }
  68.    
  69.     if(ArraySize(g_v_szAdminZombieKnifeModel) == 0)
  70.     {
  71.         for(iIndex = 0; iIndex < sizeof v_szAdminZombieKnifeModel; iIndex++)
  72.             ArrayPushString(g_v_szAdminZombieKnifeModel, v_szAdminZombieKnifeModel[iIndex])
  73.        
  74.         // Save to external file
  75.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE ZOMBIE VIP", g_v_szAdminZombieKnifeModel)
  76.     }
  77.  
  78.     // Precache
  79.     new szPlayerModel[PLAYERMODEL_MAX_LENGTH], szModel[MODEL_MAX_LENGTH], szModelPath[128]
  80.    
  81.     for (iIndex = 0; iIndex < ArraySize(g_szAdminZombieModel); iIndex++)
  82.     {
  83.         ArrayGetString(g_szAdminZombieModel, iIndex, szPlayerModel, charsmax(szPlayerModel))
  84.         formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
  85.         precache_model(szModelPath)
  86.     }
  87.    
  88.     for (iIndex = 0; iIndex < ArraySize(g_v_szAdminHumanKnifeModel); iIndex++)
  89.     {
  90.         ArrayGetString(g_v_szAdminHumanKnifeModel, iIndex, szModel, charsmax(szModel))
  91.         precache_model(szModel)
  92.     }
  93.    
  94.     for (iIndex = 0; iIndex < ArraySize(g_v_szAdminZombieKnifeModel); iIndex++)
  95.     {
  96.         ArrayGetString(g_v_szAdminZombieKnifeModel, iIndex, szModel, charsmax(szModel))
  97.         precache_model(szModel)
  98.     }
  99. }
  100.  
  101. public ze_user_humanized(id)
  102. {
  103.     if(ze_is_user_zombie(id) || !is_user_alive(id))
  104.         return
  105.        
  106.     new szModel[MODEL_MAX_LENGTH]
  107.  
  108.     // Player Admin?
  109.     if(get_user_flags(id) & ADMIN_MODELS_ACCESS)
  110.     {      
  111.         // Set Admin Human Knife Model
  112.         ArrayGetString(g_v_szAdminHumanKnifeModel, random_num(0, ArraySize(g_v_szAdminHumanKnifeModel) - 1), szModel, charsmax(szModel))
  113.         cs_set_player_view_model(id, CSW_KNIFE, szModel)
  114.     }
  115. }
  116.  
  117. public ze_user_infected(iVictim, iInfector)
  118. {
  119.     if(!is_user_alive(iVictim))
  120.         return
  121.        
  122.     // Set Zombie Models
  123.     new szPlayerModel[PLAYERMODEL_MAX_LENGTH], szModel[MODEL_MAX_LENGTH]
  124.    
  125.     // Player Admin?
  126.     if(get_user_flags(iVictim) & ADMIN_MODELS_ACCESS)
  127.     {
  128.         // Set Zombie Admin Model
  129.         ArrayGetString(g_szAdminZombieModel, random_num(0, ArraySize(g_szAdminZombieModel) - 1), szPlayerModel, charsmax(szPlayerModel))
  130.         rg_set_user_model(iVictim, szPlayerModel)
  131.        
  132.         // Set Admin Zombie Knife Model
  133.         ArrayGetString(g_v_szAdminZombieKnifeModel, random_num(0, ArraySize(g_v_szAdminZombieKnifeModel) - 1), szModel, charsmax(szModel))
  134.         cs_set_player_view_model(iVictim, CSW_KNIFE, szModel)
  135.         cs_set_player_weap_model(iVictim, CSW_KNIFE, "") // Leave Blank so knife not appear with zombies
  136.     }
  137. }
  138. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  139. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
  140. */

  1. #include <zombie_escape>
  2.  
  3. #define DEFAULT_LIGHT "d"
  4.  
  5. new bool:g_bDarkRound
  6.  
  7. public plugin_init()
  8. {
  9.     register_plugin("[ZE] Darkness Round", "1.0", "Raheem")
  10.    
  11.     // Dark round false
  12.     g_bDarkRound = false
  13. }
  14.  
  15. public ze_game_started()
  16. {
  17.     if (ze_get_round_number() == 10)
  18.     {
  19.         for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
  20.         {
  21.             if (!is_user_connected(id))
  22.                 continue
  23.         }
  24.  
  25.         server_cmd("ze_lighting_style a")
  26.         g_bDarkRound = true
  27.         ze_colored_print(0, "!tIt's too late!y, !tSurvive the darkness if you can!g!!")
  28.     }
  29. }
  30.  
  31. public ze_roundend(WinTeam)
  32. {
  33.     if (g_bDarkRound == true)
  34.     {
  35.         server_cmd("ze_lighting_style %s", DEFAULT_LIGHT)
  36.         g_bDarkRound = false
  37.     }
  38. }
Image

User avatar
Jack GamePlay
Mod Developer
Mod Developer
Egypt
Posts: 534
Joined: 1 Year Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 42 times
Age: 19
Contact:

#5

Post by Jack GamePlay » 4 Months Ago

Fixed?
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest