AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Delay Skin Replacement (https://forums.alliedmods.net/showthread.php?t=105346)

DruGzOG 10-03-2009 17:25

Delay Skin Replacement
 
Code:

#include <amxmodx>
#include <cstrike>

public plugin_init()
{
        register_plugin("Cookie Monster Battle", "1.0", "Author")
        register_event("ResetHUD", "resetModel", "b")
}

public plugin_precache()
{
        precache_model("models/player/cookie/cookie.mdl")
}

public resetModel(id)
{
    if (cs_get_user_team(id) == CS_TEAM_T)
        cs_set_user_model(id, "cookie")
    else
        cs_reset_user_model(id)
}

I want to delay the skin replacement by two seconds for the terrorist team. Any help?

Arkshine 10-03-2009 17:34

Re: Delay Skin Replacement
 
Use Ham_Spawn

DruGzOG 10-03-2009 17:34

Re: Delay Skin Replacement
 
Quote:

Originally Posted by Arkshine (Post 951434)
Use Ham_Spawn

care to show me an example? :)

HLM 10-03-2009 20:40

Re: Delay Skin Replacement
 
This should work..

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

public plugin_init()
{
        
register_plugin("Cookie Monster Battle""1.0""REPLACE THIS!!")
        
//register_event("ResetHUD", "resetModel", "b")
    
registerham(Ham_Spawn"player""resetModel"1)
}

public 
plugin_precache() 
{
        
precache_model("models/player/cookie/cookie.mdl")
}

public 
resetModel(id)
{
    if (
cs_get_user_team(id) == CS_TEAM_T//is this what we are delaying?
        
set_task(2.0"SetModel"id)
    
//cs_set_user_model(id, "cookie")
    
else
        
cs_reset_user_model(id)
}

public 
SetModel(id)
    
cs_set_user_model(id"cookie"

but be warned, I did NOT test this

SnoW 10-04-2009 03:54

Re: Delay Skin Replacement
 
Check if the user is alive.

alan_el_more 10-04-2009 06:02

Re: Delay Skin Replacement
 
and if is connected

SnoW 10-04-2009 06:16

Re: Delay Skin Replacement
 
Quote:

Originally Posted by alan_el_more (Post 951875)
and if is connected

No.

xPaw 10-04-2009 06:19

Re: Delay Skin Replacement
 
Quote:

Originally Posted by alan_el_more (Post 951875)
and if is connected

Show me example where user can be alive and not connected :twisted:

Arkshine 10-04-2009 06:50

Re: Delay Skin Replacement
 
I'm sure you know is_user_alive() checks if user is connected before. ^^

alan_el_more 10-04-2009 07:07

Re: Delay Skin Replacement
 
Sorry i'm very sleepy XD


All times are GMT -4. The time now is 22:36.

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