PDA

View Full Version : [HELP] Gettin into a streetcar / rc vehicles


spyro9696
14/08/2017, 07:23 AM
Hello, through the AddStaticVehicleEx function, I created a streetcar, but I can't getting into it.
Is there a solution? Can you drive the streetcar?

10MIN
14/08/2017, 07:32 AM
Yes, you can drive it. You can drive any car unless it is locked. Make sure it is not locked. Also show us your script so we can understand better what is happening.

spyro9696
14/08/2017, 07:45 AM
Ehmmm... It is a gamemode... What should I post?

10MIN
14/08/2017, 11:05 AM
The usage of AddStaticVehicle when you create the car, the callback OnPlayerEnterVehicle(playerid,vehicleid) and if you save the id of the car show us things which are using it.

spyro9696
14/08/2017, 01:07 PM
http://i.imgur.com/lkRGRdo.png


http://i.imgur.com/APKk0z3.png



http://i.imgur.com/4ZwBXLj.png

FuNkYTheGreat
14/08/2017, 01:51 PM
Remove that OnPlayerEnterVehicle code, its useless in SA-MP player will get directly in the vehicle, this call back is called when player Pressed '' return '' to enter the vehicle, and i don't see any use of that stock...

spyro9696
14/08/2017, 02:02 PM
Ok, but to enter into the tram and rc vehicles?

10MIN
14/08/2017, 02:03 PM
Just remove this from OnPlayerEnterVehicle(playerid,vehicleid,ispassenge r):
PutPlayerInVehicle(playerid,449,0);
Why it don't work? Because 449 is the vehicleid is not modelid of the car, it is like playerid, the vehicle that take the action, and modelid is like the skin of a player, shows how they "look".
BUT if you think you need it you can do this:

public OnPlayerEnterVehicle(playerid,vehicleid,ispassenge r)
{
if(ispassenger) //This explains itself
{
PutPlayerInVehicle(playerid,vehicleid,1); //Put the player with id 'playerid' in the vehicle with id 'vehicleid' in seat id 1 (front passenger)
}
else
{
PutPlayerInVehicle(playerid,vehicleid,0); //Put the player with id 'playerid' in the vehicle with id 'vehicleid' in seat id 0 (driver)
}
return 1;
}

I think I explained everything okay.
PS: You also have an error in stock GetModelVehicle(vname[]), a VARIABLE NAME can ONLY start with a letter. Vince (http://forum.sa-mp.com/member.php?u=13347) explained this thing here: http://forum.sa-mp.com/showthread.php?t=631607
PS2: Also don't use the stock keyword very much, Vince explained why here: "Stop the abuse of stock" (http://forum.sa-mp.com/showthread.php?t=570635)

spyro9696
14/08/2017, 04:43 PM
Just remove this from OnPlayerEnterVehicle(playerid,vehicleid,ispassenge r):
PutPlayerInVehicle(playerid,449,0);
Why it don't work? Because 449 is the vehicleid is not modelid of the car, it is like playerid, the vehicle that take the action, and modelid is like the skin of a player, shows how they "look".
BUT if you think you need it you can do this:

public OnPlayerEnterVehicle(playerid,vehicleid,ispassenge r)
{
if(ispassenger) //This explains itself
{
PutPlayerInVehicle(playerid,vehicleid,1); //Put the player with id 'playerid' in the vehicle with id 'vehicleid' in seat id 1 (front passenger)
}
else
{
PutPlayerInVehicle(playerid,vehicleid,0); //Put the player with id 'playerid' in the vehicle with id 'vehicleid' in seat id 0 (driver)
}
return 1;
}

I think I explained everything okay.
PS: You also have an error in stock GetModelVehicle(vname[]), a VARIABLE NAME can ONLY start with a letter. Vince (http://forum.sa-mp.com/member.php?u=13347) explained this thing here: http://forum.sa-mp.com/showthread.php?t=631607
PS2: Also don't use the stock keyword very much, Vince explained why here: "Stop the abuse of stock" (http://forum.sa-mp.com/showthread.php?t=570635)

@10MIN, in this way, I only get in to the tram as passenger, but I can't drive it......

FuNkYTheGreat
14/08/2017, 05:31 PM
To enter in a RC vehicle or a tram, use this tutorial, first remove the onplayerentervehicle code then do this
http://forum.sa-mp.com/showthread.php?t=113302
What does this tutorial does ?
Actually it gets that if a guy pressed RETURN AKA F OR ENTER, and if he's near a vehicle it'll put the player in the rc vehicle, as simple as that.

spyro9696
14/08/2017, 05:59 PM
nothing... when I compile it gives me many errors, and I did everything you said.
I want to put it into the gamemode...