Put a player in vehicle
#1

I'm using a FS I put into my GM and I'm having trouble putting my player into the vehicle after he's done using the feature.

Quote:

if (strcmp("/cameraon", cmdtext, true) == 0)
{
if(Spawned[playerid] == 1)
{
if(PlayerInfo[playerid][pJob] != 7)
{
SendClientMessage(playerid, COLOR_GREY, "[ERROR:] You're not a Reporter!");
return 1;
}
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 582)
{
PlayerMenu[playerid] = 0;
TogglePlayerControllable(playerid, 0);
ShowMenuForPlayer(CCTVMenu[0], playerid);
}
else
{
SendClientMessage(playerid,COLOR_LIGHTYELLOW2, "[INFO:] You're not in a News Reporter Van!");
}
}
return 1;
}

Quote:

if (strcmp("/cameraoff", cmdtext, true) == 0)
{
if(CurrentCCTV[playerid] > -1)
{
SetPlayerPos(playerid, LastPos[playerid][LX], LastPos[playerid][LY], LastPos[playerid][LZ]);
SetPlayerFacingAngle(playerid, LastPos[playerid][LA]);
SetPlayerInterior(playerid, LastPos[playerid][LInterior]);
TogglePlayerControllable(playerid, 1);
KillTimer(KeyTimer[playerid]);
SetCameraBehindPlayer(playerid);
TextDrawHideForPlayer(playerid, TD);
CurrentCCTV[playerid] = -1;
return 1;
}
}

How do I make it so he returns to his vehicle after he's done using the command?
Reply
#2

By using PutPlayerInVehicle.
Reply
#3

I did that but it's not working. I'm sure exactly what I'm supposed to do...
Reply
#4

Did you read the wiki link...
Reply
#5

Use GetPlayerVehicleID on /cameraon, and on /cameroff put the player back in the same vehicle using PutPlayerInVehicle
Reply
#6

Quote:
Originally Posted by Snyper
I did that but it's not working.
It does. I'm sure you didn't used it correctly.
Reply
#7

I'm sorry. I'm having an embarassing moment right now. I can usually fix things pretty well by myself but, I'm having a brain fart.

Can someone just do it for me? I'll learn from it more then the frustration that it's causing to make it work.
Reply
#8

where exactly he sould get put in the vehicle?
Reply
#9

I want him to get the vehicle id when he uses /cameraon and when he writes /cameroff he returns back to his previous vehicle.

Right now when the person writes /cameron the person gets teleported somewhere, and returns later. He's in the driver seat.
Reply
#10

SA-MP doesn't have function which could detect on which seat was he sitting unless you make your own function which will store player's seatid.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)