OnPlayerReloading(playerid, weaponid, ammo) R4 - by LZLo -
LZLo - 08.08.2011
Hello!
Here my plug& play INC's fourth Release.
PHP код:
forward OnPlayerReloading(playerid, weaponid, ammo);
You can add:
-GameTexts
-TextDraws
-Audio
-Animations
-etc.
to the reloading
Fixed in R4 - It pop up only on time - on one reloading
+ R4 in not compatible with Simple (police) Shotgun reloading.
(it Won't cause lag, timeout& shutdown)
Where can i get it?
Release 3 from pastebin -
http://pastebin.com/11yA1ziy
Release 4 from pastebin - http://pastebin.com/z4kwsreY
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
FireCat - 08.08.2011
Nice and easy.
I was thinking of doing this.
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
LZLo - 08.08.2011
Thanks!
Links Updated!
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
Markx - 08.08.2011
Good job! Very usefull!
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
Lorenc_ - 08.08.2011
Quote:
Originally Posted by LZLo
Hi all!
First you need to include it in your script (GM, FS, etc.) where do you want to use.
so: [/SIZE][/B] [B]Second: you need to use OnPlayerUpdate in your script
for example (you can find this example in the .inc file)
PHP код:
public OnPlayerUpdate(playerid)
{
return CallLocalFunction("L_OnplayerUpdate","i",playerid);
}
|
So, you've been scripting since 2006, ((2006 - 2011) = 5 years) and you don't know how to hook?
This is ment to be in your include not inside our scripts!
If you're being frustrated and cannot hook properly i'd advise you checkout y_hooks.
----
What's GetPlayerWeaponState meant for? observing? You have that, no need for such hassle and using onplayerupdate for scanning whether his reloading. Plus, do you relise how fast OnPlayerUpdate calls? more than 5 times in a second I'd say.
this include is useless..
pawn Код:
if(GetPlayerWeaponState(playerid) == WEAPON_STATE_RELOADING)
{
CallRemoteFunction("OnPlayerReload", "d", playerid);
}
3 lines of code takes over that include (may not be WEAPON_STATE_RELOADING)
----
"If you Like it CLICK a (reputation star) for me "
This script can cause lag, I mean you're checking on onplayerupdate more than 5 times in a second for some tall code. Pretty pointless, and that you're releasing something pretty un-useful to get some people to rep you.
The thing is, why does everyone want rep? To advertise there dead-line communitys (mostly roleplay) [MAY NOT BE YOUR SERVER]
Don't ask for rep, you'll earn if from how society thinks of you, just because you released some useless script it will not mean you're going to be getting it.
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
LZLo - 08.08.2011
I'm now feeling here the flavour of the Hungarian forum..
Mate and your server?
Don't you having a dead-line community??
Let's tell us!
I do not have a dead-line community in front of YOU!
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
leingod - 08.08.2011
Well i don't know the func is?
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
freshOrange - 08.08.2011
Hmm.. what's the point of this?
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
CaHbKo - 08.08.2011
Quote:
Originally Posted by LZLo
Mate and your server?
Don't you having a dead-line community??
Let's tell us!
I do not have a dead-line community in front of YOU!
|
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
TheArcher - 08.08.2011
Would be cool to add something. There's only a callback which is:
pawn Код:
forward OnPlayerReloading(playerid, weaponid, ammo);
Add anims when the player reload.
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
LZLo - 08.08.2011
release 3 is out now!
(i don't know why am i doing this)
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
Kaperstone - 08.08.2011
nice
i will use it...
thanks
Question: How i stop player from reloading ammo?
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
LZLo - 08.08.2011
ClearAnimations(playerid); maybe works
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
rbN. - 08.08.2011
Quote:
Originally Posted by xkirill
nice
i will use it...
thanks
Question: How i stop player from reloading ammo?
|
Try using ClearAnimations, or use TogglePlayerControllable like this:
Code:
TogglePlayerControllable(playerid, 0);
TogglePlayerControllable(playerid, 1);
not tested though
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
Basicz - 09.08.2011
You are funny with this
Code:
#tryinclude <foreach>
You aren't using it btw.. lol.
Re : OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
Soumi - 09.08.2011
Good job
, But can you create a function to force a player to reload his weapon like
Code:
ForcePlayerToReloadWeapon(playerid);
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
Lorenc_ - 09.08.2011
Quote:
Originally Posted by LZLo
I'm now feeling here the flavour of the Hungarian forum..
Mate and your server?
Don't you having a dead-line community??
Let's tell us!
I do not have a dead-line community in front of YOU!
|
I started my community lol, I can tell you, its growing without hosted tab!
This isn't just my server, I administrate on other servers and co-own
I don't see what the hell is the point of this release after all you just created a if statement and 2 variables,
I'd expect something way way way more unique from a scripter that had been scripting for '5' years. Your hooking is still failing, just go on and use y_hooks before you make yourself look pathetic and not unique. You seem to be just trying to hook to make yourself look unique, It's not unique and it only takes 3 seconds to write for me.
Lets say I have a clientmessage:
Code:
if(GetPlayerWeaponState(playerid) == 3)//WEAPONSTATE_RELOADING
{
SendClientMessage(playerid, -1, "Called");
}
Can you please count how many times that has been repeated?
Quote:
Originally Posted by Basicz
You are funny with this
Code:
#tryinclude <foreach>
You aren't using it btw.. lol.
|
True, another thing!
So explain how this makes you so great at scripting
Code:
public OnPlayerUpdate(playerid)
{
if(GetPlayerWeaponState(playerid) == 3)//WEAPONSTATE_RELOADING
{
new iWeaponid = GetPlayerWeapon(playerid);
new iAmmo = GetPlayerAmmo(playerid);
CallLocalFunction("OnPlayerReloading", "idd", playerid, iWeaponid, iAmmo);
}
if(funcidx("OnPlayerUpdate")) return CallRemoteFunction("OnPlayerUpdate", "i", playerid);
return 1;
}
&
Code:
#tryinclude <foreach>
Half of those aren't even used! (Foreach)
'Tryinclude' is to try and find the include to use. Not for the sake of adding it to make it 'unique'
Identation is horrible, spend your time to fix it.
AW: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
asdfgh98 - 09.08.2011
@Lorenc_ Make a better one if you can.
Re: AW: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
Lorenc_ - 09.08.2011
Quote:
Originally Posted by asdfgh98
@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;
}
Re: OnPlayerReloading(playerid, weaponid, ammo) R1 - by LZLo -
LZLo - 09.08.2011
nice Lorenc_