Help with checkpoints DMV system -
jakejohnsonusa - 15.11.2012
Ok so I have a flying test that is set to when the test starts:
Код:
CP[playerid] = 400;
SetPlayerRaceCheckpoint(playerid,3,-1628.0454,-134.6547,15.0706,-1444.2026,53.7472,22.4049,7.0);
The problem is is that after they get to the checkpoint (the one above) it never changes and doesn't go to the next checkpoint. It dissapears for a second then reappears.
Here is the code of the test:
Код:
}
if(CP[playerid]==400) //Fly Test
{
if(IsPlayerInAnyVehicle(playerid))
{
DisablePlayerCheckpoint(playerid);
CP[playerid] = 401;
SetPlayerRaceCheckpoint(playerid,3,-1444.2026,53.7472,22.4049,-1133.9303,333.3353,59.9484,7.0);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE,"You are not in the Plane!");
SendClientMessage(playerid, COLOR_LIGHTBLUE,"Visit the license center to retake the test.");
DisablePlayerCheckpoint(playerid);
RemovePlayerFromVehicle(playerid);
SetPlayerVirtualWorld(playerid, 0);
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
FlyingInfo[playerid][FlyingTest] = 0;
}
}
else if(CP[playerid]==401)
{
if(UsingBelt[playerid] == 1)
{
DisablePlayerCheckpoint(playerid);
CP[playerid] = 402;
SetPlayerRaceCheckpoint(playerid,3,-1133.9303,333.3353,61.9484,-784.5469,437.4159,70.0663,7.0);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE,"You haven't put on your seatbelt!");
SendClientMessage(playerid, COLOR_LIGHTBLUE,"Visit the license center to retake the test.");
DisablePlayerCheckpoint(playerid);
RemovePlayerFromVehicle(playerid);
SetPlayerVirtualWorld(playerid, 0);
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
FlyingInfo[playerid][FlyingTest] = 0;
}
}
else if(CP[playerid]==402)
{
DisablePlayerCheckpoint(playerid);
CP[playerid] = 403;
SetPlayerRaceCheckpoint(playerid,3,-784.5469,437.4159,70.0663,-441.9236,571.4546,86.6628,7.0);
return 1;
}
else if(CP[playerid]==403)
{
DisablePlayerCheckpoint(playerid);
CP[playerid] = 404;
SetPlayerRaceCheckpoint(playerid,3,-441.9236,571.4546,86.6628,-94.3545,814.2031,83.5022,7.0);
return 1;
}
else if(CP[playerid]==404)
{
DisablePlayerCheckpoint(playerid);
CP[playerid] = 405;
SetPlayerRaceCheckpoint(playerid,3,-94.3545,814.2031,83.5022,206.8825,1103.8097,79.5797,7.0);
return 1;
}
else if(CP[playerid]==405)
{
DisablePlayerCheckpoint(playerid);
CP[playerid] = 406;
SetPlayerRaceCheckpoint(playerid,3,206.8825,1103.8097,79.5797,360.8752,1433.6638,84.1947,7.0);
return 1;
}
else if(CP[playerid]==406)
{
DisablePlayerCheckpoint(playerid);
CP[playerid] = 407;
SetPlayerRaceCheckpoint(playerid,3,237.0898,1716.8671,99.5659,-248.8507,1823.7936,109.7424,7.0);
return 1;
}
else if(CP[playerid]==407)
{
DisablePlayerCheckpoint(playerid);
CP[playerid] = 408;
SetPlayerRaceCheckpoint(playerid,3,-248.8507,1823.7936,109.7424,-575.5409,1712.1396,132.7493,7.0);
return 1;
}
else if(CP[playerid]==408)
{
DisablePlayerCheckpoint(playerid);
CP[playerid] = 409;
SetPlayerRaceCheckpoint(playerid,3,-575.5409,1712.1396,132.7493,-864.1115,1465.8033,93.3561,7.0);
return 1;
}
else if(CP[playerid]==409)
{
DisablePlayerCheckpoint(playerid);
CP[playerid] = 410;
SetPlayerRaceCheckpoint(playerid,3,-864.1115,1465.8033,93.3561,-947.1935,1092.1521,79.0029,7.0);
return 1;
}
else if(CP[playerid]==410)
{
DisablePlayerCheckpoint(playerid);
CP[playerid] = 411;
SetPlayerRaceCheckpoint(playerid,3,-947.1935,1092.1521,79.0029,-1172.3732,333.8894,47.6421,7.0);
return 1;
}
else if(CP[playerid]==411)
{
DisablePlayerCheckpoint(playerid);
CP[playerid] = 412;
SetPlayerRaceCheckpoint(playerid,4,-1172.3732,333.8894,47.6421,-1533.0518,-36.5082,15.1076,7.0);
return 1;
}
else if(CP[playerid]==412)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:health;
new veh;
veh = GetPlayerVehicleID(playerid);
GetVehicleHealth(veh, health);
if (health < 380)
{
format(string,sizeof(string)," You have failed the test due to reckless flying! Visit the license center to retake the test.");
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
DisablePlayerRaceCheckpoint(playerid);
RemovePlayerFromVehicle(playerid);
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
SetPlayerVirtualWorld(playerid, 0);
FlyingInfo[playerid][FlyingTest] = 0;
return 1;
}
else if(health >= 380.0)
{
DisablePlayerRaceCheckpoint(playerid);
GameTextForPlayer(playerid," ~w~Test Completed.",3000,3);
format(string,sizeof(string),"You have passed the Test. Here is your Flying license.");
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
PlayerInfo[playerid][pFlyLic] = 1;
RemovePlayerFromVehicle(playerid);
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
SetPlayerVirtualWorld(playerid, 0);
FlyingInfo[playerid][FlyingTest] = 0;
return 1;
}
}
return 1;
}
What is wrong and what should I change?
Thanks: jakejohnsonusa
Re: Help with checkpoints DMV system -
MatZZPL - 15.11.2012
Yeah it won't work like this, i tried it too. However thats how i done it..
PHP код:
new Ccp[MAX_PLAYERS];
PHP код:
Ccp[playerid] = 1; // This will change the variable, so we can use it later on with OnPlayerEnterCheckpoint
SetPlayerCheckpoint(playerid, 1920.0251,-1788.2981,12.9542, 10.3839, 3.0); // This creates a checkpoint at the coцrdinates: "-269.1287,2610.6057,63.2069"
PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
if(Ccp[playerid] == 1) // This checks if our variable equals to 1, if so: it continues
{
DisablePlayerCheckpoint(playerid); // This makes sure that there will be a new checkpoint
SendClientMessage(playerid, 0xFFFFFFFF, "You delivered the goods, go to the Courier Agency to get some more jobs.");
GivePlayerCash(playerid, 4250);
return 1;
}
}
something like that?
Re: Help with checkpoints DMV system -
jakejohnsonusa - 15.11.2012
I'm confused... what's wrong with what I have? It looks the same as yours...
Re: Help with checkpoints DMV system -
Tomejus - 15.11.2012
Well, in first look code looks good, you should add some prints and track where code ends, it would be easier to find out whats wrong.
Re: Help with checkpoints DMV system -
MatZZPL - 15.11.2012
Okay, try to use normal check points, disable them and set the next one.. (sorry didn't see xD) I'll check if you don't work it out i should tell u in few mins
Re: Help with checkpoints DMV system -
jakejohnsonusa - 15.11.2012
Ok... Yea... I checked every cord... they should be working.... But they aren't.
Re: Help with checkpoints DMV system -
MatZZPL - 15.11.2012
do it like this
PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
if(Ccp[playerid] == 1) // This checks if our variable equals to 1, if so: it continues
{
DisablePlayerCheckpoint(playerid); // This makes sure that there will be a new checkpoint
Ccp[playerid] = 2; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
SetPlayerCheckpoint(playerid, -1051.4005,-655.8729,31.7361, 3.0); // Creates a new checkpoint at a different position
SendClientMessage(playerid, 0xFFFFFFFF, "You loaded your goods, go to the next checkpoint to continue.");
return 1;
}
return 1;
}
@@ 100% works, sorry if i'm talking bit of nonsense lol, tired as ****
Re: Help with checkpoints DMV system -
jakejohnsonusa - 15.11.2012
The full start test code is:
Код:
if(strcmp(cmd, "/buyflying", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pPassport] == 0) return SendClientMessage(playerid, COLOR_GREY,"* You need a passport before having any license!!");
if(IsPlayerInRangeOfPoint(playerid, 3,1490.3195,1305.6976,1093.2964))
{
if(PlayerInfo[playerid][pFlyLic] == 0)
{
if(GetPlayerMoney(playerid) < 10500)
{
SendClientMessage(playerid, COLOR_GREY, "You don't have enough money for a flying license");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have selected to take the flying test");
SafeGivePlayerMoney(playerid, - 10500);
FlyingInfo[playerid][FlyingTest] = 1;
SafeSetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, drivingtest);
SafeSetPlayerPos(playerid, -1452.036010, 28.835857, 13.490882)
SetPlayerRaceCheckpoint(playerid,3,-1444.2026,53.7472,22.4049,-1133.9303,333.3353,59.9484,7.0);
CP[playerid] = 400;
OnPlayerUpdateEx(playerid);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /buyflying",d,m,y,h,mi,s,sendername);
CommandLog(string);
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, " You already own a flying license");
return 1;
}
}
}
return 1;
}
If this helps...
Re: Help with checkpoints DMV system -
MatZZPL - 15.11.2012
Do what i did ^ just edit a lil bit the code
Re: Help with checkpoints DMV system -
jakejohnsonusa - 15.11.2012
I don't see the diff between mine and that one.