Get Vehicle ID.....
#1

How can I get each vehicle ID on the server? I have like 40 vehicles right now...

Vehicle ID 1 equals to the first car added under OnGameModeInit?

Example:
pawn Код:
AddStaticVehicle(522,-1919.2992,1789.9838,209.3784,50.1049,8,82);//ID 1
AddStaticVehicle(522,-1922.7979,1784.3138,209.3821,51.3585,8,82);//ID 2
AddStaticVehicle(522,-1927.3228,1779.3625,209.3804,53.7146,8,82);//ID 3 etc...
Reply
#2

No.

AddStaticVehicle(522,-1919.2992,1789.9838,209.3784,50.1049,8,82);// ID 0
AddStaticVehicle(522,-1922.7979,1784.3138,209.3821,51.3585,8,82);// ID 1
AddStaticVehicle(522,-1927.3228,1779.3625,209.3804,53.7146,8,82);// ID 2 etc...
Reply
#3

Quote:
Originally Posted by Phento
No.

pawn Код:
AddStaticVehicle(522,-1919.2992,1789.9838,209.3784,50.1049,8,82);// ID 0
AddStaticVehicle(522,-1922.7979,1784.3138,209.3821,51.3585,8,82);// ID 1
AddStaticVehicle(522,-1927.3228,1779.3625,209.3804,53.7146,8,82);// ID 2 etc...
Ohh yea, I forgot about 0

Thanks !
Reply
#4

No, your example is correct:
Quote:
Originally Posted by Fedee!
pawn Код:
AddStaticVehicle(522,-1919.2992,1789.9838,209.3784,50.1049,8,82);//ID 1
AddStaticVehicle(522,-1922.7979,1784.3138,209.3821,51.3585,8,82);//ID 2
AddStaticVehicle(522,-1927.3228,1779.3625,209.3804,53.7146,8,82);//ID 3 etc...
First vehicle is assigned to the ID 1, second to the ID 2 and so on. (GetPlayerVehicleID returns 0 if player isn't in any vehicle)
Reply
#5

Quote:
Originally Posted by Don Correlli
No, your example is correct:
Quote:
Originally Posted by Fedee!
pawn Код:
AddStaticVehicle(522,-1919.2992,1789.9838,209.3784,50.1049,8,82);//ID 1
AddStaticVehicle(522,-1922.7979,1784.3138,209.3821,51.3585,8,82);//ID 2
AddStaticVehicle(522,-1927.3228,1779.3625,209.3804,53.7146,8,82);//ID 3 etc...
First vehicle is assigned to the ID 1, second to the ID 2 and so on. (GetPlayerVehicleID returns 0 if player isn't in any vehicle)
Oh lol... thank you
Reply
#6

Sorry.

test code:
pawn Код:
#include <a_samp>

public OnGameModeInit()
{
    printf("vehicleid: %d",AddStaticVehicle(416,2030.1577,-1435.2174,17.3632,180.0,1,3));
    printf("vehicleid: %d",AddStaticVehicle(416,2020.1577,-1435.2174,17.3632,180.0,1,3));
    printf("vehicleid: %d",AddStaticVehicle(416,2010.1577,-1435.2174,17.3632,180.0,1,3));
    return 1;
}
vehicleid: 1
vehicleid: 2
vehicleid: 3
Reply
#7

This is a good imple cmd!!

Код:
if(strcmp(cmd, "/carid", true) == 0) {

    if(IsPlayerInAnyVehicle(playerid)) {
		if (IsPlayerConnected(playerid)) {
			format(string, sizeof(string), "(INFO) The ID of this vehicle is: %d.",GetPlayerVehicleID(playerid));
			SendClientMessage(playerid, COLOR_YELLOW, string);
		}
		}

		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)