work vehicles.
#1

I need to make a certain vehicle for a job, I have this code.
If you do not have a job, you can not use it, but if you are from another job that is not this one, it leaves you.

if(Vehicle_Job_1(vehicleid) && Info[playerid][pJob] <= 1)
{
new Float:XV, Float:YV, Float:ZV;
GetPlayerPos(playerid, XV, YV, ZV);
SetPlayerPos(playerid, XV, YV, ZV);
SendClientMessage(playerid, -1, "{ffa500}[INFO] {ffffff}You need to be Pizza Boy to use this vehicle!");
}
Reply
#2

You can use this method to check what model the car is.
we know that a pizzaboy is the id: 448 (https://sampwiki.blast.hk/wiki/Vehicle_Model_ID_List)
Then we can check if the model the player sits in, is equal to 448 by doing the following:

PHP код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 448)
    return 
SendClientMessage(playerid, -1"You need to be in the pizzaboy!"); 
https://sampwiki.blast.hk/wiki/GetVehicleModel
https://sampwiki.blast.hk/wiki/GetPlayerVehicleID

You may also want to check if the player is in a vehicle before doing this. That can be done by using "IsPlayerInVehicle(playerid)" (https://sampwiki.blast.hk/wiki/IsPlayerInVehicle)
Reply
#3

Quote:
Originally Posted by Tord
Посмотреть сообщение
You can use this method to check what model the car is.
we know that a pizzaboy is the id: 448 (https://sampwiki.blast.hk/wiki/Vehicle_Model_ID_List)
Then we can check if the model the player sits in, is equal to 448 by doing the following:

PHP код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 448)
    return 
SendClientMessage(playerid, -1"You need to be in the pizzaboy!"); 
https://sampwiki.blast.hk/wiki/GetVehicleModel
https://sampwiki.blast.hk/wiki/GetPlayerVehicleID

You may also want to check if the player is in a vehicle before doing this. That can be done by using "IsPlayerInVehicle(playerid)" (https://sampwiki.blast.hk/wiki/IsPlayerInVehicle)
Thanks, and if I use == instead of <=, will it work?

here:
if(Vehicle_Job_1(vehicleid) && Info[playerid][pJob] <= 1)
Reply
#4

That statement checks if the "Info[playerid][pJob]" is 1, 0, -1, -2 .... -inf. (Equal or lower than 1).

If you want to check if the player is on a certain job, you should check for one value, and not many different. It solely depends on what the values does
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)