Help - Related to Bus Driver Job.
#4

Here is a dummy script which you can edit to suit your needs:
PHP код:
#define MAX_CPS 5
new Float:CPs[MAX_CPS][3] = {
    {
0.00.00.0},
    {
0.00.00.0},
    {
0.00.00.0},
    {
0.00.00.0},
    {
0.00.00.0}
};
new 
currentCP[MAX_PLAYERS] = -1;
/* Callable Functions */
forward startRun(playerid);
public 
startRun(playerid)
{
    
currentCP[playerid] = 0;
    
ShowCP(playerid);
    return 
1;
}
/* private Funcs */
ShowCP(playerid)
{
    
SetPlayerCheckpoint(playeridCPs[currentCP[playerid]][0], CPs[currentCP[playerid]][1], CPs[currentCP[playerid]][2], 5);
    return 
1;
}
/* Timer Funcs */
forward SetNextCP(playerid);
public 
SetNextCP(playerid)
{
    
TogglePlayerControllable(playeridtrue);
    if(
currentCP[playerid] == MAX_CPS){
        
currentCP[playerid] = -1;
        
SendClientMessage(playerid, -1"Done");
    } else {
        
currentCP[playerid]++;
        
ShowCP(playerid);
    }
    return 
1;
}
/* Callbacks */
public OnPlayerEnterCheckpoint(playerid)
{
    if(
currentCP[playerid] == -1) return 1;
    if(
IsPlayerInRangeOfPoint(playerid5CPs[currentCP[playerid]][0], CPs[currentCP[playerid]][1], CPs[currentCP[playerid]][2]))
    {
        
TogglePlayerControllable(playeridfalse);
        
SetTimerEx("SetNextCP"100000"i"playerid);
    }
    return 
1;

You basically call startRun whenever you want him to start, For example inside a command.
Reply


Messages In This Thread
Help - Related to Bus Driver Job. - by D1am0nd - 29.08.2015, 17:25
Re: Help - Related to Bus Driver Job. - by Logofero - 29.08.2015, 19:23
Re: Help - Related to Bus Driver Job. - by D1am0nd - 29.08.2015, 19:58
Re: Help - Related to Bus Driver Job. - by Ahmad45123 - 29.08.2015, 20:10

Forum Jump:


Users browsing this thread: 1 Guest(s)