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

Hello!

Here my plug& play INC's fourth Release.

PHP код:
forward OnPlayerReloading(playeridweaponidammo); 
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


Reply
#2

Nice and easy.
I was thinking of doing this.
Reply
#3

Thanks!
Links Updated!
Reply
#4

Good job! Very usefull!
Reply
#5

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]
PHP код:
#include OPRL 
[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.
Reply
#6

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!
Reply
#7

Well i don't know the func is?
Reply
#8

Hmm.. what's the point of this?
Reply
#9

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!
Reply
#10

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.
Reply
#11

release 3 is out now!
(i don't know why am i doing this)
Reply
#12

nice
i will use it...
thanks


Question: How i stop player from reloading ammo?
Reply
#13

ClearAnimations(playerid); maybe works
Reply
#14

Quote:
Originally Posted by xkirill
View Post
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
Reply
#15

You are funny with this
Code:
#tryinclude <foreach>
You aren't using it btw.. lol.
Reply
#16

Good job , But can you create a function to force a player to reload his weapon like
Code:
ForcePlayerToReloadWeapon(playerid);
Reply
#17

Quote:
Originally Posted by LZLo
View Post
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
View Post
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.
Reply
#18

@Lorenc_ Make a better one if you can.
Reply
#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
#20

nice Lorenc_
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)