SA-MP Forums Archive
[Include] OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo (/showthread.php?tid=275106)

Pages: 1 2


AW: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - asdfgh98 - 10.08.2011

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


Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - WillyP - 10.08.2011

This is awesome man, thanks alot.


Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - DRIFT_HUNTER - 10.08.2011

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

And use OnPlayerStateChange dont create new timer


Re: AW: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - Kar - 10.08.2011

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);



Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - LZLo - 10.08.2011

script updated,
now the INC runs properly& fastly


Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - Lorenc_ - 11.08.2011

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


Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - LZLo - 11.08.2011

don't create from it a competition

LINKS UPDATED!


Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - oFLu - 14.08.2011

Thanks...


Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - Lorenc_ - 14.08.2011

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.


Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - Kalroz - 28.07.2012

Nice.
Gonna try anti reload hack with this include.


Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - Plovix - 13.11.2012

Nice and simple