SA-MP Forums Archive
put player in car problem - 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: put player in car problem (/showthread.php?tid=664181)



put player in car problem - PoniStar - 21.02.2019

hi so i want to put a player in car but how can i check is a seat empty ? and no other player seats on that seatid ? and if all of them are in use send a mssg to client


Re: put player in car problem - RudeWorld - 21.02.2019

Код:
CMD:putplayerincar(playerid, params[])
{
	new id, seat, vehicle = GetPlayerVehicleID(playerid);
	
	if(sscanf(params,"ud",id,seat)) return SCM(playerid, COLOR_GREY, "USAGE: /putplayerincar [player ID] [seats 1-3]");

	if(seat > 3 || seat < 1) return SCM(playerid, COLOR_RED, "ERROR: Pick one 1 or 3.");
	if(id == playerid) return SCM(playerid, COLOR_RED, "ERROR: You can't put yourself in a vehicle.");
	if(!PlayerInCar(playerid)) return SCM(playerid, COLOR_RED, "ERROR: You have to be in a vehicle.");
	
	if(!PlayerNearPlayer(10.0, playerid, id)) return NotNearPlayerMSG(playerid);
	
	ClearAnimations(id, 1);
	PutPlayerInVehicle(id, vehicle, seat);
	
	SCMEx(playerid, COLOR_YELLOW, "-> %s you have put him in a vehicle.", GetNameEx(id));
	SCMEx(id, COLOR_YELLOW, "-> %s put you in a vehicle.", GetNameEx(playerid));
	return 1;
}


stock NotNearPlayerMSG(playerid)
{
	return SCM(playerid, COLOR_RED, "ERROR: You aren't near that player.");
}
Start with this maybe?


Re: put player in car problem - TheToretto - 21.02.2019

Quote:
Originally Posted by Littlehelper
Посмотреть сообщение
pawn Код:
stock IsSeatTaken(vehicleid, seatid)
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(GetPlayerVehicleID(i) == vehicleid && GetPlayerVehicleSeat(i) == seatid) return 1;
    }
    return 0;
}
Search function