[Resolved] PutPlayerInVehicle - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Resolved] PutPlayerInVehicle (
/showthread.php?tid=111100)
[Resolved] PutPlayerInVehicle -
Gzsume_ - 29.11.2009
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.
Re: PutPlayerInVehicle -
Correlli - 29.11.2009
https://sampwiki.blast.hk/wiki/PutPlayerInVehicle
pawn Код:
PutPlayerInVehicle(playerid, playerid, 0);
Re: PutPlayerInVehicle -
Gzsume_ - 29.11.2009
Quote:
Originally Posted by Don Correlli
|
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.
Re: PutPlayerInVehicle -
KnooL - 29.11.2009
Actualy this is the function:
PutPlayerInVehicle(playerid, vehicleid, 0);
and not
PutPlayerInVehicle(playerid, playerid, 0);
Re: PutPlayerInVehicle -
Correlli - 29.11.2009
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.
|
Re: PutPlayerInVehicle -
Djiango - 29.11.2009
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.
Re: PutPlayerInVehicle -
Gzsume_ - 29.11.2009
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); ?
Re: PutPlayerInVehicle -
Correlli - 29.11.2009
Yes, since vehicle-ID starts from 1, this code should work correctly:
pawn Код:
PutPlayerInVehicle(playerid, playerid + 1, 0);
Re: PutPlayerInVehicle -
Streetplaya - 29.11.2009
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
Re: PutPlayerInVehicle -
Correlli - 29.11.2009
Mistake - already edited.