View Single Post
LenHard
Senior Member
Join Date: Jan 2016
Old 07-16-2018 , 22:50   Re: [CSGO] Thanos mode
Reply With Quote #13

Quote:
Originally Posted by mug1wara View Post
try this
PHP Code:
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

static int g_iModel;

static const 
char g_sModel[] = "models/player/custom_player/kaesar2018/thanos/thanos.mdl";

methodmap Thanos
{
    public static 
int Precache()
    {
        
g_iModel PrecacheModel(g_sModel);
        
        if (
g_iModel == 0)
        {
            
ThrowError("Precache Failed!");
        }
    }
};

public 
void OnPluginStart()
{
    
RegAdminCmd("sm_thanos"Cmd_ThanosADMFLAG_GENERIC);
}

public 
void OnMapStart()
{
    
AddFileToDownloadsTable(g_sModel);
}

public 
Action Cmd_Thanos(int iClientint iArgs)
{
    
Thanos.Precache();
    
    
PrintToChatAll("Thanos will appear in 30 secconds!");
    
    
SetEntityModel(iClientg_sModel);
    
    
SetEntityHealth(iClient200);
    
    
SetEntProp(iClientProp_Data"m_ArmorValue"2001);
    
    
SetEntityModel(iClientg_sModel);
    
    
SetEntPropFloat(iClientProp_Data"m_flMaxspeed"0.0);
    
    
CreateTimer(30.0Timer_UnfreezeiClient);
}

public 
Action Timer_Unfreeze(Handle hTimerint iClient)
{
    
SetEntPropFloat(iClientProp_Data"m_flMaxspeed"1.0);

Use SetEntityMoveType to freeze + unfreeze the player. (MOVETYPE_NONE to freeze; MOVETYPE_WALK to unfreeze)
Also, you don't need to precache the model everytime the command gets called, rather precache it once OnMapStart

Why are you using methodmaps for this? -.^
__________________
LenHard is offline