[Include] OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo
#21

Nice one but i read that there are some problems (Read Riderґs post (in the snippets thread))
Reply
#22

This is awesome man, thanks alot.
Reply
#23

https://sampwiki.blast.hk/wiki/Playerstates

And use OnPlayerStateChange dont create new timer
Reply
#24

Quote:
Originally Posted by asdfgh98
View Post
Nice one but i read that there are some problems (Read Riderґs post (in the snippets thread))
Code:
/*
 *  To; Lorenc_
 *
 *      Sup.
*/

#include                        <a_samp>

/* ** Player Data ** */
new
    cur_Weapon_State[MAX_PLAYERS]
;

forward OnPlayerReload(playerid, weapon, ammo);
forward OnPlayerWeaponStateChange(playerid, newstate, oldstate);

public OnPlayerConnect(playerid)
{
    cur_Weapon_State[playerid] = WEAPONSTATE_UNKNOWN;
	return 1;
}

public OnPlayerUpdate(playerid)
{
	new iCurWeaponState = GetPlayerWeaponState(playerid);
    if(iCurWeaponState != cur_Weapon_State[playerid])
    {
        CallLocalFunction("OnPlayerWeaponStateChange", "ddd", playerid, iCurWeaponState, cur_Weapon_State[playerid]);
        cur_Weapon_State[playerid] = iCurWeaponState;
    }
    return CallRemoteFunction("Kar_OnPlayerUpdate", "d", playerid);
}

public OnPlayerWeaponStateChange(playerid, newstate, oldstate)
{
	if(newstate == WEAPONSTATE_RELOADING)
	{
	    CallRemoteFunction("OnPlayerReload", "ddd", playerid, GetPlayerWeapon(playerid), GetPlayerAmmo(playerid));
	}
	return 1;
}

#if defined _ALS_OnPlayerUpdate
    #undef OnPlayerUpdate
#else
    #define _ALS_OnPlayerUpdate
#endif
#define OnPlayerUpdate Kar_OnPlayerUpdate
forward OnPlayerUpdate(playerid);
Reply
#25

script updated,
now the INC runs properly& fastly
Reply
#26

I fixed my script, I edited the snippets page post though not here. Please note that I spent only 2 minutes making that lol.
Reply
#27

don't create from it a competition

LINKS UPDATED!
Reply
#28

Thanks...
Reply
#29

Quote:
Originally Posted by LZLo
View Post
don't create from it a competition

LINKS UPDATED!
It's not really a competition, it's to example a better way of creating what you wanted to create.
Reply
#30

Nice.
Gonna try anti reload hack with this include.
Reply
#31

Nice and simple
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)