#1

So guys i want player on command /derby to spawn on random coords and i want him to be in vehicle on spawn
Here is what i did. It spawns player where i want but wont put him in vehicle
Код:
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, 411, 0);
	LoadObjectsForPlayer(playerid);
	return 1;
}
What to do?
Reply
#2

Код:
PutPlayerInVehicle(playerid, 411, 0);
you here put player in a vehicle which its id is 411, not it's model.
function's structure:
Код:
PuPlayerInVehicle(playerid, vehicleid, seatid)
i guess you here meant 411 as a vehicle model id, but it's the vehicle id where to put the player, defined by AddStaticVehicle or CreateVehicle, so you need to create the vehicle, and assign a variable for the function's return value, and use that variable that holds the vehicleid in PutPlayerInVehicle, like this
Код:
new veh;
veh = CreateVehicle(411, // the rest of params); 
PutPlayerInVehicle(playerid, veh, 0);
Reply
#3

Correct. Also you don't need to use the 'veh' var if you only need to use it once. But really, you should be storing the vehicle id globally so it can be destroyed.

Код:
PutPlayerInVehicle(playerid, CreateVehicle(411, // the rest of params), 0);
Reply
#4

Thank you guys a lot
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)