AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Weapon with grenade launcher. (https://forums.alliedmods.net/showthread.php?t=207211)

ratosluaf 01-31-2013 03:28

Weapon with grenade launcher.
 
I've just got smth like this:
Code:

public PlayerPreThink(id)
{
    if(!is_user_alive(id) || !ma_klase[id])
        return FMRES_IGNORED
   
    if((pev(id, pev_button) & IN_ATTACK2 && !(pev(id, pev_oldbuttons) & IN_ATTACK2)) && get_user_weapon(id) == CSW_GALIL) {
        if(ma_granatnik[id] == true) {
            set_task(1.0,"wylaczGranatnik", id+TASK_WYLACZGRANATNIK);
            UTIL_PlayWeaponAnimation(id, 11);
        }
        else if(ma_granatnik[id] == false) {
            set_task(1.0,"wlaczGranatnik", id+TASK_WLACZGRANATNIK);
            UTIL_PlayWeaponAnimation(id, 5);
        }
    }
   
    if(ma_granatnik[id] == true) {
        if((pev(id, pev_button) & IN_ATTACK && !(pev(id, pev_oldbuttons) & IN_ATTACK)) && get_user_weapon(id) == CSW_GALIL)
        {
            Stworz(id)
        }
    }
   
    return FMRES_IGNORED;
}
public wlaczGranatnik(id) {
    ma_granatnik[id] = true;
}
public wylaczGranatnik(id) {
    ma_granatnik[id] = false;
}

The code doesn't work. I just wanna to switch between weapon and grenade launcher with attack2 button. When click attack1 on grenade launcher, it does function "Stworz(id)".
Can anyone help me?

============
How can I easily get the animations ID? In .qc file there's nothing, only list.


All times are GMT -4. The time now is 20:30.

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