Raised This Month: $32 Target: $400
 8% 

[CSGO]This is the model error or plug-in error?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
2389736818
Member
Join Date: Jul 2014
Location: China
Old 10-29-2016 , 01:27   [CSGO]This is the model error or plug-in error?
Reply With Quote #1

PHP Code:
/****************************************************
ANY THING TO DO WITH THE MENU IS PUT INTO THIS FILE!
****************************************************/

new Handle:MainMenu INVALID_HANDLE;
new 
Handle:HumanSkinsMenu INVALID_HANDLE;
new 
Handle:ZombieSkinsMenu INVALID_HANDLE;
new 
Handle:AmbienceMenu INVALID_HANDLE;
new 
String:human_skin[MAXPLAYERS+1];
new 
String:zombie_skin[MAXPLAYERS+1];
new 
String:zombie_chose[MAXPLAYERS+1];
new 
String:human_chose[MAXPLAYERS+1];
new 
String:Ambience_enabled[MAXPLAYERS+1];

// Perks
//static const String:ctperks[3][] = {"Citizen","Burned","Corpse"};
//static const String:tperks[3][] = {"none","Infected","Marked","Respawn","Speed"};

// Names of the skins
static const String:ctskins[8][] = {"Death Stroke","Sheva Alomar","Sherry Birkin","Duke Nukem","Piers Nivans","Helena Harper","Solid Snake","Ada Wong"};
static const 
String:tskins[4][] = {"Csgo_Zombie","Csgo_Predator","Grim","Witch"};

// mdl file locations for the skins
static const String:tmodels[4][] = {"models/player/zh/zh_zombie003.mdl","models/player/avp/csgo_predator.mdl","models/player/monster/grim/grim.mdl","models/player/monster/witch/witch.mdl"};
static const 
String:ctmodels[8][] = {"models/player/deathstroke/deathstroke.mdl","models/player/resident/sheva_alomar/sheva_alomar.mdl","models/player/resident/sherry6/sherry6.mdl","models/player/kuristaja/duke/duke.mdl","models/player/resident/piers6/piers6.mdl","models/player/resident/helena6/helena6.mdl","models/player/deathstroke/deathstroke2.mdl","models/player/kuristaja/re6/ada/adav2.mdl"};

public 
Action:zhrmenustart(Handle:timer)
{
    
MainMenu CreateMenu(MainMenuHandler1);
    
SetMenuTitle(MainMenu"ZHR Menu");
    
AddMenuItem(MainMenu"hskins""Human Skins");
    
AddMenuItem(MainMenu"zskins""Zombie Skins");
    
AddMenuItem(MainMenu"sounds""Ambience");
    
//    AddMenuItem(MainMenu, "hperks", "Human Perks");
//    AddMenuItem(MainMenu, "zperks", "Zombie Perks");
    
    // Human skins menu
    
HumanSkinsMenu CreateMenu(HSkinMenuHandler2);
    
SetMenuTitle(HumanSkinsMenu"Choose your skin");
    for (new 
08i++)
        
AddMenuItem(HumanSkinsMenuctskins[i], ctskins[i]);
        
    
// Zombie skins menu
    
ZombieSkinsMenu CreateMenu(ZSkinMenuHandler2);
    
SetMenuTitle(ZombieSkinsMenu"Choose your skin");
    for (new 
04i++)
        
AddMenuItem(ZombieSkinsMenutskins[i], tskins[i]);

/*        
    // Human perks
    HumanPerksMenu = CreateMenu(HPerksMenuHandler3);
    SetMenuTitle(HumanperksMenu, "Choose your Perk");
    
    // zombie perks
    ZombiePerksMenu = CreateMenu(ZPerksMenuHandler3);
    SetMenuTitle(ZombieperksMenu, "Choose your Perk");
*/

    // sounds menu
    
AmbienceMenu CreateMenu(AmbienceMenuHandler4);
    
SetMenuTitle(AmbienceMenu"Ambience Menu");
    
AddMenuItem(AmbienceMenu"on""On");
    
AddMenuItem(AmbienceMenu"off""Off");
    
    
// Hooks to do with menu
    
HookEvent("player_spawn"Menuspawn);
    
    
RegConsoleCmd("sm_zhr"zhr);
}

// Menu Handlers
public MainMenuHandler1(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_Select)
    {
        switch (
param2)
        {
            case 
0:
                
DisplayMenu(HumanSkinsMenuparam160);
            case 
1:
                
DisplayMenu(ZombieSkinsMenuparam160);
            case 
2:
                
DisplayMenu(AmbienceMenuparam160);
            
/*
            case 3:
                DisplayMenu(HumanPerksMenu, param1, 60);
            case 4:
                DisplayMenu(ZombiePerksMenu, param1, 60);
            */
        
}
    }
}

public 
HSkinMenuHandler2(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_Select)
    {
        switch (
param2)
        {
            case 
0,1,2,3,4,5,6,7:
            {
                
human_skin[param1] = param2;
                
human_chose[param1] = 1;
            }
        }    
    }
}

public 
ZSkinMenuHandler2(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_Select)
    {
        switch (
param2)
        {
            case 
0,1,2,3:
            {
                
zombie_skin[param1] = param2;
                
zombie_chose[param1] = 1;
            }
        }
    }
}

public 
AmbienceMenuHandler4(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_Select)
    {
        switch (
param2)
        {
            case 
0:
                
Ambience_enabled[param1] = 0;
            case 
1:
                
Ambience_enabled[param1] = 1;
        }
    }
}
 
public 
Action:zhr(clientargs)
{
    
DisplayMenu(MainMenuclient60);
    return 
Plugin_Handled;


/*********************************************************************************
FROM HERE WILL HAVE ALL THE ACTIONS LIKE SPAWNING THAT ARE CONNECTED TO THE MENU
*********************************************************************************/
public Action:Menuspawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event,"userid"));
    
    
//Plays Ambience Sound
    
if (Ambience_enabled[client] != 0)
        
PrintToChat(client"You have disabled the ambience sound!");
        
    else
        
EmitSoundToClient(client"zh/ambience/ambience.mp3");
    
    
// Sets player model on spawn
    
if ( GetClientTeamclient ) == CS_TEAM_CT )
    {
        if (
human_chose[client] == 1)    
        {
            
SetEntityModel(clientctmodels[human_skin[client]]);
            
SetEntityRenderColor(client255255255255);
        }
        else
        {
            new 
random2 GetRandomInt(07);
            
SetEntityModel(clientctmodels[random2]);
            
SetEntityRenderColor(client255255255255);
        }
    }
    
    else if ( 
GetClientTeamclient ) == CS_TEAM_T )
    {
        if (
zombie_chose[client] == 1)        
        {
            
SetEntityModel(clienttmodels[zombie_skin[client]]);
            
SetEntityRenderColor(client255255255255);
        }
        else    
        {
            new 
random GetRandomInt(03);
            
SetEntityModel(clienttmodels[random]);
            
SetEntityRenderColor(client255255255255);
        }
    }

I need help
Attached Thumbnails
Click image for larger version

Name:	20161029132256.png
Views:	120
Size:	21.9 KB
ID:	158241  
__________________

Last edited by 2389736818; 10-29-2016 at 01:29.
2389736818 is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 10-29-2016 , 01:31   Re: [CSGO]This is the model error or plug-in error?
Reply With Quote #2

That's because you forgot to precache the models used by your plugin.

Just add:
PHP Code:
public void OnMapStart()
{
    for (new 
0sizeof(tmodels); i++)
    {
        if (
FileExists(tmodels[i])) // if it exist for other players, just precache.
        
{
            
PrecacheModel(tmodels[i], true);
        }
    }
    
    for (new 
0sizeof(ctmodels); i++)
    {
        if (
FileExists(ctmodels[i])) // do the same for the other models.
        
{
            
PrecacheModel(ctmodels[i], true);
        }
    }

That should take care of that engine error but if it still persists, the only reason would be that particular model is not found in your current game's/server's models folder.

And may I ask why HookEvent and RegConsoleCmd are in a timer, shouldn't those be in OnPluginStart()?

Last edited by cravenge; 10-29-2016 at 01:44.
cravenge is offline
2389736818
Member
Join Date: Jul 2014
Location: China
Old 10-29-2016 , 09:58   Re: [CSGO]This is the model error or plug-in error?
Reply With Quote #3

I successfully repaired it .
PHP Code:
/****************************************************
ANY THING TO DO WITH THE MENU IS PUT INTO THIS FILE!
****************************************************/

new Handle:MainMenu INVALID_HANDLE;
new 
Handle:HumanSkinsMenu INVALID_HANDLE;
new 
Handle:ZombieSkinsMenu INVALID_HANDLE;
new 
Handle:AmbienceMenu INVALID_HANDLE;
new 
String:human_skin[MAXPLAYERS+1];
new 
String:zombie_skin[MAXPLAYERS+1];
new 
String:zombie_chose[MAXPLAYERS+1];
new 
String:human_chose[MAXPLAYERS+1];
new 
String:Ambience_enabled[MAXPLAYERS+1];

void Precache()
{
    
PrecacheModel("models/player/zh/zh_zombie003.mdl"); //
    
PrecacheModel("models/player/avp/csgo_predator.mdl"); //
    
PrecacheModel("models/player/monster/grim/grim.mdl"); //
    
PrecacheModel("models/player/monster/witch/witch.mdl"); //
    
PrecacheModel("models/player/deathstroke/deathstroke.mdl"); //
    
PrecacheModel("models/player/resident/sheva_alomar/sheva_alomar.mdl"); //
    
PrecacheModel("models/player/resident/sherry6/sherry6.mdl"); //
    
PrecacheModel("models/player/kuristaja/duke/duke.mdl"); //
    
PrecacheModel("models/player/resident/piers6/piers6.mdl"); //
    
PrecacheModel("models/player/resident/helena6/helena6.mdl"); //
    
PrecacheModel("models/player/deathstroke/deathstroke2.mdl"); //
    
PrecacheModel("models/player/kuristaja/re6/ada/adav2.mdl"); //
}

// Perks
//static const String:ctperks[3][] = {"Citizen","Burned","Corpse"};
//static const String:tperks[3][] = {"none","Infected","Marked","Respawn","Speed"};

// Names of the skins
static const String:ctskins[8][] = {"Death Stroke","Sheva Alomar","Sherry Birkin","Duke Nukem","Piers Nivans","Helena Harper","Solid Snake","Ada Wong"};
static const 
String:tskins[4][] = {"Csgo_Zombie","Csgo_Predator","Grim","Witch"};

// mdl file locations for the skins
static const String:tmodels[4][] = {"models/player/zh/zh_zombie003.mdl","models/player/avp/csgo_predator.mdl","models/player/monster/grim/grim.mdl","models/player/monster/witch/witch.mdl"};
static const 
String:ctmodels[8][] = {"models/player/deathstroke/deathstroke.mdl","models/player/resident/sheva_alomar/sheva_alomar.mdl","models/player/resident/sherry6/sherry6.mdl","models/player/kuristaja/duke/duke.mdl","models/player/resident/piers6/piers6.mdl","models/player/resident/helena6/helena6.mdl","models/player/deathstroke/deathstroke2.mdl","models/player/kuristaja/re6/ada/adav2.mdl"};

public 
Action:zhrmenustart(Handle:timer)
{
    
MainMenu CreateMenu(MainMenuHandler1);
    
SetMenuTitle(MainMenu"ZHR Menu");
    
AddMenuItem(MainMenu"hskins""Human Skins");
    
AddMenuItem(MainMenu"zskins""Zombie Skins");
    
AddMenuItem(MainMenu"sounds""Ambience");
    
//    AddMenuItem(MainMenu, "hperks", "Human Perks");
//    AddMenuItem(MainMenu, "zperks", "Zombie Perks");
    
    // Human skins menu
    
HumanSkinsMenu CreateMenu(HSkinMenuHandler2);
    
SetMenuTitle(HumanSkinsMenu"Choose your skin");
    for (new 
08i++)
        
AddMenuItem(HumanSkinsMenuctskins[i], ctskins[i]);
        
    
// Zombie skins menu
    
ZombieSkinsMenu CreateMenu(ZSkinMenuHandler2);
    
SetMenuTitle(ZombieSkinsMenu"Choose your skin");
    for (new 
04i++)
        
AddMenuItem(ZombieSkinsMenutskins[i], tskins[i]);

/*        
    // Human perks
    HumanPerksMenu = CreateMenu(HPerksMenuHandler3);
    SetMenuTitle(HumanperksMenu, "Choose your Perk");
    
    // zombie perks
    ZombiePerksMenu = CreateMenu(ZPerksMenuHandler3);
    SetMenuTitle(ZombieperksMenu, "Choose your Perk");
*/

    // sounds menu
    
AmbienceMenu CreateMenu(AmbienceMenuHandler4);
    
SetMenuTitle(AmbienceMenu"Ambience Menu");
    
AddMenuItem(AmbienceMenu"on""On");
    
AddMenuItem(AmbienceMenu"off""Off");
    
    
// Hooks to do with menu
    
HookEvent("player_spawn"Menuspawn);
    
    
RegConsoleCmd("sm_zhr"zhr);
}

// Menu Handlers
public MainMenuHandler1(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_Select)
    {
        switch (
param2)
        {
            case 
0:
                
DisplayMenu(HumanSkinsMenuparam160);
            case 
1:
                
DisplayMenu(ZombieSkinsMenuparam160);
            case 
2:
                
DisplayMenu(AmbienceMenuparam160);
            
/*
            case 3:
                DisplayMenu(HumanPerksMenu, param1, 60);
            case 4:
                DisplayMenu(ZombiePerksMenu, param1, 60);
            */
        
}
    }
}

public 
HSkinMenuHandler2(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_Select)
    {
        switch (
param2)
        {
            case 
0,1,2,3,4,5,6,7:
            {
                
human_skin[param1] = param2;
                
human_chose[param1] = 1;
            }
        }    
    }
}

public 
ZSkinMenuHandler2(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_Select)
    {
        switch (
param2)
        {
            case 
0,1,2,3:
            {
                
zombie_skin[param1] = param2;
                
zombie_chose[param1] = 1;
            }
        }
    }
}

public 
AmbienceMenuHandler4(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_Select)
    {
        switch (
param2)
        {
            case 
0:
                
Ambience_enabled[param1] = 0;
            case 
1:
                
Ambience_enabled[param1] = 1;
        }
    }
}
 
public 
Action:zhr(clientargs)
{
    
DisplayMenu(MainMenuclient60);
    return 
Plugin_Handled;


/*********************************************************************************
FROM HERE WILL HAVE ALL THE ACTIONS LIKE SPAWNING THAT ARE CONNECTED TO THE MENU
*********************************************************************************/
public Action:Menuspawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event,"userid"));
    
    
//Plays Ambience Sound
    
if (Ambience_enabled[client] != 0)
        
PrintToChat(client"You have disabled the ambience sound!");
        
    else
        
EmitSoundToClient(client"zh/ambience/ambience.mp3");
    
    
// Sets player model on spawn
    
if ( GetClientTeamclient ) == CS_TEAM_CT )
    {
        if (
human_chose[client] == 1)    
        {
            
SetEntityModel(clientctmodels[human_skin[client]]);
            
SetEntityRenderColor(client255255255255);
        }
        else
        {
            new 
random2 GetRandomInt(07);
            
SetEntityModel(clientctmodels[random2]);
            
SetEntityRenderColor(client255255255255);
        }
    }
    
    else if ( 
GetClientTeamclient ) == CS_TEAM_T )
    {
        if (
zombie_chose[client] == 1)        
        {
            
SetEntityModel(clienttmodels[zombie_skin[client]]);
            
SetEntityRenderColor(client255255255255);
        }
        else    
        {
            new 
random GetRandomInt(03);
            
SetEntityModel(clienttmodels[random]);
            
SetEntityRenderColor(client255255255255);
        }
    }

And I also found this code is zhr.sp
PHP Code:
/public OnMapStart()
{
    
// Resets alot of things like counters so they do not carry on from last map
    
g_iCount 0;
    
g_round 0;
    
g_score_t 0;
    
g_score_ct 0;
    
IsSwap false;
    
    
// runs precached and download tables
    
InitPrecache();
    
    
// Somethings for some code i copied
    
g_team_side CS_TEAM_T;
    for(new 
i=0;i<=MAXPLAYERS;i++)
        
IsBlockSwitchTeam[i] = false;
    
    
// Runs zhr.cfg in the cfg/sourcemod folder
    
AutoExecConfig(true"zhr","sourcemod");
    
    
// Darkness
    
SetLightStyle(0"b");

    
// If disabled in zhr.cfg this will be over written at end of warmup just sets HS only in warmup
    
ServerCommand("zhr_headshotonly_enabled 1");
    
    
// Warmup timer-start
    
CreateTimer(1.0warmuptimer);
    
    
// Advert timers-start
    
CreateTimer(180.0advert_TIMER_REPEAT);
    
    
// One off timer for first round
    
CreateTimer(60.0advert);
    

__________________

Last edited by 2389736818; 10-29-2016 at 10:08.
2389736818 is offline
2389736818
Member
Join Date: Jul 2014
Location: China
Old 10-29-2016 , 11:16   Re: [CSGO]This is the model error or plug-in error?
Reply With Quote #4

I was successful .
PHP Code:
public OnMapStart()
{
    
// Resets alot of things like counters so they do not carry on from last map
    
g_iCount 0;
    
g_round 0;
    
g_score_t 0;
    
g_score_ct 0;
    
IsSwap false;
    
    
// runs precached and download tables
    
InitPrecache();
    {
    
PrecacheModel("models/player/zh/zh_zombie003.mdl"); //
    
PrecacheModel("models/player/avp/csgo_predator.mdl"); //
    
PrecacheModel("models/player/monster/grim/grim.mdl"); //
    
PrecacheModel("models/player/monster/witch/witch.mdl"); //
    
PrecacheModel("models/player/deathstroke/deathstroke.mdl"); //
    
PrecacheModel("models/player/resident/sheva_alomar/sheva_alomar.mdl"); //
    
PrecacheModel("models/player/resident/sherry6/sherry6.mdl"); //
    
PrecacheModel("models/player/kuristaja/duke/duke.mdl"); //
    
PrecacheModel("models/player/resident/piers6/piers6.mdl"); //
    
PrecacheModel("models/player/resident/helena6/helena6.mdl"); //
    
PrecacheModel("models/player/deathstroke/deathstroke2.mdl"); //
    
PrecacheModel("models/player/kuristaja/re6/ada/adav2.mdl"); //
   
}
    
    
// Somethings for some code i copied
    
g_team_side CS_TEAM_T;
    for(new 
i=0;i<=MAXPLAYERS;i++)
        
IsBlockSwitchTeam[i] = false;
    
    
// Runs zhr.cfg in the cfg/sourcemod folder
    
AutoExecConfig(true"zhr","sourcemod");
    
    
// Darkness
    
SetLightStyle(0"b");

    
// If disabled in zhr.cfg this will be over written at end of warmup just sets HS only in warmup
    
ServerCommand("zhr_headshotonly_enabled 1");
    
    
// Warmup timer-start
    
CreateTimer(1.0warmuptimer);
    
    
// Advert timers-start
    
CreateTimer(180.0advert_TIMER_REPEAT);
    
    
// One off timer for first round
    
CreateTimer(60.0advert);
    

__________________
2389736818 is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 10-30-2016 , 10:56   Re: [CSGO]This is the model error or plug-in error?
Reply With Quote #5

A word of advice, remove the brackets as you're not checking on something and instead of precaching the models one by one, how about trying my suggested one?

I know it's still the same but by that way, models can be precached quickly and prevent "Late precache of <model name here>" from popping up in your server.
cravenge is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:39.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode