[Resolved] PutPlayerInVehicle
#1

Hello,
First, I'm sorry for my english, but I'm french, and I'm still learning it.

So, I've got a question. I wanna put a player in the vehicle witch has the player id. So, if playerid = 12, I wanna put the player in the vehicle who've got the vehicleid 12.
Can somebody help me to do that ? I've tried this code :


Код:
PutPlayerInVehicle(playerid,playerid,0);
But it doesn't work.

Thanks,
Gzsume.
Reply
#2

https://sampwiki.blast.hk/wiki/PutPlayerInVehicle

pawn Код:
PutPlayerInVehicle(playerid, playerid, 0);
Reply
#3

Quote:
Originally Posted by Don Correlli
https://sampwiki.blast.hk/wiki/PutPlayerInVehicle

pawn Код:
PutPlayerInVehicle(playerid, playerid, 0);
Hehe, I've changed my post when you've posted. I've tried, but it doesn't work. The player spawn, then he isn't put in any vehicle.
Reply
#4

Actualy this is the function:
PutPlayerInVehicle(playerid, vehicleid, 0);

and not

PutPlayerInVehicle(playerid, playerid, 0);
Reply
#5

Quote:
Originally Posted by Gzsume_
Hehe, I've changed my post when you've posted. I've tried, but it doesn't work. The player spawn, then he isn't put in any vehicle.
Have you added the vehicle in the script?

Quote:
Originally Posted by KnooL
Actualy this is the function:
PutPlayerInVehicle(playerid, vehicleid, 0);

and not

PutPlayerInVehicle(playerid, playerid, 0);
Read the first post again?
Quote:
Originally Posted by Gzsume_
I wanna put a player in the vehicle witch has the player id. So, if playerid = 12, I wanna put the player in the vehicle who've got the vehicleid 12.
Reply
#6

Quote:
Originally Posted by KnooL
Actualy this is the function:
PutPlayerInVehicle(playerid, vehicleid, 0);

and not

PutPlayerInVehicle(playerid, playerid, 0);
playerid is a number, so playerid would be put in vehicle the with same number, as playerid.
One problem though, playerids start from 0, where vehicles starts from 1.
Reply
#7

Quote:
Originally Posted by KnooL
Actualy this is the function:
PutPlayerInVehicle(playerid, vehicleid, 0);

and not

PutPlayerInVehicle(playerid, playerid, 0);
So, how can I change it ? Maybe I must use a variable, but there no function called GetPlayerID or other thing like that.

Don Correlli: Yes, the AddStaticVehicle lines are in my OnGameModeInit callback.

|∞|-Рцппσĵσ-|∞|: So, I can use something like PutPlayerInVehicle(playerid, playerid+1, 0); ?
Reply
#8

Yes, since vehicle-ID starts from 1, this code should work correctly:
pawn Код:
PutPlayerInVehicle(playerid, playerid + 1, 0);
Reply
#9

Quote:
Originally Posted by Don Correlli
Yes, since vehicle-ID starts from 0, this code should work correctly:
pawn Код:
PutPlayerInVehicle(playerid, playerid + 1, 0);
Vehicle id starts from 1 but your code should be correct
Reply
#10

Mistake - already edited.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)