AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   change the player speed (https://forums.alliedmods.net/showthread.php?t=90027)

Anggara_nothing 04-13-2009 06:28

change the player speed
 
PHP Code:

/*================================================================================
    
    -----------------------------------
    -*- [ZP] Zombie Classes Example -*-
    -----------------------------------
    
    ~~~~~~~~~~~~~~~
    - Description -
    ~~~~~~~~~~~~~~~
    
    This is just an example on how to add additional zombie classes in ZP.
    
================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

// Zombie Attributes
new const zclass_name[] = { "My Zombie" // name
new const zclass_info[] = { "My Stats" // description
new const zclass_model[] = { "zombie_source" // model
new const zclass_clawmodel[] = { "v_knife_zombie.mdl" // claw model
const zclass_health 1800 // health
const zclass_speed 190 // speed
const Float:zclass_gravity 1.0 // gravity
const Float:zclass_knockback 1.0 // knockback

// Class IDs
new g_zclassid1

// Zombie Classes MUST be registered on plugin_precache
public plugin_precache()
{
    
register_plugin("[ZP] Additional Zombie Classes""0.1""Example")
    
register_event("DeathMsg""hc_death""b")
    
register_event("HLTV""hc_newround""a""1=0""2=0")
    
    
// Register the new class and store ID for reference
    
g_zclassid1 zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)    
}

// User Infected forward
public zp_user_infected_post(idinfector)
{
    if(!
is_user_alive(id))
        return;
    
    
// Check if the infected player is using our custom zombie class
    
if (zp_get_user_zombie_class(id) == g_zclassid1)
    {
        
set_pev(idpev_bInDuck1)
        
console_cmd(id"+duck")
        
client_print(idprint_chat"[ZP] You're using a headcrab class!")
    }
}

public 
hc_death(id)
{
    if(
is_user_alive(id))
        return 
PLUGIN_HANDLED
    
    set_pev
(idpev_bInDuck0)
    
console_cmd(id"-duck")
    
console_cmd(id"-duck")
    
    return 
PLUGIN_HANDLED
}

public 
hc_newround()
{
    
set_pev(idpev_bInDuck0)
    
console_cmd(id"-duck")
    
console_cmd(id"-duck")


How to change the player speed if the player is duck ???
thanks for you help.:)

Shard 04-13-2009 12:33

Re: change the player speed
 
Ducking reduces a percentage of the maximum speed of a person. So maybe, you can try making the maximum speed of the zombie higher, so the duck speed would be higher. If you want to know about not affecting the maximum speed, that one i do not know sorry.

Anggara_nothing 04-14-2009 02:12

Re: change the player speed
 
Quote:

Originally Posted by Shard (Post 804591)
Ducking reduces a percentage of the maximum speed of a person. So maybe, you can try making the maximum speed of the zombie higher, so the duck speed would be higher. If you want to know about not affecting the maximum speed, that one i do not know sorry.

i try to add "set_user_maxspeed(id, ....)" and not working. why?

alan_el_more 04-14-2009 08:37

Re: change the player speed
 
Have you used a float?

SnoW 04-15-2009 08:28

Re: change the player speed
 
Since you are using fakemeta, there's no need for fun is there? Uc_handle + pev_maxspeed. There's also threads about this on the same forum, so search.

Arkshine 04-15-2009 08:38

Re: change the player speed
 
Using native fun is more efficient than pev(). It doesn't matter the module used.

Anggara_nothing 04-15-2009 08:42

Re: change the player speed
 
Quote:

Originally Posted by SnoW (Post 805916)
Since you are using fakemeta, there's no need for fun is there? Uc_handle + pev_maxspeed. There's also threads about this on the same forum, so search.

look like this:
https://forums.alliedmods.net/showpo...33&postcount=3

SnoW 04-15-2009 08:48

Re: change the player speed
 
Quote:

Originally Posted by arkshine (Post 805924)
Using native fun is more efficient than pev(). It doesn't matter the module used.

Sure, if other plugins are using fun as well, so it can't be disabled.
In my last server I had cstrike, engine and fun disabled, though dunno if it would be better to make less native calls and more modules. But aye it's just me, so here fun's better, suposing he's using fun.

Anggara_nothing 04-15-2009 08:55

Re: change the player speed
 
Quote:

Originally Posted by arkshine (Post 805924)
Using native fun is more efficient than pev(). It doesn't matter the module used.

are you can give me example code ??? please.

SnoW 04-15-2009 13:21

Re: change the player speed
 
Quote:

Originally Posted by Anggara_nothing (Post 805941)
are you can give me example code ??? please.

How about the code u linked, what's wrong with that?


All times are GMT -4. The time now is 02:16.

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