24.04.2015, 23:22
Well I'm working on my Trucker Job but I need to make it so when a player attaches a trailer, it sends him a message as a test. I made that part successfully. But then I had to make it so when a player unattaches his trailer he gets another test message. That part was successfully made too. But how do I make it so when a player attaches a trailer again, the function gets reset and starts again? Becouse now whenever I deattach my trailer and attach it again, it won't send me the test message.
This is my code.
This is my code.
Код:
public OnPlayerUpdate(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsTrailerAttachedToVehicle(vehicleid) && AttachedTrailer1[playerid])
{
SendClientMessage(playerid, COLOR_MAXZONE, "Test");
AttachedTrailer1[playerid] = 0;
TrailerIsAttached[playerid] = 0;
}
else if (AttachedTrailer1[playerid]) AttachedTrailer1[playerid] = -1;
if(TrailerIsNotAttached[playerid] && !IsTrailerAttachedToVehicle(vehicleid) && IsPlayerInAnyVehicle(playerid) && TrailerIsAttached[playerid] == 0)
{
SendClientMessage(playerid, COLOR_MAXZONE, "Nu mai esti test.");
TrailerIsNotAttached[playerid] = 0;
TrailerIsAttached[playerid] = -1;
}
else if(TrailerIsNotAttached[playerid]) TrailerIsNotAttached[playerid] = -1;
return 1;
}

