SA-MP Forums Archive
How to enter a TRAM using F/G or default enter key. - 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: How to enter a TRAM using F/G or default enter key. (/showthread.php?tid=371199)



How to enter a TRAM using F/G or default enter key. - kbalor - 22.08.2012

Title says it all.

More info: So I have decide to put Tram in my server, I do put coordinates in nearest Tram rails in San Fiero. and it automatically fits the rails. Now after trying to use F or Enter it doesn't work.

Why?? It's a vehicle right?


Re: How to enter a TRAM using F/G or default enter key. - Akira297 - 22.08.2012

I've never had this issue, do you have it as like,

'AddStaticVehicleEx' ?


Re: How to enter a TRAM using F/G or default enter key. - kbalor - 22.08.2012

Quote:
Originally Posted by Akira297
Посмотреть сообщение
I've never had this issue, do you have it as like,

'AddStaticVehicleEx' ?
I did is CreateVehicle, Do I need to change it to AddStaticVehicleEx?

EDIT: Under OnGameModeInit AddStaticVehicleEx(449,-1703.9751,1317.3466,7.0391,49.3740,6,2,60); STILL no luck


Re: How to enter a TRAM using F/G or default enter key. - kbalor - 22.08.2012

Still can't enter what's the problem?


Re: How to enter a TRAM using F/G or default enter key. - ReVo_ - 22.08.2012

Use PutPlayerInVehicle


Re: How to enter a TRAM using F/G or default enter key. - kbalor - 23.08.2012

Quote:
Originally Posted by ReVo_
Посмотреть сообщение
Use PutPlayerInVehicle
Can you do this for me? If player is near a tram and do F/G ir Enter then putplayerinvehicle..


Re: How to enter a TRAM using F/G or default enter key. - ReVo_ - 23.08.2012

OnPlayerKeyStateChange

if( newkeys & KEY_JOIN ) {
new Float:vx, Float:vy, Float:vz;
for( new x = 0; x < MAX_VEHICLES; x ++ ) {
if(GetVehicleModel(x) == tram_models) {
GetVehiclePos( x, vx , vy, vz );
if( IsPlayerInRangeOfPoint( playerid , 1.5 , vx, vy, vz )) {
PutPlayerInVehicle( playerid , x, as_driver );
}
}
}

If he press "passenger key" do the same change only seat id.. mb with a for to check all seats and if one is avaitable put player here


sorry for english, i write everything (code and this text) fast because i had to go


Re: How to enter a TRAM using F/G or default enter key. - kbalor - 23.08.2012

Quote:
Originally Posted by ReVo_
Посмотреть сообщение
OnPlayerKeyStateChange

if( newkeys & KEY_JOIN ) {
new Float:vx, Float:vy, Float:vz;
for( new x = 0; x < MAX_VEHICLES; x ++ ) {
if(GetVehicleModel(x) == tram_models) {
GetVehiclePos( x, vx , vy, vz );
if( IsPlayerInRangeOfPoint( playerid , 1.5 , vx, vy, vz )) {
PutPlayerInVehicle( playerid , x, as_driver );
}
}
}

If he press "passenger key" do the same change only seat id.. mb with a for to check all seats and if one is avaitable put player here


sorry for english, i write everything (code and this text) fast because i had to go
OMG! Thanks revo but i have few warnings left

pawn Код:
(13344) : warning 225: unreachable code
(13344) : error 017: undefined symbol "KEY_JOIN"
(13347) : error 017: undefined symbol "tram_models"
(13350) : error 017: undefined symbol "as_driver"
pawn Код:
(13344) if( newkeys & KEY_JOIN ) {
(13347)if(GetVehicleModel(x) == tram_models) {
(13350)PutPlayerInVehicle( playerid , x, as_driver );



Re: How to enter a TRAM using F/G or default enter key. - ReVo_ - 23.08.2012

------


Re: How to enter a TRAM using F/G or default enter key. - kbalor - 23.08.2012

Quote:
Originally Posted by ReVo_
Посмотреть сообщение
Emh you need to change KEY_JOIN with the key player press when he try to join in a vehicle..

tram_models => with models of vehicle you want

as_driver => with 0
Thanks 2 warning same line left..

Why is G for enter as a passanger is underfined? is there any key for G?
https://sampwiki.blast.hk/wiki/GetPlayerKeys