Raised This Month: $ Target: $400
 0% 

Keeping speed


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-07-2014 , 07:20  
Reply With Quote #2

You need to hold the state of speed in a variable and regive the speed eighter (and this is recommended) with hamsandwich or (don't use this) with the CurWeapon-Event.

Have a look:
PHP Code:
new hasSpeed[33]

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_CS_Player_ResetMaxSpeed"player""hamResetSpeedPost"true)
}

public 
hamResetSpeedPost(id)
{
    if(
hasSpeed[id])
    {
        
set_user_maxspeed(id600.0)
    }
}

public 
cmdVip(id)
{
    if(
get_user_flags(id) & VIP_LEVEL)
    {
        
hasSpeed[id] = 1
        set_user_maxspeed
(id600.0);
        
client_print(idprint_chat"You just activated your VIP attributes.");
        
client_print(idprint_chat"Just write /vipoff to switch them off.");
    }
    else
    {
        
client_print(idprint_chat"You're no VIP!");
    }
}

public 
cmdVipoff(id)
{
    if(
get_user_flags(id) & VIP_LEVEL)
    {
        
hasSpeed[id] = 0
        set_user_maxspeed
(id250.0);
        
client_print(idprint_chat"You just deactivated your VIP attributes.");
        
client_print(idprint_chat"Just write /vip to switch them back on.");
    }

For the skins thing:
You need to hook the spawn event (using hamsandwich) and then set the model. Also you don't need to precache your files twice.

Btw:
- Using a switch statement is bether than multiple if statements (line 65-72)
- You forgot the if-braces (line 47)
- pev_maxspeed vs set_user_maxspeed: This is pretty much a question of preference and modules. If you already include Fakemeta you could aswell use the pev-things and skip the Fun-module.

Last edited by mottzi; 07-07-2014 at 07:29.
mottzi is offline
Send a message via MSN to mottzi
 



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 21:14.


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