[HELP] Gettin into a streetcar / rc vehicles
#1

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?
Reply
#2

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.
Reply
#3

Ehmmm... It is a gamemode... What should I post?
Reply
#4

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.
Reply
#5








Reply
#6

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...
Reply
#7

Ok, but to enter into the tram and rc vehicles?
Reply
#8

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,ispassenger)
{
    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 explained this thing here: https://sampforum.blast.hk/showthread.php?tid=631607
PS2: Also don't use the stock keyword very much, Vince explained why here: "Stop the abuse of stock"
Reply
#9

Quote:
Originally Posted by 10MIN
Посмотреть сообщение
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,ispassenger)
{
    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 explained this thing here: https://sampforum.blast.hk/showthread.php?tid=631607
PS2: Also don't use the stock keyword very much, Vince explained why here: "Stop the abuse of stock"
@10MIN, in this way, I only get in to the tram as passenger, but I can't drive it......
Reply
#10

To enter in a RC vehicle or a tram, use this tutorial, first remove the onplayerentervehicle code then do this
https://sampforum.blast.hk/showthread.php?tid=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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)