05.02.2016, 11:14
"vehicleid" is not the same as "modelid"
IsPlayerInAnyVehicle only checks if a player is in a vehicle at all.
GetPlayerVehicleID will give you the ID the player is in (not the model!)
Each vehicle as a unique ID assigned to by the server, so the server can seperate between each single vehicle. This makes it possible to detect a certain vehicle if you are only using infernusses on your server.
GetVehicleModel will give you the model of the vehicle (infernus, turismo, etc)
you can use it like this:
@Mencent: https://sampwiki.blast.hk/wiki/GetVehicleModel
The useage is not "GetVehicleModel(vehicleid, modelitshouldbe)" it is "GetVehicleModel(vehicleid)" and will return the modelid
So this won't work:
IsPlayerInAnyVehicle only checks if a player is in a vehicle at all.
GetPlayerVehicleID will give you the ID the player is in (not the model!)
Each vehicle as a unique ID assigned to by the server, so the server can seperate between each single vehicle. This makes it possible to detect a certain vehicle if you are only using infernusses on your server.
GetVehicleModel will give you the model of the vehicle (infernus, turismo, etc)
you can use it like this:
Код:
if(strcmp(cmd, "/infobject", true) == 0) { if(IsPlayerInAnyVehicle(playerid)) { new vehicleid = GetPlayerVehicleID(playerid); if(GetVehicleModel(vehicleid) == 411) { if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER){ SendClientMessage(playerid, -1, "{FFFFFF}You must be the driver!");return 1;} ShowPlayerDialog(playerid, VehDialog, DIALOG_STYLE_LIST, "{FFFFFF}Infernus Vehicle Objects", "{FFFFFF}Object 1\n Object2\n {FFFFFF}Object 3\n {FFFFFF}Object 4", "Select", "Cancel"); } else { SendClientMessage(playerid, -1, "Only possible in an infernus"); } } else { SendClientMessage(playerid, -1, "{FFFFFF}You are not in any car!"); } return 1; }
The useage is not "GetVehicleModel(vehicleid, modelitshouldbe)" it is "GetVehicleModel(vehicleid)" and will return the modelid
So this won't work:
Quote:
PHP код:
|