28.08.2011, 22:36
Hi, if you remember me, I had lots of problems making my driving missions for my server lately...
Since the pickup system didn't work out in any way I decided to go to a checkpoint system...
well here's the code:
NOTE: normally I'm using 3 CP but now I only show 2 because the problem is in the second checkpoint...
more code
Ok so the problem...
when I drive in the first checkpoint it works, and the textdraw and client messages appear...
then when I go to the location of CP number 2, there is no checkpoint...
I Don't really see what is the problem...
it might be caused because my code is not so clean and readable all the time,
but I got no errors...
Any Help?
Since the pickup system didn't work out in any way I decided to go to a checkpoint system...
well here's the code:
Код:
public OnPlayerEnterCheckpoint(playerid) { new vehicle; vehicle = GetVehicleModel(GetPlayerVehicleID(playerid)); if(IsPlayerInRangeOfPoint(playerid, 2, 669.7355,-1275.9504,13.4609)) //startwork { if(vehicle == 516) { SetPlayerMapIcon( playerid, 2, 334.4390,-1519.8026,35.7015, 55, 0, MAPICON_GLOBAL ); GameTextForPlayer(playerid,"~w~ Job Lvl 1~g~ :Travis Pastrana is going to participate the X-games",4000,3); SendClientMessage(playerid, COLOR_YELLOW, "|- Check the map to see the point where to go. -|"); IsWorking[playerid] = 1; FinishedTask1[playerid] = 1;//he entered the pickup DisablePlayerCheckpoint(playerid); SetPlayerCheckpoint(playerid,334.4390,-1519.8026,35.7015,2); //next checkpoint obviously... //De Textdraw TextDrawShowForPlayer(playerid,Opdracht); Opdracht = TextDrawCreate(4.000000,435.000000,"~w~Bring ~y~ Travis Pastrana ~w~ From ~b~His hotel~w~ To ~g~The stadium!"); TextDrawFont(Opdracht,1); TextDrawColor(Opdracht,0xFFFFFFAA); TextDrawLetterSize(Opdracht,0.4,1); TextDrawSetOutline(Opdracht,1); TextDrawSetShadow(Opdracht,0); TextDrawSetProportional(Opdracht,1); TextDrawBackgroundColor(Opdracht,0x000000ff); TextDrawUseBox(Opdracht, 1); TextDrawBoxColor(Opdracht, 0x000000AA); if(IsPlayerInRangeOfPoint(playerid, 50, 334.4390,-1519.8026,35.7015)) { SetPlayerCheckpoint(playerid,334.4390,-1519.8026,35.7015,2); } return 1; } //code here } else if(IsPlayerInRangeOfPoint(playerid, 2, 334.4390,-1519.8026,35.7015)) { if(vehicle == 516) { SetPlayerMapIcon( playerid, 2, 334.4390,-1519.8026,35.7015, 55, 0, MAPICON_GLOBAL ); GameTextForPlayer(playerid,"~w~ Job Lvl 1~g~ :Travis Pastrana is going to participate the X-games",4000,3); SendClientMessage(playerid, COLOR_YELLOW, "|- Check the map to see the point where to go. -|"); IsWorking[playerid] = 1; FinishedTask2[playerid] = 1;//he entered the pickup //De Textdraw TextDrawShowForPlayer(playerid,Opdracht); Opdracht = TextDrawCreate(4.000000,435.000000,"~w~Bring ~y~ Travis Pastrana ~w~ From ~b~His hotel~w~ To ~g~The stadium!"); TextDrawFont(Opdracht,1); TextDrawColor(Opdracht,0xFFFFFFAA); TextDrawLetterSize(Opdracht,0.4,1); TextDrawSetOutline(Opdracht,1); TextDrawSetShadow(Opdracht,0); TextDrawSetProportional(Opdracht,1); TextDrawBackgroundColor(Opdracht,0x000000ff); TextDrawUseBox(Opdracht, 1); TextDrawBoxColor(Opdracht, 0x000000AA); return 1; } } return 1; }
more code
Код:
forward CheckpointCheck(); public CheckpointCheck() { for(new i; i<MAX_PLAYERS; i++)// a loop that goes though all players { if(IsPlayerConnected(i)) { if(IsPlayerInRangeOfPoint(i, 50, 669.7355,-1275.9504,13.4609)) //The first CP { SetPlayerCheckpoint(i,669.7355,-1275.9504,13.4609,2); //First CP } else { DisablePlayerCheckpoint(i); } } } return 1; }
when I drive in the first checkpoint it works, and the textdraw and client messages appear...
then when I go to the location of CP number 2, there is no checkpoint...
I Don't really see what is the problem...
it might be caused because my code is not so clean and readable all the time,
but I got no errors...
Any Help?
