put player in car problem
#1

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
Reply
#2

Код:
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?
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)