SA-MP Forums Archive
Problem witch filterscipt and object - 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: Problem witch filterscipt and object (/showthread.php?tid=374616)



Problem witch filterscipt and object - R1cardas7 - 03.09.2012

Hello guy, I'm trying to make fs which add object on the car.

Image:



But script (FS) does not add object on the car. So please help me.

I'm sorry for writing mistakes.


Re: Problem witch filterscipt and object - [HK]Ryder[AN] - 03.09.2012

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

Use this.


Re: Problem witch filterscipt and object - R1cardas7 - 03.09.2012

Code:

Quote:

#include <a_samp>
#include <a_objects>
#if defined FILTERSCRIPT
#endif

public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{
new posu1[ MAX_PLAYERS ] = 0;
new posu2[ MAX_PLAYERS ] = 0;
new posu7[ MAX_PLAYERS ] = 0;
new posu8[ MAX_PLAYERS ] = 0;

new vehicleid = GetPlayerVehicleID(playerid);


if(newkeys & KEY_LOOK_LEFT)
{
if(!IsPlayerInAnyVehicle(playerid))
{
if(GetVehicleModel(vehicleid) == 525 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{

if( posu7[ playerid] == 0 || posu8[ playerid] == 0)
{
posu7[ playerid ] = CreateObject( 19294, 0, 0, 0, 0, 0, 0 );
posu8[ playerid ] = CreateObject( 19294, 0, 0, 0, 0, 0, 0 );
AttachObjectToVehicle( posu7[ playerid ], GetPlayerVehicleID(playerid), -1.154999, -2.965020, -0.199999, 0.000000, 0.000000, 0.000000 );
AttachObjectToVehicle( posu8[ playerid ], GetPlayerVehicleID(playerid), -0.984999, 2.955019, 0.079999, 0.000000, 0.000000, 0.000000 );
DestroyObject( posu1[ playerid ] );
DestroyObject( posu2[ playerid ] );
posu1[ playerid ] = 0;
posu2[ playerid ] = 0;
}
else
{
DestroyObject( posu7[ playerid ] );
DestroyObject( posu8[ playerid ] );
posu7[ playerid ] = 0;
posu8[ playerid ] = 0;
}
}
}
}
if(newkeys & KEY_LOOK_RIGHT)
{
if(!IsPlayerInAnyVehicle(playerid))
{
if(GetVehicleModel(vehicleid) == 525 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if( posu1[ playerid] == 0 || posu2[ playerid] == 0)
{
DestroyObject( posu7[ playerid ] );
DestroyObject( posu8[ playerid ] );
posu7[ playerid ] = 0;
posu8[ playerid ] = 0;
posu1[ playerid ] = CreateObject( 19294, 0, 0, 0, 0, 0, 0 );
posu2[ playerid ] = CreateObject( 19294, 0, 0, 0, 0, 0, 0 );
AttachObjectToVehicle( posu1[ playerid ], GetPlayerVehicleID(playerid), 0.914999, 2.970020, 0.120000, 0.000000, 0.000000, 0.000000 );
AttachObjectToVehicle( posu2[ playerid ], GetPlayerVehicleID(playerid), 1.069999, -2.930019, -0.259999, 0.000000, 0.000000, 0.000000 );
}
else
{
DestroyObject( posu1[ playerid ] );
DestroyObject( posu2[ playerid ] );
posu1[ playerid ] = 0;
posu2[ playerid ] = 0;
}
}
}
}
return 1;
}




Re: Problem witch filterscipt and object - shaniyal - 03.09.2012

so do u got any error(when compiling)??


Re: Problem witch filterscipt and object - R1cardas7 - 03.09.2012

No one