17.06.2011, 15:19
Hello guys.
Im makeing a train driver job, where the driver has to drive between checkpoints. (Using Incognito's streamer).
I made a /drive command, that will set the checkpoints if the player is inside the train.
I did like this:
But it doesnt work exacteley.
Hope you can help me a bit. Thanks.
Im makeing a train driver job, where the driver has to drive between checkpoints. (Using Incognito's streamer).
I made a /drive command, that will set the checkpoints if the player is inside the train.
I did like this:
pawn Код:
new traincp[5];
new ptraincp[MAX_PLAYERS];
pawn Код:
COMMAND:drive(playerid, params[])
{
if(PlayerInfo[playerid][pJob] == 2)
{
if(IsPlayerInVehicle(playerid, psdrivervehicles[0]))
{
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) Train Driver Job started");
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) Go to the Checkpoint");
traincp[0] = CreateDynamicRaceCP(1, 1772.4253,-1953.9143,13.5469, 2864.7729,1328.5391,10.8203, 4.0, 0, 0, playerid, 100.0);
}
else SendClientMessage(playerid, COLOR_NORMALRED, "( ! ) You must be in the Train or a Bus to drive");
}
else return 0;
return 1;
}
pawn Код:
public OnPlayerEnterDynamicRaceCP(playerid, checkpointid)
{
if(checkpointid == traincp[0])
{
ptraincp[playerid] = 1;
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) Changing Passengers. Please wait...");
SetTimerEx("TrainCPS", 7000, false, "d", playerid);
}
if(checkpointid == traincp[1])
{
ptraincp[playerid] = 2;
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) Changing Passengers. Please wait...");
SetTimerEx("TrainCPS", 7000, false, "d", playerid);
}
if(checkpointid == traincp[2])
{
ptraincp[playerid] = 3;
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) Changing Passengers. Please wait...");
SetTimerEx("TrainCPS", 7000, false, "d", playerid);
}
if(checkpointid == traincp[3])
{
ptraincp[playerid] = 4;
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) Changing Passengers. Please wait...");
SetTimerEx("TrainCPS", 7000, false, "d", playerid);
}
if(checkpointid == traincp[4])
{
ptraincp[playerid] = 5;
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) Changing Passengers. Please wait...");
SetTimerEx("TrainCPS", 7000, false, "d", playerid);
}
return 1;
}
pawn Код:
forward TrainCPS(playerid);
public TrainCPS(playerid)
{
if(ptraincp[playerid] == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) Drive to the next Station");
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) ServerMoney +2");
DestroyDynamicRaceCP(traincp[0]);
PlayerInfo[playerid][pMoney] += 2;
PlayerPlaySound(playerid, 1138, 0, 0, 0);
SaveUserData(playerid);
traincp[1] = CreateDynamicRaceCP(1, 2864.7729,1328.5391,10.8203, 1395.0898,2632.3098,10.8203, 4.0, 0, 0, playerid, 100.0);
}
if(ptraincp[playerid] == 2)
{
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) Drive to the next Station");
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) ServerMoney +2");
DestroyDynamicRaceCP(traincp[1]);
PlayerInfo[playerid][pMoney] += 2;
PlayerPlaySound(playerid, 1138, 0, 0, 0);
SaveUserData(playerid);
traincp[2] = CreateDynamicRaceCP(1, 1395.0898,2632.3098,10.8203, -1944.3983,95.3343,25.7186, 4.0, 0, 0, playerid, 100.0);
}
if(ptraincp[playerid] == 3)
{
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) Drive to the next Station");
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) ServerMoney +2");
DestroyDynamicRaceCP(traincp[2]);
PlayerInfo[playerid][pMoney] += 2;
PlayerPlaySound(playerid, 1138, 0, 0, 0);
SaveUserData(playerid);
traincp[3] = CreateDynamicRaceCP(1, -1944.3983,95.3343,25.7186, 840.6030,-1390.3347,-1.6173, 4.0, 0, 0, playerid, 100.0);
}
if(ptraincp[playerid] == 4)
{
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) Drive to the next Station");
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) ServerMoney +2");
DestroyDynamicRaceCP(traincp[3]);
PlayerInfo[playerid][pMoney] += 2;
PlayerPlaySound(playerid, 1138, 0, 0, 0);
SaveUserData(playerid);
traincp[4] = CreateDynamicRaceCP(1, 840.6030,-1390.3347,-1.6173, 1772.4253,-1953.9143,13.5469, 4.0, 0, 0, playerid, 100.0);
}
if(ptraincp[playerid] == 5)
{
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) Train driver Job completed");
DestroyDynamicRaceCP(traincp[4]);
DestroyDynamicRaceCP(traincp[0]);
PlayerInfo[playerid][pMoney] += 2;
PlayerPlaySound(playerid, 1138, 0, 0, 0);
SaveUserData(playerid);
}
return 1;
}
Hope you can help me a bit. Thanks.