PDA

View Full Version : Switching checkpoint


milanosie
11/01/2012, 04:37 PM
Hello there, I have this script with 6 checkpoints.

I just dont know how to make it so that after u enter checkpoint 1, it automaticly triggers to checkpoint 2..

Do i need to use Race checkpoints?

milanosie
11/01/2012, 04:57 PM
I get errors


C:\Users\Milan\Documents\Nieuwe map\Own Gamemode Test\jobs.pwn(329) : error 012: invalid function call, not a valid address
C:\Users\Milan\Documents\Nieuwe map\Own Gamemode Test\jobs.pwn(329) : error 029: invalid expression, assumed zero
C:\Users\Milan\Documents\Nieuwe map\Own Gamemode Test\jobs.pwn(329) : error 029: invalid expression, assumed zero
C:\Users\Milan\Documents\Nieuwe map\Own Gamemode Test\jobs.pwn(329) : fatal error 107: too many error messages on one line


public OnPlayerEnterCheckpoint(playerid)
{
if (pJob[playerid] == pJob_1)
{
if (IsPlayerInAnyVehicle(playerid))
{
new nextgas[6];
LINE 329 switch(nextgas(playerid))
{
case 1:
{

milanosie
11/01/2012, 05:06 PM
There is a mode called "area 51" that comes with the server - have a look in there.

What do you mean?

milanosie
11/01/2012, 05:09 PM
Cant you try to explain it yourself? :)

ricardo178
11/01/2012, 08:12 PM
Here is an example, of a checkpoints system, from my GameMode Bus and taxi Route job. Whole system here.. Look at the callback(public) part.


COMMAND:startbroute1(playerid, params[])
{
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 437)
{
if(PlayerInfo[playerid][Fmember] == 6)
{
SetPlayerCheckpoint(playerid, 1239.824462, -1716.014770, 13.385701, 3.0);
pCP[playerid] = 0;
return 1;
}
else return SendClientMessage(playerid, 0xFFFF00, "You are not Bus Driver.");
}
else return SendClientMessage(playerid, 0xFFFF00, "You need to be in a Bus to use this command.");
}
COMMAND:startlroute1(playerid, params[])
{
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 574)
{
if(PlayerInfo[playerid][Fmember] == 7)
{
SetPlayerCheckpoint(playerid, 1691.757080, -1828.453979, 13.388257, 3.0);
lCP[playerid] = 0;
return 1;
}
else return SendClientMessage(playerid, 0xFFFF00, "You are not street sweeper.");
}
else return SendClientMessage(playerid, 0xFFFF00, "You need to be in a sweeper car to use this command.");
}
new Float:BCP[][3] =
{
{1239.824462, -1716.014770, 13.385701},
{1292.422607, -1811.808959, 13.593965},
{1392.607910, -1877.122436, 13.595897},
{1667.943847, -1875.044677, 13.589699},
{1757.402221, -1827.756713, 13.596336},
{1817.335083, -1878.799804, 13.569665},
{1950.238647, -1937.050659, 13.593934},
{1957.339965, -2023.747924, 13.599599},
{1956.323730, -2152.864990, 13.586963},
{1774.430297, -2161.799804, 13.594959},
{1534.907470, -1927.611328, 16.545383},
{1496.950927, -1866.938476, 13.591338},
{1327.812988, -1849.627807, 13.532476},
{1317.465820, -1655.792114, 13.596158},
{1359.712890, -1445.657104, 13.594190},
{1361.635498, -1312.635009, 13.580309},
{1373.455322, -1054.733642, 26.834287},
{1381.336669, -963.094665, 34.102642},
{1305.698120, -919.116333, 39.129402},
{1259.167114, -1021.762817, 32.977405},
{1258.811767, -1121.192260, 24.373428},
{1324.559082, -1153.082031, 23.840526},
{1337.565307, -1257.649902, 13.595456},
{1332.620605, -1459.048583, 13.595753},
{1186.981933, -1707.998291, 13.653977}
};

new Float:LCP[][3] =
{
{1749.930175, -1824.106811, 13.386181},
{1818.243408, -1870.593994, 13.417718},
{1867.435058, -1935.798828, 13.386360},
{1935.240722, -1935.237304, 13.386432},
{2039.508422, -1938.437133, 13.308705},
{2083.435302, -1911.928833, 13.385684},
{2105.080322, -1920.830444, 13.386754},
{2131.324951, -1911.176635, 13.385083},
{2186.458007, -1897.889648, 13.444042},
{2212.400634, -1936.516113, 13.393572},
{2259.876953, -2061.613037, 13.347857},
{2373.156982, -2052.347656, 14.135120},
{2569.332763, -2055.761230, 25.023283},
{2695.611572, -2051.717041, 13.257332},
{2717.203613, -2007.496215, 13.354817},
{2648.135009, -1999.744018, 13.465263},
{2689.119873, -2007.042480, 13.388714},
{2716.816162, -1950.389770, 13.325292},
{2484.899414, -1928.633056, 13.311678},
{2416.718017, -1899.438842, 13.334335},
{2370.136230, -1909.280639, 13.387296},
{2410.266845, -1961.149536, 13.386340},
{2344.683593, -1968.681640, 13.302270},
{2234.415039, -1969.154296, 13.358555},
{2222.282226, -1849.319580, 13.373634},
{2150.660400, -1747.034912, 13.467349},
{1913.886596, -1748.072265, 13.456360},
{1798.010375, -1827.338500, 13.477108},
{1700.711547, -1807.534423, 13.453680},
{1633.541870, -1867.153198, 13.458148}
};

new pCP[MAX_PLAYERS];
new lCP[MAX_PLAYERS];
public OnPlayerEnterCheckpoint(playerid)
{
if(pCP[playerid] != -1)
{
GivePlayerMoney(playerid, 10);
if(pCP[playerid] < sizeof(BCP))
{
pCP[playerid]++;
SetPlayerCheckpoint(playerid, BCP[pCP[playerid]][0], BCP[pCP[playerid]][1], BCP[pCP[playerid]][2], 2.0);
}
else
{
SendClientMessage(playerid, 0x999999AA, "Route finished");
DisablePlayerCheckpoint(playerid);
pCP[playerid] = -1;
}
}
if(lCP[playerid] != -1)
{
GivePlayerMoney(playerid, 10);
if(lCP[playerid] < sizeof(LCP))
{
lCP[playerid]++;
SetPlayerCheckpoint(playerid, LCP[lCP[playerid]][0], LCP[lCP[playerid]][1], LCP[lCP[playerid]][2], 2.0);
}
else
{
SendClientMessage(playerid, 0x999999AA, "Route finished");
DisablePlayerCheckpoint(playerid);
lCP[playerid] = -1;
}
}
return 1;
}

Rokzlive
11/01/2012, 08:25 PM
Just assign the checkpoint an id, then when OnPlayerEnterCheckpoint, see what checkpoint id they are in and use that to trigger the next.