OnTrailerAtach? - 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: OnTrailerAtach? (
/showthread.php?tid=64339)
OnTrailerAtach? -
Jonte92 - 03.02.2009
Hey guys!
I was just wounder if theire are anything like a
Or something , cause when the truck attaches to a trailer i want random checkpoint , wich i already know how to do , but how do i make it come when you get attached to a trailer?
Re: OnTrailerAtach? -
SilentMouse - 03.02.2009
Quote:
Originally Posted by Jonte92
Hey guys!
I was just wounder if theire are anything like a
Or something , cause when the truck attaches to a trailer i want random checkpoint , wich i already know how to do , but how do i make it come when you get attached to a trailer?
|
IsTrailerAttachedToVehicle(vehicleid); is the closest thing there is, as far as i am aware.
Re: OnTrailerAtach? -
Lazarus - 03.02.2009
pawn Код:
//top of script
new attached[MAX_PLAYERS];
forward OnTrailerAttach(playerid, vehicleid, tailorid);
//onplayerupdate
public OnPlayerUpdate(playerid)
{
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) == 1 && attached[playerid] == 0)
{
OnTrailerAttach(playerid, GetPlayerVehicleID(playerid), GetVehicleTrailer(GetPlayerVehicleID(playerid)));
attached[playerid] = 1;
}
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) == 0 && attached[playerid] == 1)
{
attached[playerid] = 0;
}
return 1;
}
//onplayerconnect
public OnPlayerConnect(playerid)
{
attached[playerid] = 0;
return 1;
}
//here's your function
public OnTrailerAttach(playerid, vehicleid, tailorid)
{
// Do something here
return 1;
}
Re: OnTrailerAtach? -
Jonte92 - 03.02.2009
Thanks
Re: OnTrailerAtach? -
Jonte92 - 03.02.2009
Quote:
Originally Posted by Lazarus
pawn Код:
//top of script new attached[MAX_PLAYERS]; forward OnTrailerAttach(playerid, vehicleid, tailorid);
//onplayerupdate public OnPlayerUpdate(playerid) { if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) == 1 && attached[playerid] == 0) { OnTrailerAttach(playerid, GetPlayerVehicleID(playerid), GetVehicleTrailer(GetPlayerVehicleID(playerid))); attached[playerid] = 1; }
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) == 0 && attached[playerid] == 1) { attached[playerid] = 1; } return 1; }
//onplayerconnect public OnPlayerConnect(playerid) { attached[playerid] = 0; return 1; }
//here's your function public OnTrailerAttach(playerid, vehicleid, tailorid) { // Do something here return 1; }
|
This doesn't work! The server application crashes!
Re: OnTrailerAtach? -
Lazarus - 03.02.2009
I don't see how that's possible... go into the server_log.txt and show the last lines after opening the application.
Re: OnTrailerAtach? -
Joe Staff - 03.02.2009
Quote:
Originally Posted by Lazarus
pawn Код:
public OnPlayerUpdate(playerid) { if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) == 1 && attached[playerid] == 0) { OnTrailerAttach(playerid, GetPlayerVehicleID(playerid), GetVehicleTrailer(GetPlayerVehicleID(playerid))); attached[playerid] = 1; }
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) == 0 && attached[playerid] == 1) { attached[playerid] = 1; //// change to 0 } return 1; }
|
needs to be fixed
Re: OnTrailerAtach? -
Lazarus - 03.02.2009
Sorry, typo :\.
Re: OnTrailerAtach? -
Joe Staff - 03.02.2009
Happens to the best of us lol
Re: OnTrailerAtach? -
Jonte92 - 03.02.2009
I get nothing different in the log just a Send Report / Don't Send message when logging in to the server , then crash , i get this in the crashinfo.txt
--------------------------
Exception At Address: 0x0045D1FE
Registers:
EAX: 0x00000000 EBX: 0x00F5FA94 ECX: 0x00000000 EDX: 0x00C667D0
ESI: 0x00C6A158 EDI: 0x00C6A158 EBP: 0x00F8EE60 ESP: 0x0012FC38
EFLAGS: 0x00010246
Stack:
Can you help me with this , if i remove the
pawn Код:
public OnPlayerUpdate(playerid)
{
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) == 1 && attached[playerid] == 0)
{
OnTrailerAttach(playerid, GetPlayerVehicleID(playerid), GetVehicleTrailer(GetPlayerVehicleID(playerid)));
attached[playerid] = 1;
}
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) == 0 && attached[playerid] == 1)
{
attached[playerid] = 0; //// change to 0
}
return 1;
}
Then the server works , but of course the trailer thing won't work then , how to fix this?