SA-MP Forums Archive
Starting work at nearest checkpoint - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Starting work at nearest checkpoint (/showthread.php?tid=451557)



Starting work at nearest checkpoint - Coz - 17.07.2013

The autowork option in my gamemode is bugged at the moment and doesn't actually work. Instead i'm trying to set it up so when you type /w (work) to start a mission, it will start at the NEAREST checkpoint. Right now it is set to random. Below is the code, anybody know how to fix this? Thanks

Код:
else if(TypeFlight[playerid] == 4) // dodo
	{
	    StartedMission[playerid] = 1;
	    new rand = random(sizeof(DSLocations));
		new string2[65], message[128];
		SetPlayerFlightCheckpoint(playerid, DSLocations[rand][LocX],DSLocations[rand][LocY],DSLocations[rand][LocZ], 15.0);
		format(string2, sizeof(string2), "%s", DSLocations[rand][LocationName]); //PASSWORD
		strmid(FirstAPName[playerid], string2, 0, strlen(string2), 128); //PASSWORD
		//FirstAPName[playerid] = ALocations[rand][LocationName];
		//FirstAPName[playerid] = AndroDName;
		format(message,sizeof(message), "Head to {1B8AE4}%s {FFFFFF}and pick up the passenger.", DSLocations[rand][LocationName]);
		SendClientMessage(playerid, COLOR_WHITE, message);
		MissionStage[playerid] = 1;
		WantsRecording[playerid] = 1;
		Pos1[playerid] = DSLocations[rand][LocX];
		Pos2[playerid] = DSLocations[rand][LocY];
		Pos3[playerid] = DSLocations[rand][LocZ];
	}



Re: Starting work at nearest checkpoint - Cap1 - 18.07.2013

yea, i'm having the same problem but nobody ever replies to any serious questions. they're too busy responding to moronic insignificant posts!


Re: Starting work at nearest checkpoint - dominik523 - 18.07.2013

you can use GetPlayerDistanceFromPoint to get the nearest point.


Re: Starting work at nearest checkpoint - Cap1 - 18.07.2013

maybe replace [rand] with [playerid]


Re: Starting work at nearest checkpoint - Vampr - 18.07.2013

Quote:
Originally Posted by dominik523
Посмотреть сообщение
you can use GetPlayerDistanceFromPoint to get the nearest point.
This didnt work.. thanks though