17.06.2016, 13:16
I had posted for a help regarding these functions way back. These functions should get called right after player attach/detach a trailer from their truck.
In the previous thread, I got this idea from Vince. But for some reason only the attached function is getting called and not the detached one. I tried changing the statements but didn't help in anyway, can someone tell me what's the problem here?
In the previous thread, I got this idea from Vince. But for some reason only the attached function is getting called and not the detached one. I tried changing the statements but didn't help in anyway, can someone tell me what's the problem here?
PHP код:
PlayerAttachedTrailer(vehicleid, playerid, trailerid)
{
printf("Player %d attached the trailer id %d to vehicle id %d", playerid, trailerid, vehicleid);
return 1;
}
PlayerDetachedTrailer(vehicleid, playerid, oldtrailerid)
{
printf("Player %d detached the trailer id %d from vehicleid %d", playerid, oldtrailerid, vehicleid);
return 1;
}
public OnTrailerUpdate(playerid, vehicleid)
{
new vid = GetPlayerVehicleID(playerid);
if (vid)
{
new attached_trailer = GetVehicleTrailer(vid);
if (attached_trailer == vehicleid && g_AttachedTrailer[vid] == 0)
{
PlayerAttachedTrailer(vid, playerid, vehicleid);
g_AttachedTrailer[vid] = vehicleid;
}
else if (attached_trailer == 0 && g_AttachedTrailer[vid] == vehicleid) // Tried changing statements inside this but didn't work.
{
PlayerDetachedTrailer(vid, playerid, vehicleid);
g_AttachedTrailer[vid] = 0;
}
}
return 1;
}