07.11.2010, 18:58
(
Последний раз редактировалось ihatetn931; 07.11.2010 в 20:05.
)
Ok, I cannot get this working at all. It worked before (on the previous sa-mp). If i manually set playerids where [playerid] is it works fine
Ongamemodeinit
OnPlayerExitVehicle
OnPlayerEnterCheckPoint
Anyone mind giving me a hand? I added the prints to try and figure it out
pawn Код:
new TimeLeft[MAX_PLAYERS];
new Trailer[MAX_PLAYERS];
new Trucking[MAX_PLAYERS];
pawn Код:
SetTimer("CheckTrailer", 1000, true);
pawn Код:
forward CheckTrailer(playerid);
public CheckTrailer(playerid)
{
printf("%d",IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)));
printf("%d",Trucking[playerid]);
printf("%d",TimeLeft[playerid]);
new vehicleid = GetPlayerVehicleID(playerid);
if(Trucking[playerid] > 1 && !IsTrailerAttachedToVehicle(vehicleid))
{
if(TimeLeft[playerid] == 0)
{
TimeLeft[playerid] = 60;
Trucking[playerid] = 0;
PlayerInfo[playerid][pJob] = 0;
InfoBoxForPlayer(1, "~g~Fired~n~~n~~w~You were supposed to keep it together. The Boss has ~r~fired ~w~you");
return 0;
}
TimeLeft[playerid] --;
new string[128];
format(string, sizeof(string), "You have ~g~%d ~w~seconds left to attach the trailer", TimeLeft[playerid]);
GameTextForPlayer(1,string, 1000, 5);
}
else
{
TimeLeft[playerid] = 60;
}
return 1;
}
pawn Код:
if(Trucking[playerid] > 0)
{
TimeLeft[playerid] = 60;
Trucking[playerid] = 0;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
}
pawn Код:
if(Trucking[playerid] == 2)
{
if(IsALSTrucker(veh))
{
if(IsTrailerAttachedToVehicle(veh))
{
new randmoney = 150 + random(700);
//GivePlayerCash(playerid, randmoney);
PlayerInfo[playerid][pPaycheck] += randmoney;
format(string, sizeof(string), "~g~Money Earned~n~~n~You earned $%d for delivering products", randmoney );
InfoBoxForPlayer(playerid, string);
new rand = random(sizeof(checkpoints));
SetPlayerCheckpoint(playerid, checkpoints[rand][0], checkpoints[rand][1], checkpoints[rand][2], 3.0);
}
else
{
SendClientMessage(playerid, COLOR_RED, "Where is your truck trailer?");
}
}
}
if(Trucking[playerid] == 1)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
Trucking[playerid] = 2;
Trailer[playerid] = CreateVehicle(435, -76.7316,-1118.6506,0.8108,159.7473, -1, -1, 9960);
AttachTrailerToVehicle(Trailer[playerid], veh); //this dosen't work cause i'm not to sure how to stream them
new rand = random(sizeof(checkpoints));
SetPlayerCheckpoint(playerid, checkpoints[rand][0], checkpoints[rand][1], checkpoints[rand][2], 3.0);
}