Put Player in vehicle command
#1

I wanna make command to put player in my vehicle, but i don't know how to check if the seat is empty.

I have this code:
Code:
stock IsSeatTaken(vehicleid, seatid)
{
    foreach(Player, i)
    {
        if(GetPlayerVehicleID(i) == vehicleid && GetPlayerVehicleSeat(i) == seatid) return 1;
    }
    return 0;
}
AND i have this command:
Code:
CMD:pinc(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		new id, seatid, AdminName[MAX_PLAYER_NAME], string[128], tt[MAX_PLAYER_NAME], strr[128];
		GetPlayerName(playerid, AdminName, sizeof(AdminName));
		if(sscanf(params, "ud", id, seatid)) return SendClientMessage(playerid, WHITE, "USAGE:/pinc [partofname/playerid] [seatID]");
		if(id == INVALID_PLAYER_ID) SendClientMessage(playerid, RED, "Player not found!");
		if(!IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) return SendClientMessage(playerid, RED, "You have to be in a car to use this command!");
		if(seatid >= 4 || seatid < 1) return SendClientMessage(playerid, RED, "Invalid SeatID!");
		new Float:pincX, Float:pincY, Float:pincZ, curtveh, vehseat;
		curtveh = GetPlayerVehicleID(playerid);
		vehseat = GetPlayerVehicleSeat(id);
		foreach(Player, p)
		{
			if(IsSeatTaken)
			{
                        }
                }
		GetVehiclePos(curtveh, pincX, pincY, pincZ);
		PutPlayerInVehicle(id,curtveh,seatid);
        }
	else SendClientMessage(playerid, RED, "You are not a admin!");
	return 1;
}
Reply


Messages In This Thread
Put Player in vehicle command - by Stoyanov - 01.01.2015, 18:44
Re: Put Player in vehicle command - by ATGOggy - 02.01.2015, 05:13
Re: Put Player in vehicle command - by NourNN - 17.12.2015, 06:10
Re: Put Player in vehicle command - by Ritzy2K - 17.12.2015, 06:46
Re: Put Player in vehicle command - by JaKe Elite - 17.12.2015, 09:02

Forum Jump:


Users browsing this thread: 1 Guest(s)