SA-MP Forums Archive
OnPlayerShootObject (+REP) - 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: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerShootObject (+REP) (/showthread.php?tid=605913)



OnPlayerShootObject (+REP) - Lirbo - 26.04.2016

I know this function does not exist but I would like to detect if a player is shooting a specific object, how could I do it?

I know the only thing is possible is this one:
OnPlayerWeaponShot -> Hit Type -> BULLET_HIT_TYPE_OBJECT

but there's a way to detect a specific object that is being shooted?


Re: OnPlayerShootObject (+REP) - povargek - 26.04.2016

Код:
stock OnPlayerShootObject(playerid, objectid, playerobject)
{
//code
	return 1;
}
Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
	if(hittype == BULLET_HIT_TYPE_OBJECT || hittype == BULLET_HIT_TYPE_PLAYER_OBJECT)
	{
		OnPlayerShootObject(playerid, hitid, hittype == BULLET_HIT_TYPE_PLAYER_OBJECT ? 1 : 0); // you can desync shoot with return 
	}
	
	return 1;
}
Or you can create a filterscript and use a CallRemoteFunticon

UPD: And Streamer plugin can detect a shoot to dynamic object's (OnPlayerShootDynamicObject)


Re: OnPlayerShootObject (+REP) - Crystallize - 26.04.2016

There's a tutorial which is very well explained about OnPlayerShootObject , search for it.


Re: OnPlayerShootObject (+REP) - Lirbo - 26.04.2016

Quote:
Originally Posted by Wizzard2H
Посмотреть сообщение
There's a tutorial which is very well explained about OnPlayerShootObject , search for it.
I can't find it that's why i opened a thread about it


Quote:
Originally Posted by povargek
Посмотреть сообщение
Код:
stock OnPlayerShootObject(playerid, objectid, playerobject)
{
//code
	return 1;
}
Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
	if(hittype == BULLET_HIT_TYPE_OBJECT || hittype == BULLET_HIT_TYPE_PLAYER_OBJECT)
	{
		OnPlayerShootObject(playerid, hitid, hittype == BULLET_HIT_TYPE_PLAYER_OBJECT ? 1 : 0); // you can desync shoot with return 
	}
	
	return 1;
}
Or you can create a filterscript and use a CallRemoteFunticon

UPD: And Streamer plugin can detect a shoot to dynamic object's (OnPlayerShootDynamicObject)
ye but i need the code bro... it doesn't help me you just gave me a blank script. i need the code that supposed to be inside of the stock.


Re: OnPlayerShootObject (+REP) - Lirbo - 26.04.2016

Sorry for early bump but i need it ASAP


Re: OnPlayerShootObject (+REP) - GangstaSunny - 27.04.2016

@Lirbo
PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    if(
hittype == BULLET_HIT_TYPE_OBJECT || hittype == BULLET_HIT_TYPE_PLAYER_OBJECT)
    {
        new 
ObjectID Streamer_GetIntData(STREAMER_TYPE_OBJECThitidE_STREAMER_MODEL_ID);
        
//ObjectID now should contain the model ID of the shooted object
    
}




Re: OnPlayerShootObject (+REP) - CalvinC - 27.04.2016

Quote:
Originally Posted by Lirbo
Посмотреть сообщение
I can't find it that's why i opened a thread about it




ye but i need the code bro... it doesn't help me you just gave me a blank script. i need the code that supposed to be inside of the stock.
The code inside the function is determined by what you want to do with it.


Re: OnPlayerShootObject (+REP) - Lirbo - 27.04.2016

the function onplayershootdynamicobject is exist so i'm fine eventually