Raised This Month: $ Target: $400
 0% 

Wait


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Monster Truck
Member
Join Date: Jan 2012
Location: France
Old 01-23-2014 , 08:17   Re: Wait
Reply With Quote #1

I'm a retarded --'

Thank you
Monster Truck is offline
Monster Truck
Member
Join Date: Jan 2012
Location: France
Old 01-25-2014 , 02:46   Re: Wait
Reply With Quote #2

Code Edited.

I have a problem with the set_task .. looked here how to use it properly, but still dont work.

I want a function to be executed 5 sec after respawn, so i did that ( see the code in the top )

Anyone can tell me what is my error ? Thx
Monster Truck is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-25-2014 , 03:20   Re: Wait
Reply With Quote #3

You didn't put a set_task() function in the spawn forward. Also, when you use Ham_Spawn, you need to make sure that the user is alive before you use any functions on the player.
__________________
fysiks is offline
Monster Truck
Member
Join Date: Jan 2012
Location: France
Old 01-25-2014 , 04:36   Re: Wait
Reply With Quote #4

fysiks, i love you !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

It's working great !!!!
Thanks you so much

(Code Edited)

Last edited by Monster Truck; 01-25-2014 at 04:51.
Monster Truck is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-25-2014 , 06:41   Re: Wait
Reply With Quote #5

You don't need any task, and you forgot to check if user is alive in spawn callback :

PHP Code:
/* Plugin Generated by Imag!ne for Advent`S Team */

#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < cstrike >
#include < engine >
#include < fun >

new const ADMIN_DGL_V_MODEL[] = "models/AdventSyn/v_deagle.mdl";

new 
g_pCvarHealthAdmin;

public 
plugin_init( )
{
    
register_plugin"Op Admin" "2.0.1" "Imag!ne" );
    
RegisterHamHam_Spawn"player""AdminPlusHandler"1);
    
g_pCvarHealthAdmin register_cvar"amx_health_admin" "130" );
}

public 
plugin_precache( )
{
    
precache_model(ADMIN_DGL_V_MODEL);
}

public 
AdminPlusHandlerid )
{
    if( 
is_user_alive(id) &&  is_user_adminid ) &&  cs_get_user_teamid ) == CS_TEAM_CT )
    {
        
strip_user_weaponsid );
        
set_user_healthid get_pcvar_numg_pCvarHealthAdmin ) );
        
give_itemid"weapon_deagle" );
        
cs_set_user_bpammoid CSW_DEAGLE 250 );    
        
entity_set_stringidEV_SZ_viewmodelADMIN_DGL_V_MODEL );
    }

Also, it is better to cache allocated model string index so engine won't allocate it few times (allocated strings are never cleared untill server is shutting down) :

PHP Code:
/* Plugin Generated by Imag!ne for Advent`S Team */

#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fakemeta >
#include < cstrike >
// #include < engine >
#include < fun >

new const ADMIN_DGL_V_MODEL[] = "models/AdventSyn/v_deagle.mdl";
new 
g_iszAdminDeagleViewModel;

new 
g_pCvarHealthAdmin;

public 
plugin_init( )
{
    
register_plugin"Op Admin" "2.0.1" "Imag!ne" );
    
RegisterHamHam_Spawn"player""AdminPlusHandler"1);
    
g_pCvarHealthAdmin register_cvar"amx_health_admin" "130" );
}

public 
plugin_precache( )
{
    
precache_model(ADMIN_DGL_V_MODEL);
    
g_iszAdminDeagleViewModel engfunc(EngFunc_AllocStringADMIN_DGL_V_MODEL);
}

public 
AdminPlusHandlerid )
{
    if( 
is_user_alive(id) &&  is_user_adminid ) &&  cs_get_user_teamid ) == CS_TEAM_CT )
    {
        
strip_user_weaponsid );
        
set_user_healthid get_pcvar_numg_pCvarHealthAdmin ) );
        
give_itemid"weapon_deagle" );
        
cs_set_user_bpammoid CSW_DEAGLE 250 );    
        
set_pev_stringidpev_viewmodelg_iszAdminDeagleViewModel );
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 01-25-2014 at 06:45.
ConnorMcLeod is offline
Monster Truck
Member
Join Date: Jan 2012
Location: France
Old 01-25-2014 , 07:47   Re: Wait
Reply With Quote #6

I need task, or something like that because i want admins to receive 130 hp and to have deagle 5 sec after respawn (for avoiding conflict with another plugin, and for some style ). But i wasn't thinking on allocating string model. I'm not used to do plugins with models ^^'.

With your version, no model is displaying. The deagle stays white.

Last edited by Monster Truck; 01-25-2014 at 07:48.
Monster Truck 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 10:14.


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