#1

How to make some players spawn in a car in a certain positio just like in races?
Like when the first player types /race he is placed first,the second one ,next to him ,3rd one behind the first,and so on!
Reply
#2

Well you can use global variables for this like

new EnteredRace;

when first player do /race it turns to 1 so you can work withcases

like

Код:
switch(EnteredRace)
{
case 1: { SetPlayerPos(playerid, 1stX, 1stY, 1stZ); EnteredRace++; }
case 2: { SetPlayerPos(playerid, 2ndX, 2ndY, 2ndZ); EnteredRace++; }
case 3: { SetPlayerPos(playerid, 3rdX, 3rdY, 3rdZ); EnteredRace++; }
case 4: { SetPlayerPos(playerid, 4thX, 4thY, 4thZ); EnteredRace++; }
// add as many positions as you wish
}
Reply
#3

Код:
	case 1:
		{
		SetPlayerPos(playerid, 1527.1901,-1712.9625,13.0891);
		EnteredRace++;
        new vehicle;		vehicle = GetPlayerVehicleID(playerid);		DestroyVehicle(vehicle);
		new Float:Pos[3]; GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
	  	new veh = CreateVehicle(522, 1527.1901,-1712.9625,13.0891,179.3196, -1, -1,10000);
        SetVehicleVirtualWorld(veh, 3);//GetPlayerVehicleID(playerid)
  		PutPlayerInVehicle(playerid, veh, 0);
		}
Is this code good?
Reply
#4

Quote:
Originally Posted by ColdXX
Посмотреть сообщение
Код:
	case 1:
		{
		SetPlayerPos(playerid, 1527.1901,-1712.9625,13.0891);
		EnteredRace++;
        new vehicle;		vehicle = GetPlayerVehicleID(playerid);		DestroyVehicle(vehicle);
		new Float:Pos[3]; GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
	  	new veh = CreateVehicle(522, 1527.1901,-1712.9625,13.0891,179.3196, -1, -1,10000);
        SetVehicleVirtualWorld(veh, 3);//GetPlayerVehicleID(playerid)
  		PutPlayerInVehicle(playerid, veh, 0);
		}
Is this code good?
It seems correct do you have any errors?
Reply
#5

Works just fine!
Now what about a /go command that sets the players in the race Controllable = 1?
InRace..
Reply
#6

well you need an array for every player that joins the race so

Код:
new Joined[MAX_PLAYERS]; // at the top of the script

Joined[playerid] = 1; // under /race command

if(strcmp(cmd, "/go", true) == 0)
{
     for(new i=0; i<MAX_PLAYERS; i++)
     {
          if(Joined[i] == 1)
         {
             TogglePlayerControllable(i, true);
         }
     }
     return 1;
 }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)