03.02.2009, 14:34
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;
}