11.06.2016, 21:10
how to make a command that get a player in my car and a command to remove him from my car
+REP
+REP
new vehid;
vehid = GetPlayerVehicleID(playerid);
PutPlayerInVehicle(target, vehid, seatnumber);
new Float:X,Float:Y,Float:Z;
GetPlayerPos(target, X,Y,Z);
SetPlayerPos(target, X,Y,Z+5);
CMD:eject(playerid, params[])
{
new id, vehid, driver, passenger;
vehid = GetPlayerVehicleID(playerid);
driver = GetPlayerState(playerid);
if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "type: /eject [id] ");
passenger = GetPlayerState(id);
if(!IsPlayerInVehicle(playerid, vehid)) return SendClientMessage(playerid, -1, "you must is in vehicle");
else if(driver != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, -1, "you must be a driver!");
else if(passenger != PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, -1, "this player is not passenger");
else if(!IsPlayerInVehicle(id, vehid)) return SendClientMessage(playerid,-1, "this player is not in vehicle");
RemovePlayerFromVehicle(id);
SendClientMessage(playerid, -1, "you kick passenger from your vehicle!");
return 1;
}
CMD:mvp(playerid, params[])
{
if(PlayerInfo[playerid][pAdminlvl] > 0)
{
new cible, seat, veh, Float:x, Float:y, Float:z;
if(sscanf(params,"ui",cible, seat)) return SendClientMessage(playerid, X11_LIGHT_BLUE_1, "/mvp [Player_ID] [Seat]");
if(!IsPlayerConnected(cible)) return SendClientMessage(playerid, red, "[SYSTEM]"rougeUC" The player is not connected.");
if(IsPlayerInAnyVehicle(cible)) return SendClientMessage(playerid, red, "[SYSTEM]"rougeUC" This player is in a vehicle.");
GetPlayerPos(cible, x, y, z);
if(!IsPlayerInRangeOfPoint(playerid, 5, x, y, z)) return SendClientMessage(playerid, red, "[SYSTEM]"rougeUC" The player is too far away");
if(GetPlayerVehicleSeat(playerid) != 0) return SendClientMessage(playerid, red, "[SYSTEM]"rougeUC" You must be the driver");
if(seat > 3 || seat < 0) return SendClientMessage(playerid, red, "[SYSTEM]"rougeUC" The seat is to be between 1-3");
veh = GetPlayerVehicleID(playerid);
PutPlayerInVehicle(cible, veh, seat);
return 1;
}
else return SendClientMessage(playerid, red, "[SYSTEM]"rougeUC" You can't use this command");
}
CMD:put(playerid, params[])
{
new id, driver, vehid;
vehid = GetPlayerVehicleID(playerid);
driver = GetPlayerState(playerid);
if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "type: /put [id]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "this Player is not connected!");
if(driver != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, -1, "you must be a driver!");
if(IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, -1, "the player is in any vehicle!");
PutPlayerInVehicle(id, vehid, 1);
SendClientMessage(playerid, -1, "you put another player in your vehicle sucessfully!");
}
CMD:getincar(playerid,params[]) { new ID,seat, if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)return SendClientMessage(playerid,-1,"You need to be vehicle driver to use this cmd."); if(sscanf(params,"i",ID,seat))return SendClientMessage(playerid,-1,"/getincar Id"); new Veh = GetPlayerVehicleID(playerid); PutPlayerInVehicle(ID,Veh,seat); return 1; }