Raised This Month: $ Target: $400
 0% 

Delay Skin Replacement


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 10-03-2009 , 17:25   Delay Skin Replacement
Reply With Quote #1

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?
__________________
DruGzOG is offline
Send a message via AIM to DruGzOG
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-03-2009 , 17:34   Re: Delay Skin Replacement
Reply With Quote #2

Use Ham_Spawn
__________________
Arkshine is offline
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 10-03-2009 , 17:34   Re: Delay Skin Replacement
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
Use Ham_Spawn
care to show me an example?
__________________
DruGzOG is offline
Send a message via AIM to DruGzOG
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 10-03-2009 , 20:40   Re: Delay Skin Replacement
Reply With Quote #4

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
__________________
+|- KARMA Respectively


Last edited by HLM; 10-03-2009 at 20:41. Reason: php tags > small tags
HLM is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 10-04-2009 , 03:54   Re: Delay Skin Replacement
Reply With Quote #5

Check if the user is alive.
SnoW is offline
Send a message via MSN to SnoW
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 10-04-2009 , 06:02   Re: Delay Skin Replacement
Reply With Quote #6

and if is connected
__________________
alan_el_more is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 10-04-2009 , 06:16   Re: Delay Skin Replacement
Reply With Quote #7

Quote:
Originally Posted by alan_el_more View Post
and if is connected
No.
SnoW is offline
Send a message via MSN to SnoW
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 10-04-2009 , 06:19   Re: Delay Skin Replacement
Reply With Quote #8

Quote:
Originally Posted by alan_el_more View Post
and if is connected
Show me example where user can be alive and not connected
__________________
xPaw is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-04-2009 , 06:50   Re: Delay Skin Replacement
Reply With Quote #9

I'm sure you know is_user_alive() checks if user is connected before. ^^
__________________
Arkshine is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 10-04-2009 , 07:07   Re: Delay Skin Replacement
Reply With Quote #10

Sorry i'm very sleepy XD
__________________
alan_el_more is offline
Reply


Thread Tools
Display Modes

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 22:36.


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