AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Solved model problem (https://forums.alliedmods.net/showthread.php?t=318598)

generals 09-09-2019 08:11

model problem
 
hi guys

i want to add model to end human

whats the problem?

i waiting for your help.. tnx

PHP Code:

#include <sourcemod>
#include <sdktools>

new Handle:hModel INVALID_HANDLE;

new 
String:model[256];

public 
OnPluginStart()
{
    
hModel CreateConVar("lh_model""models/player/bunny/bunny_funny.mdl");

    
HookEvent("round_end"Event_OnRoundEnd);
}

public 
OnMapStart()
{
    
GetConVarString(hModelmodelsizeof(model));
    
AddFileToDownloadsTable(model);
    
PrecacheModel(model);
}

public 
Event_OnRoundEnd(Handle:event, const String:name[], bool:silent)
{
    new 
CountPlayer 0Client 0;

    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && IsPlayerAlive(i))
        {
            
CountPlayer++;
            
Client i;
        }
    }

    if (
CountPlayer == && Client 0)
    {
        
SetEntityModel(Clientmodel);
    }



Cruze 09-09-2019 22:11

Re: model problem
 
PHP Code:

#include <sourcemod>
#include <sdktools>

new Handle:hModel INVALID_HANDLE;

new 
String:model[256];

public 
OnPluginStart()
{
    
hModel CreateConVar("lh_model""player/bunny/bunny_funny.mdl");

    
HookEvent("round_end"Event_OnRoundEnd);
}

public 
OnMapStart()
{
    new 
String:buffer[256];
    
GetConVarString(hModelmodelsizeof(model));
    
PrecacheModel(model);
    
Format(buffersizeof(buffer), "sound/%s"model);
    
AddFileToDownloadsTable(buffer);
}

public 
Event_OnRoundEnd(Handle:event, const String:name[], bool:silent)
{
    new 
CountPlayer 0Client 0;

    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && IsPlayerAlive(i))
        {
            
CountPlayer++;
            
Client i;
        }
    }

    if (
CountPlayer == && Client 0)
    {
        
SetEntityModel(Clientmodel);
    }



generals 09-10-2019 03:26

Re: model problem
 
hi

really thanks .. but don't worked

why used (sound/%s) ?

i changed it to (models/%s) and i used (ZR_IsClientHuman(i)) but don't work again :(

what can i do?

PHP Code:

#include <sourcemod>
#include <sdktools>
#include <zombiereloaded>

new Handle:hModel INVALID_HANDLE;

new 
String:model[256];

public 
OnPluginStart()
{
    
hModel CreateConVar("lh_model""player/bunny/bunny_funny.mdl");

    
HookEvent("round_end"Event_OnRoundEnd);
}

public 
OnMapStart()
{
    new 
String:buffer[256];
    
GetConVarString(hModelmodelsizeof(model));
    
PrecacheModel(model);
    
Format(buffersizeof(buffer), "models/%s"model);
    
AddFileToDownloadsTable(buffer);
}

public 
Event_OnRoundEnd(Handle:event, const String:name[], bool:silent)
{
    new 
CountPlayer 0Client 0;

    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && IsPlayerAlive(i) && ZR_IsClientHuman(i))
        {
            
CountPlayer++;
            
Client i;
        }
    }

    if (
CountPlayer == && Client 0)
    {
        
SetEntityModel(Clientmodel);
    }



Cruze 09-11-2019 01:11

Re: model problem
 
Quote:

Originally Posted by generals (Post 2666480)

why used (sound/%s) ?

Yeah my bad :oops:
Quote:

i changed it to (models/%s) and i used (ZR_IsClientHuman(i)) but don't work again :(

what can i do?

Check error logs

8guawong 09-11-2019 02:51

Re: model problem
 
do you want the last human to have the skin NEXT round? Or do you only want to set the player's model before the next round starts?

generals 09-11-2019 08:13

Re: model problem
 
Quote:

Originally Posted by Cruze (Post 2666620)
Yeah my bad :oops:

Check error logs

no error logs.. plugin don't work .. doesn't change model

Quote:

Originally Posted by 8guawong (Post 2666625)
do you want the last human to have the skin NEXT round? Or do you only want to set the player's model before the next round starts?

i want to set player model before the next round start .. after round end player model back to the default

generals 09-13-2019 14:27

Re: model problem
 
hi again

this can help?

https://forums.alliedmods.net/showth...ighlight=human
https://forums.alliedmods.net/showth...ighlight=human

8guawong 09-20-2019 09:29

Re: model problem
 
Quote:

Originally Posted by generals (Post 2666641)
no error logs.. plugin don't work .. doesn't change model



i want to set player model before the next round start .. after round end player model back to the default

hi you save the index of last human
and on player spawn if the index match the index of last human than set the player's model to what you want

generals 09-20-2019 16:35

Re: model problem
 
Quote:

Originally Posted by 8guawong (Post 2667684)
hi you save the index of last human
and on player spawn if the index match the index of last human than set the player's model to what you want

hi

how can i fix this? please.. can u help me ?

Cruze 09-21-2019 07:50

Re: model problem
 
PHP Code:

#include <sourcemod>
#include <sdktools>
#include <zombiereloaded>

new Handle:hModel INVALID_HANDLE;

new 
String:model[256];

new 
bool:g_Winner[MAXPLAYERS+1];

public 
OnPluginStart()
{
    
hModel CreateConVar("lh_model""player/bunny/bunny_funny.mdl");

    
HookEvent("player_spawn"Event_OnPlayerSpawn
    HookEvent
("round_end"Event_OnRoundEnd);
}

public 
OnPlayerDisconnect(client)
{
    
g_Winner[client] = false;
}

public 
OnMapStart()
{
    new 
String:buffer[256];
    
GetConVarString(hModelmodelsizeof(model));
    
PrecacheModel(model);
    
Format(buffersizeof(buffer), "models/%s"model);
    
AddFileToDownloadsTable(buffer);
}

public 
Event_OnPlayerSpawn(Handle:event, const String:name[], bool:silent)
{
    
int client GetClientOfUserId(GetEventInt("userid"));
    if(
client && client <= MaxClients && IsClientInGame(client) && g_Winner[client])
    {
         
SetEntityModel(clientmodel);
    }
}

public 
Event_OnRoundEnd(Handle:event, const String:name[], bool:silent)
{
    new 
CountPlayer 0Client 0;

    for (new 
1<= MaxClientsi++)
    {
        
g_Winner[i] = false;
        if (
IsClientInGame(i) && IsPlayerAlive(i) && ZR_IsClientHuman(i))
        {
            
CountPlayer++;
            
Client i;
        }
    }

    if (
CountPlayer == && Client && Client <= MaxClients && IsClientInGame(Client))
    {
        
g_Winner[Client] = true;
    }




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

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