01.01.2015, 18:44
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:
AND i have this command:
I have this code:
Code:
stock IsSeatTaken(vehicleid, seatid) { foreach(Player, i) { if(GetPlayerVehicleID(i) == vehicleid && GetPlayerVehicleSeat(i) == seatid) return 1; } return 0; }
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; }