18.06.2011, 19:34
try this
pawn Код:
COMMAND:drive(playerid, params[])
{
if(PlayerInfo[playerid][pJob] == 2)
{
if(IsPlayerInVehicle(playerid, psdrivervehicles[0]))
{
ptraincp[playerid] = 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;
}
public OnPlayerEnterDynamicRaceCP(playerid, checkpointid)
{
if(checkpointid == traincp[0])
{
ptraincp[playerid] ++;
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) Changing Passengers. Please wait...");
SetTimerEx("TrainCPS", 7000, false, "ii", playerid, ptraincp[playerid]);
}
return 1;
}
forward TrainCPS(playerid, id);
public TrainCPS(playerid, id)
{
switch(id)
{
case 1:
{
DestroyDynamicRaceCP(traincp[0]);
traincp[0] = CreateDynamicRaceCP(1, 2864.7729,1328.5391,10.8203, 1395.0898,2632.3098,10.8203, 4.0, 0, 0, playerid, 100.0);
}
case 2:
{
DestroyDynamicRaceCP(traincp[0]);
traincp[0] = CreateDynamicRaceCP(1, 1395.0898,2632.3098,10.8203, -1944.3983,95.3343,25.7186, 4.0, 0, 0, playerid, 100.0);
}
case 3:
{
DestroyDynamicRaceCP(traincp[0]);
traincp[0] = CreateDynamicRaceCP(1, -1944.3983,95.3343,25.7186, 840.6030,-1390.3347,-1.6173, 4.0, 0, 0, playerid, 100.0);
}
case 4:
{
DestroyDynamicRaceCP(traincp[0]);
traincp[0] = CreateDynamicRaceCP(1, 840.6030,-1390.3347,-1.6173, 1772.4253,-1953.9143,13.5469, 4.0, 0, 0, playerid, 100.0);
}
case 5:
{
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) Train driver Job completed");
DestroyDynamicRaceCP(traincp[0]);
ptraincp[playerid] = 0;
}
}
if( id < 5) SendClientMessage(playerid, COLOR_YELLOW, "( ! ) Drive to the next Station");
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) ServerMoney +2");
PlayerInfo[playerid][pMoney] += 2;
PlayerPlaySound(playerid, 1138, 0, 0, 0);
SaveUserData(playerid);
return 1;
}