Hello. I'am making my first job system and i need your help.
I made command "ruta" which turns bus driver,job,on. Now i need an example with checkpoints. When i enter first the second shows,and so on... I just need an example with few checkpoint because i really don't have idea how to do that. I know it is very easy but...
PHP код:
CMD:ruta(playerid,params[])
{
new Vozilo = GetPlayerVehicleID(playerid);
if(PlayerPosao[playerid][pID] != 1) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Niste zaposleni kao vozac autobusa");
if(Vozilo != Autobus[0] || Vozilo != Autobus[1] || Vozilo != Autobus[2] || Vozilo != Autobus[3] || Vozilo != Autobus[4]) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Ne nalazite se u autobusu");
if(Ruta[playerid] != 0) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Vec ste zapoceli autobus rutu");
{
SendClientMessage(playerid,-1,""COLOR_WG"WG:{FFFFFF} Zapoceli ste autobus rutu. Molimo pratite oznake na mapi.");
SendClientMessage(playerid,-1,""COLOR_WG"WG:{FFFFFF} Ukoliko zelite prestati odradivati rutu -"COLOR_SIVA" /zaustavirutu");
Ruta[playerid] = 1;
}
return 1;
}
I would like to explain everything in detail but I don't have enough time to do so.
PHP код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#include <zcmd.inc>
new ProgressInRuta[MAX_PLAYERS];
new CP_ID[MAX_PLAYERS];
new Ruta[MAX_PLAYERS];
static const Float:CPS[10][3] =
{ //x //y /z
{00.00, 00.00, 00.00},
{00.00, 00.00, 00.00},
{00.00, 00.00, 00.00},
{00.00, 00.00, 00.00},
{00.00, 00.00, 00.00},
{00.00, 00.00, 00.00},
{00.00, 00.00, 00.00},
{00.00, 00.00, 00.00},
{00.00, 00.00, 00.00},
{00.00, 00.00, 00.00}
};
CMD:ruta(playerid,params[])
{/*
new Vozilo = GetPlayerVehicleID(playerid);
if(PlayerPosao[playerid][pID] != 1)
return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Niste zaposleni kao vozac autobusa");
if(Vozilo != Autobus[0] || Vozilo != Autobus[1] || Vozilo != Autobus[2] || Vozilo != Autobus[3] || Vozilo != Autobus[4])
return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Ne nalazite se u autobusu");
*/
if(Ruta[playerid] == 1)
return SendClientMessage(playerid,-1,"You are already in route");
Ruta[playerid] = 1;
SendClientMessage(playerid, -1, "You've come to ruta!");
CP_ID[playerid] = SetPlayerRaceCheckpoint(playerid, 0, CPS[0][0], CPS[0][1], CPS[0][2], CPS[1][0], CPS[1][1], CPS[1][2], 12.5);
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
if(Ruta[playerid])
{
ProgressInRuta[playerid] = ProgressInRuta[playerid]+1;
new
slot = ProgressInRuta[playerid];
if(ProgressInRuta[playerid] != sizeof(CPS))
{
switch(ProgressInRuta[playerid])
{
case 1,2,3,4,5,6,7,8:
CP_ID[playerid] = SetPlayerRaceCheckpoint(playerid, 0, CPS[slot][0], CPS[slot][1], CPS[slot][2], CPS[slot+1][0], CPS[slot+1][1], CPS[slot+1][2], 12.5);
case 9:
CP_ID[playerid] = SetPlayerRaceCheckpoint(playerid, 1, CPS[slot][0], CPS[slot][1], CPS[slot][2], 0.0, 0.0, 0.0, 12.5);
}
}
else if(ProgressInRuta[playerid] == sizeof(CPS))
{
DisablePlayerRaceCheckpoint(playerid);
SendClientMessage(playerid, -1, "You finished the ruta!!.");
Ruta[playerid] = false;
ProgressInRuta[playerid] = 0;
}
}
return true;
}