Help for Tram - 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: Help for Tram (
/showthread.php?tid=297524)
Help for Tram -
Join7 - 16.11.2011
I need some help. When you enter the tram with the command /tramenter, by clicking the button F/ENTER, the camera remains on the tram, but my player exits the tram.
Must be put somewhere SetCameraBehindPlayer.
Note: I don't want DestroyVehicle or respawn vehicle.
Re: Help for Tram -
Sinner - 16.11.2011
Quote:
Must be put somewhere SetCameraBehindPlayer.
|
Yes that should work.
Re: Help for Tram -
Join7 - 16.11.2011
It works, but I do not know how to do it, to put it in pressing F/ENTER
Re: Help for Tram -
Kostas' - 16.11.2011
Try this.
But I didn't test it.
I hope it works!
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(vehicleid == tram) {
new
playerState = GetPlayerState(playerid);
if (playerState == PLAYER_STATE_PASSENGER || playerState == PLAYER_STATE_DRIVER) {
tram = GetPlayerVehicleID(playerid);
new
Float:vehx, Float:vehy, Float:vehz;
GetVehiclePos(tram, vehx, vehy, vehz);
SetPlayerPos(playerid, vehx+1, vehy+1, vehz);
}
}
return 1;
}
Re: Help for Tram -
Join7 - 16.11.2011
no change
again so
Re: Help for Tram -
Kostas' - 16.11.2011
Again? Oh, God!
I don't know about the camera a lot and may be wrong.
I suggest you to respawn the car and I guess the camera will change
Re: Help for Tram -
Join7 - 16.11.2011
There is a way without respawn tram
Re: Help for Tram -
Kostas' - 16.11.2011
As I read before with Camera
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(vehicleid == tram) {
new
playerState = GetPlayerState(playerid);
if (playerState == PLAYER_STATE_PASSENGER || playerState == PLAYER_STATE_DRIVER) {
tram = GetPlayerVehicleID(playerid);
new
Float:vehx, Float:vehy, Float:vehz;
GetVehiclePos(tram, vehx, vehy, vehz);
SetPlayerPos(playerid, vehx+1, vehy+1, vehz);
SetCameraBehindPlayer(playerid);
}
}
return 1;
}
This is my last. I am out of other ways
Re: Help for Tram -
Join7 - 16.11.2011
don't work
with this if(newkeys & 16) try?
Re: Help for Tram -
MP2 - 16.11.2011
pawn Код:
new last_vehicle[MAX_PLAYERS];
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == 2 || newstate == 3) last_vehicle[playerid] = GetVehicleModel(GetPlayerVehicleID(playerid));
if(newstate == 1 && (oldstate == 2 || oldstate == 3) && last_vehicle[playerid] == 449) SetCameraBehindPlayer(playerid);
return 1;
}
Un-tested, though should work.