SA-MP Forums Archive
PutPlayerInVehicle Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: PutPlayerInVehicle Problem (/showthread.php?tid=399246)



PutPlayerInVehicle Problem - Buzzbomb - 13.12.2012

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


Re: PutPlayerInVehicle Problem - park4bmx - 13.12.2012

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);
}



Re: PutPlayerInVehicle Problem - Buzzbomb - 13.12.2012

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


Re: PutPlayerInVehicle Problem - Threshold - 13.12.2012

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;
}



Re: PutPlayerInVehicle Problem - Buzzbomb - 13.12.2012

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

Oops just notice i typed that twice


Re: PutPlayerInVehicle Problem - park4bmx - 13.12.2012

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!


Re: PutPlayerInVehicle Problem - Lordzy - 13.12.2012

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.. :/


Re: PutPlayerInVehicle Problem - Buzzbomb - 13.12.2012

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