SA-MP Forums Archive
Vehicle - 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: Vehicle (/showthread.php?tid=607085)



Vehicle - Micko123 - 14.05.2016

So i want to make derby map. I have map but also i have problem. I want when player trype /derby to join on random coords on map and to be putted in veh. I did this but it doesn't work.
Код:
CMD:derby(playerid, params[])
{
	PlayerJoinedDerby[playerid] = 1;
	new randomcoords = random(sizeof(DBSpawn));
	SPP(playerid, DBSpawn[randomcoords][0], DBSpawn[randomcoords][1], DBSpawn[randomcoords][2]);
	PutPlayerInVehicle(playerid, veh, 0);
	LoadObjectsForPlayer(playerid);
	return 1;
}
Any ideas?? I am confused because it would be easy with only 1 spawn place. I want random


Re: Vehicle - Miller007 - 14.05.2016

CMD:derby(playerid, params[])
{
PlayerJoinedDerby[playerid] = 1;
new RandomTP = Random(3);//Defines the variable into how many randoms(teleports u want)
switch(RandomTP)//tells server to make the next lot of case's to be selected at random
{
case 0: SetPlayerPos(playerid,derby pos1 cordinates);
case 1: SetPlayerPos(playerid,derby pos2 cordinates);
case 2: SetPlayerPos(playerid,derby pos3 cordinates);
}
CarSpawner(playerid,vehicle);
LoadObjectsForPlayer(playerid);
return 1;
}