03.08.2012, 08:16
Hi all, how can I do that the player would not go out of the car?
Thanks for help.
Thanks for help.
public OnPlayerExitVehicle(playerid, vehicleid)
{
new seat = GetPlayerVehicleSeat(playerid);
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(playerid,x,y,z);
PutPlayerInVehicle(playerid,vehicleid,seat);
return 1;
}
isn't this completelly useless? you ar eputting player into vehicle, it will automatically set his position..
|
Actually not.
If I dont use that code, it will fail to put player in vehicle(if he was a driver), reason being driver seat would be occupied by player. This was needed to vacant the driver seat. |
ClearAnimations(playerid);
public OnPlayerExitVehicle(playerid, vehicleid)
{
ClearAnimations(playerid);
PutPlayerInVehicle(playerid, vehicleid, GetPlayerVehicleSeat(playerid));
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(StayInTheCar[playerid] == 1)
{
SendClientMessage(playerid, -1,"You cant go out from Vehicle");
}
new vID = GetPlayerVehicleID(playerid);
new pSeat = GetPlayerVehicleSeat(playerid);
new Float:posX, Float:posY, Float:posZ;
GetPlayerPos(playerid,posX,posY,posZ);
SetPlayerPos(playerid,posX,posY,posZ);
StayInTheCar[playerid] = 1;
PutPlayerInVehicle(playerid,vID,pSeat);
return 1;
}
pawn Код:
|