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

Quote:
Originally Posted by asdfgh98
View Post
@Lorenc_ Make a better one if you can.
I would be posting it surely in the snippets place just for you sir!

Done, uses unix timestamp, char arrays + booleans & Hooked; How ever, not tested though should work.

Code:
/*
 *  To; asdfgh98
 *
 *      Hi!
 *
 *
 *  From; The guy that made something more better.
*/

#include 						<a_samp>

/* ** Player Data ** */
new
	bool: p_ReloadedCalled[MAX_PLAYERS char],
	p_Timestamp[MAX_PLAYERS char]
;

forward OnPlayerReload(playerid, weapon, ammo);

public OnPlayerUpdate(playerid)
{
    if(GetPlayerWeaponState(playerid) == WEAPONSTATE_RELOADING)
    {
		if(p_ReloadedCalled{playerid} == false)
		{
            p_ReloadedCalled{playerid} = true;
            p_Timestamp{playerid} = gettime()+((30/2)/2); // CBS finding the total
            CallRemoteFunction("OnPlayerReload", "ddd", playerid, GetPlayerWeapon(playerid), GetPlayerAmmo(playerid));
		}
	}
	if(p_Timestamp{playerid} == gettime() && p_ReloadedCalled{playerid} == true)
	{
	    p_Timestamp{playerid} = 0, p_ReloadedCalled{playerid} = false;
	}
	return CallRemoteFunction("lorenc_OnPlayerUpdate", "d", playerid);
}

#if defined _ALS_OnPlayerUpdate
    #undef OnPlayerUpdate
#else
    #define _ALS_OnPlayerUpdate
#endif
#define OnPlayerUpdate lorenc_OnPlayerUpdate
forward OnPlayerUpdate(playerid);
To be used with:

Code:
public OnPlayerReload(playerid, weapon, ammo)
{
    return 1;
}
Reply


Messages In This Thread
OnPlayerReloading(playerid, weaponid, ammo) R4 - by LZLo - by LZLo - 08.08.2011, 11:21
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by FireCat - 08.08.2011, 11:23
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by LZLo - 08.08.2011, 11:26
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by Markx - 08.08.2011, 11:31
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by Lorenc_ - 08.08.2011, 11:34
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by LZLo - 08.08.2011, 11:38
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by leingod - 08.08.2011, 12:31
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by freshOrange - 08.08.2011, 12:34
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by CaHbKo - 08.08.2011, 12:42
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by TheArcher - 08.08.2011, 12:43
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by LZLo - 08.08.2011, 13:56
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by Kaperstone - 08.08.2011, 15:25
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by LZLo - 08.08.2011, 17:10
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by rbN. - 08.08.2011, 17:11
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by Basicz - 09.08.2011, 00:01
Re : OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by Soumi - 09.08.2011, 02:05
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by Lorenc_ - 09.08.2011, 07:50
AW: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by asdfgh98 - 09.08.2011, 08:37
Re: AW: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by Lorenc_ - 09.08.2011, 11:40
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by LZLo - 09.08.2011, 12:26
AW: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by asdfgh98 - 10.08.2011, 10:54
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by WillyP - 10.08.2011, 16:50
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by DRIFT_HUNTER - 10.08.2011, 16:53
Re: AW: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by Kar - 10.08.2011, 18:02
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by LZLo - 10.08.2011, 19:07
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by Lorenc_ - 11.08.2011, 07:57
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by LZLo - 11.08.2011, 10:30
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by oFLu - 14.08.2011, 21:02
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by Lorenc_ - 14.08.2011, 21:40
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by Kalroz - 28.07.2012, 04:38
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo - by Plovix - 13.11.2012, 09:24

Forum Jump:


Users browsing this thread: 3 Guest(s)