YCMD:confirmtruck(playerid, params[], help)
{
if(PlayerInfo[playerid][pJob] == 5)
{
TTTimer1 = SetTimerEx("TrailerCheck",1000,true,"i",playerid);
TTTimer2 = SetTimerEx("TTLevelUpCheck",1000,true,"i",playerid);
new vehicle = GetPlayerVehicleID(playerid);
if(vehicle == 139 || vehicle == 138 || vehicle == 137)
{
PlayerInfo[playerid][pIsWorking] = 1;
Ccp[playerid] = 16;
SetPlayerCheckpoint(playerid,52.5144,-270.2235,1.6817,5.0);
SendClientMessage(playerid,COLOUR_ORANGE,"Pick up a load at the factory in Blue Berry Acres.");
TogglePlayerControllable(playerid,1);
}
else if(vehicle == 88 || vehicle == 87 || vehicle == 86)
{
PlayerInfo[playerid][pIsWorking] = 1;
Ccp[playerid] = 17;
SetPlayerCheckpoint(playerid,-1029.0247,-654.1725,32.0078, 5.0);
SendClientMessage(playerid,COLOUR_ORANGE,"Pick up your fuel at Red County Oil Processing.");
TogglePlayerControllable(playerid,1);
}
else if(vehicle == 85 || vehicle == 84 || vehicle == 83)
{
PlayerInfo[playerid][pIsWorking] = 1;
Ccp[playerid] = 18;
SetPlayerCheckpoint(playerid,2794.7849,-1602.4868,10.9287, 5.0);
SendClientMessage(playerid,COLOUR_ORANGE,"Pick up your surplus at the Sprunk Factory..");
TogglePlayerControllable(playerid,1);
}
else
{
SendClientMessage(playerid,COLOUR_RED,"Enter an available truck first!");
}
}
else
{
SendClientMessage(playerid,COLOUR_RED,"Truckers only!");
}
return 1;
}
public TrailerCheck(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
new trailerid = GetVehicleModel(GetVehicleTrailer(vehicleid));
if(IsPlayerInAnyVehicle(playerid))
{
if(IsTrailerAttachedToVehicle(vehicleid) == 1 && trailerid == 450)//dirttrucks
{
KillTimer(TTTimer1);
ShowPlayerDialog(playerid,42,DIALOG_STYLE_LIST,"Available Destinations","Blueberry to Flint County Farm\nBlueberry to the Cemetary\nBlueberry to the Stadium","Select","Cancel");
}
else if(IsTrailerAttachedToVehicle(vehicleid) == 1 && trailerid == 584)//fueltrucks
{
KillTimer(TTTimer1);
ShowPlayerDialog(playerid,43,DIALOG_STYLE_LIST,"Available Destinations","Red County to Flint County\nRed County to Vinewood\nRed County to Idlewood","Select","Cancel");
}
else if(IsTrailerAttachedToVehicle(vehicleid) == 1 && trailerid == 435)//surplustrucks
{
KillTimer(TTTimer1);
ShowPlayerDialog(playerid,44,DIALOG_STYLE_LIST,"Available Destinations","East Beach to Flint County\nEach Beach to Vinewood\nEast Beach to Idlewood","Select","Cancel");
}
}
return 1;
}
Change the TTTimer1 and TTTimer2 to a array like TTTimer1[MAX_PLAYERS];
Because now you are killing the timer not for only one player, but for all players who are using this function at that moment. [EDIT] I hope it works, because I'm going to sleep, so I cannot help to untill tomorrow. |
I have tried following Ivex's post here: https://sampforum.blast.hk/showthread.php?tid=166479 and nothing changed. Any ideas? |