AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Buttons and OldButtons (https://forums.alliedmods.net/showthread.php?t=230001)

Jhob94 11-18-2013 08:12

Buttons and OldButtons
 
I am currently working at naruto mod and i need to know if iam doing this correctly:
PHP Code:

public PlayerPreThink(id)
{
    new 
button pev(idpev_button)
    new 
oldbuttons pev(idpev_oldbuttons)
    
    if(
buttons IN_ATTACK2 && !(oldbuttons IN_ATTACK2)) // Press One Time In Attack2, start using chakra
    
{
        
Attack_With_Chakra[id] = true
        set_task
(3.0"remove_attack_with_chakra"id)
    }
    
    if(
buttons IN_ATTACK && !(oldbuttons IN_ATTACK)) // Press One Time Attack and if using chakra, send the kunai
    
{
        if(
Attack_With_Chakra[id])
            
pull_kunai(id)
    }
    
    if(
buttons IN_USE && oldbuttons IN_USE// Reload Chakra
    
{
        if(
Chakra[id] < Max_Chakra[id])
            
Chakra[id]++
        
        else
            
client_print(idprint_center"You Reached Max Chakra!")
    }
    
    return 
FMRES_IGNORED
}

public 
remove_attack_with_chakra(id)
{
    
Attack_With_Chakra[id] = false


Also i need to know if player is moving or not for reload chakra and i need to detect if is using chackra (Attack_With_Chakra[id]) and moving at same time (For make player faster)


All times are GMT -4. The time now is 23:14.

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