Npc and trailer - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Npc and trailer (
/showthread.php?tid=253639)
Npc and trailer -
marrcko - 07.05.2011
HI, i have one problem!
I created npc it works great, but it should drive a truck with trailer. However it doesn't. Maybe its imposable?
P.S. I recorded it with trailer.
maybe this helps:
pawn Код:
sunk = AddStaticVehicle(515,-2581.0857,1145.5331,60.3293,325.3235,-1,-1);
priekaba = AddStaticVehicle(435,-2565.5623,1133.8135,55.4133,247.9579,-1,-1);
pawn Код:
ConnectNPC("Jonas_Betas","fura");
pawn Код:
if(!strcmp(playername,"Jonas_Betas",true))
{
SetSpawnInfo( playerid, 0, 101, 1958.33, 1343.12, 15.36, 269.15, 31, 1000, 0, 0, 0, 0 );
PutPlayerInVehicle(playerid,sunk, 0);
AttachTrailerToVehicle(priekaba, sunk);
}
Re: Npc and trailer -
Joe Staff - 07.05.2011
Try placing the AttachTrailerToVehicle function in OnPLayerStateChange, be sure to add the player state conditional for driving, example:
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(!strcmp(playername,"Jonas_Betas",true))
{
if(newstate==PLAYER_STATE_DRIVER)AttachTrailerToVehicle(priekaba, sunk);
}
}
Re: Npc and trailer -
marrcko - 07.05.2011
nah.. it isn't work.... but thx for the help.
EDIT: i tried to create zcmd command ant its work.. so maybe there is some way to 'create a direction' for that command in
GameModeInit or in
pawn Код:
if(!strcmp(playername,"Jonas_Betas",true))
{
SetSpawnInfo( playerid, 0, 101, 1958.33, 1343.12, 15.36, 269.15, 31, 1000, 0, 0, 0, 0 );
PutPlayerInVehicle(playerid,sunk, 0);
AttachTrailerToVehicle(priekaba, sunk);
}?