SA-MP Forums Archive
GetVehicleModel help. - 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: GetVehicleModel help. (/showthread.php?tid=612285)



GetVehicleModel help. - Farzam - 16.07.2016

Hello, today I was scripting, but I faced a problem.
the problem is I don't know how to get player's vehicle id, to get VehicleModel.
PHP код:
CMD:blabla(playerid,params[])
{
  if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid0xFF0000FF"ERROR: You're not in any vehicle!");
     new 
dialog[1024], string[128];
     
format(stringsizeof string,"Vehicle owner: %s | Vehicle name: %s \n Color1 : %d, color2 : %d | Vehicle ID: %d "VehicleInfo[vehicleid][owner], 
I couldn't do more, because second const, is related to car model , and I couldn't get player's vehicle ID. Can some one help me please?


Re: GetVehicleModel help. - Konstantinos - 16.07.2016

The vehicle ID the player is in? GetPlayerVehicleID


Re: GetVehicleModel help. - Farzam - 16.07.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
The vehicle ID the player is in? GetPlayerVehicleID
There is no way with getplayervehicleid to take id as an string. so It doesn't help.


Re: GetVehicleModel help. - Luicy. - 16.07.2016

Isn't there intval as strval, and you can use %i in format.


Re: GetVehicleModel help. - Konstantinos - 16.07.2016

Why would you even need a string, the integer value returns is more than enough and it DOES help:

pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
pawn Код:
// modelid:
GetVehicleModel(vehicleid)

// owner's name:
VehicleInfo[vehicleid][owner]
"vehicleid" is needed to get the name and colors of the vehicle as well.