PutPlayerInVehicle Problem
#1

Im trying to make a command /getin but when i attempt to put the player in a vehicle like id 435 Nothing happens.. Any ideals I did a simple code before detecting range of the vehicle

pawn Код:
CMD:getin(playerid,params[])
{
PutPlayerInVehicle(playerid,435,2);
return 1;
}
So I can Tow the trailer with semi with player in it
Reply
#2

There are vehicle ids and and there are ids of vehicles created!
edit if using sscanf
pawn Код:
CMD:getin(playerid,params[])
{
if (sscanf(params,"i", params[0])) return SendClientMessage(playerid, -1, "Usage: /getin[playerid]");
PutPlayerInVehicle(playerid,GetPlayerVehicleID(params[0]),2);
}
Reply
#3

Don't work sorry... same as mine nothing just stays there even with cmd created gamemode created i used vehicle ID and Player id nothing
Reply
#4

Try this:
pawn Код:
CMD:getin(playerid,params[])
{
    new Float:x, Float:y, Float:z, Float:ang;
    GetPlayerPos(playerid,x,y,z);
    GetPlayerFacingAngle(playerid, ang);
    if(IsPlayerInAnyVehicle(playerid))
    {
        RemovePlayerFromVehicle(playerid);
    }
    new vehicle = CreateVehicle(435, x, y, z+3, ang, 0, 0, -1)
    PutPlayerInVehicle(playerid,vehicle,0);
    return 1;
}
Reply
#5

That worked but i want to get in a vehicle thats already spawned..

Oops just notice i typed that twice
Reply
#6

pawn Код:
CMD:getin(playerid,params[])
{
if (sscanf(params,"i", params[0])) return SendClientMessage(playerid, -1, "Usage: /getin [playerid]");
if(!IsPlayerInAnyVehicle(params[0])) return SendClientMessage(playerid, -1, "player is not in a vehicle");
PutPlayerInVehicle(playerid,GetPlayerVehicleID(params[0]),1);
}
That will work if you point to a playerid and if the seat is free!
Reply
#7

Here's a command which puts player in vehicle according to the vehicle id input by the user on /getin command.
Usage: /getin [vehicleid]
pawn Код:
CMD:getin(playerid, params[])
{
 new vid, Float:xp, Float:yp, Float:zp;
 if(sscanf(params, "i", vid)) return SendClientMessage(playerid, -1, "Usage: /getin [vehicleid]");
 if(IsPlayerInAnyVehicle(playerid)) return RemovePlayerFromVehicle(playerid);
 GetPlayerPos(playerid, xp, yp, zp);
 SetVehiclePos(vid, xp, yp, zp+3);
 PutPlayerInVehicle(playerid, vid, 1);
 return 1;
}
Edit:late.. :/
Reply
#8

Is it possible to /getin and It just throw u in a random vehicle near you other then passenger 2 and driver seat 1? Im tired as hell or i done figured this out hehe
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)