Hello, i've been working on a trucking job. I've got some problems with the way it works, i wanted it so when you get in a trucker and press 2 it shows "Attach the trailer", it does that, but when i attach the trailer, it doesn't do anything, can't seem to find where i've gone wrong here. could you take a look at tell me where i've gone wrong please.
pawn Код:
#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
new Truckerpayout[][] =
{
{1300},
{1532},
{2424},
{1252}
};
new Float: TruckerCP[0][3] =
{
{660.2798,-455.6530,15.9324}
};
new Trucker[432];
public OnFilterScriptInit()
{
AddStaticVehicleEx(403,-76.7673,-1108.7708,0.6780,162.3021, -1, -1, 60);//Truck1
AddStaticVehicleEx(403,-66.9458,-1110.4719,0.6779,162.8729, -1, -1, 60);//Truck2
AddStaticVehicleEx(584,-60.1769,-1136.6504,0.6781,75.7877, -1, -1, 60);//trailer
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 403)
{
new vehicleid;
if(IsTrailerAttachedToVehicle(vehicleid))
{
if(Trucker[playerid] == 1)
{
new rand2 = random(sizeof(TruckerCP));
SetPlayerCheckpoint(playerid, TruckerCP[rand2][0], TruckerCP[rand2][1], TruckerCP[rand2][2], 10);
GivePlayerMoney(playerid, Truckerpayout[rand2][0]);
GameTextForPlayer(playerid, "~y~Go drop the trailer off", 1000, 5);
}
}
}
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_SUBMISSION))
{
if(GetVehicleModel(GetPlayerVehicleID(playerid))== 403)
if(Trucker[playerid] == 0)
{
Trucker[playerid] =0;
{
GameTextForPlayer(playerid, "~y~Attach the trailer", 1000, 5);
{
new vehicleid;
if(IsTrailerAttachedToVehicle(vehicleid))
Trucker[playerid] = 1;
}
return 1;
}
}
}
return 1;
}