how to get player in car
#1

how to make a command that get a player in my car and a command to remove him from my car

+REP
Reply
#2

Im just giving you help. You create your command by yourself
PHP код:
new vehid;
vehid GetPlayerVehicleID(playerid);
PutPlayerInVehicle(targetvehidseatnumber); 
and about removing, you can set that player's Z to a higher height like below :
PHP код:
new Float:X,Float:Y,Float:Z;
GetPlayerPos(targetX,Y,Z);
SetPlayerPos(targetX,Y,Z+5); 
Reply
#3

try it:
@edit
PHP код:
CMD:eject(playeridparams[])
{
    new 
idvehiddriverpassenger;
    
vehid GetPlayerVehicleID(playerid);
    
driver GetPlayerState(playerid);
    if(
sscanf(params"u"id)) return SendClientMessage(playerid, -1"type: /eject [id] ");
    
passenger GetPlayerState(id);
    if(!
IsPlayerInVehicle(playeridvehid)) 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(idvehid)) return SendClientMessage(playerid,-1"this player is not in vehicle");
    
RemovePlayerFromVehicle(id);
    
SendClientMessage(playerid, -1"you kick passenger from your vehicle!");
    return 
1;

Reply
#4

This is mine
PHP код:
CMD:mvp(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdminlvl] > 0)
    {
        new 
cibleseatvehFloat:xFloat:yFloat:z;
         if(
sscanf(params,"ui",cibleseat)) return SendClientMessage(playeridX11_LIGHT_BLUE_1"/mvp [Player_ID] [Seat]");
        if(!
IsPlayerConnected(cible)) return SendClientMessage(playeridred"[SYSTEM]"rougeUC" The player is not connected.");
        if(
IsPlayerInAnyVehicle(cible)) return SendClientMessage(playeridred"[SYSTEM]"rougeUC" This player is in a vehicle.");
        
GetPlayerPos(ciblexyz);
        if(!
IsPlayerInRangeOfPoint(playerid5xyz)) return SendClientMessage(playeridred"[SYSTEM]"rougeUC" The player is too far away");
         if(
GetPlayerVehicleSeat(playerid) != 0) return SendClientMessage(playeridred"[SYSTEM]"rougeUC" You must be the driver");
         if(
seat || seat 0) return SendClientMessage(playeridred"[SYSTEM]"rougeUC" The seat is to be between 1-3");
        
veh GetPlayerVehicleID(playerid);
        
PutPlayerInVehicle(ciblevehseat);
        return 
1;
    }
    else return 
SendClientMessage(playeridred"[SYSTEM]"rougeUC" You can't use this command");

Translated from my gm
Reply
#5

i mean if iam in lv and he in sf i can get him in my vehicle how
Reply
#6

USe PutPlayerInVehicle for that. like PutPlayerInVehicle(playerid, carid, seatnumber)
Reply
#7

Quote:
Originally Posted by Loinal
Посмотреть сообщение
i mean if iam in lv and he in sf i can get him in my vehicle how
ok let's go
PHP код:
CMD:put(playeridparams[])
{
    new 
iddrivervehid;
    
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(idvehid1);
    
SendClientMessage(playerid, -1"you put another player in your vehicle sucessfully!");

Reply
#8

Код:
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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)