COMMAND:startmech(playerid, params[]) // work at mechanic and receive $180
{
if(!IsPlayerInRangeOfPoint(playerid, 30.0,2451.0056,-2118.1301,13.5469))return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic]You are not at the mechanic HQ! ))");
if(!IsPlayerInVehicle(playerid, 525)) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You are not in a mechanics vehicle! ))");
SendClientMessage(playerid, 0x3524C9FF, "(( [Mechanic] Deliver the tires to the checkpoint and receive your paycheck! ))");
SetPlayerCheckpoint(playerid, 848.1696,-1445.7803,13.5762, 5.0);
return 1;
}
// Example:
// Global variable
new
mechanic_veh
;
// Somewhere you create the vehicle
mechanic_veh = CreateVehicle(525 ... /* rest of params */);
// to that command
if(!IsPlayerInVehicle(playerid, mechanic_veh)) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You are not in a mechanics vehicle! ))");
if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 525) // return wrong vehicle
525 is the modelid, you need to use the vehicleid and in that case, you should create the vehicle with a name and use that in the function.
pawn Код:
|
new
mechanic_veh
;
public OnFilterScriptInit()
{
mechanic_veh = CreateVehicle(525,2475.3677,-2114.7422,13.3108,2.6581,129,135,60); // mechcar1
mechanic_veh = CreateVehicle(525,2480.3181,-2114.5127,13.3162,2.6571,129,135,60); // mechcar2
mechanic_veh = CreateVehicle(525,2485.0183,-2114.2949,13.3213,2.6560,129,135,60); // mechcar3
mechanic_veh = CreateVehicle(525,2490.4072,-2114.0449,13.3223,2.6560,129,135,60); // mechcar4
mechanic_veh = CreateVehicle(525,2497.4038,-2113.7207,13.3236,2.6560,129,135,60); // mechcar5
mechanic_veh = CreateVehicle(525,2504.9688,-2113.3699,13.3250,2.6560,129,135,60); // mechcar6
mechanic_veh = CreateVehicle(525,2511.7051,-2113.0574,13.3262,2.6560,129,135,60); // mechcar7
CreatePickup(1239,1,2460.5691,-2118.7847,13.5530,0); // repair pickup
Create3DTextLabel("(( Repair your vehicle here for $175, /repairvehicle ))", 0xEB0C0FFF, 2460.5691,-2118.7847,13.5530, 30.0, 0, 0); //repair label
CreatePickup(1239,1,2451.0056,-2118.1301,13.5469,0); // startwork pickup
Create3DTextLabel("(( Start working as mechanic, /startmech ))", 0xEB0C0FFF, 2451.0056,-2118.1301,13.5469, 30.0, 0, 0); //startwork label
}
new
mechanic_veh[ 7 ]
;
public OnFilterScriptInit()
{
mechanic_veh[ 0 ] = CreateVehicle(525,2475.3677,-2114.7422,13.3108,2.6581,129,135,60); // mechcar1
mechanic_veh[ 1 ] = CreateVehicle(525,2480.3181,-2114.5127,13.3162,2.6571,129,135,60); // mechcar2
mechanic_veh[ 2 ] = CreateVehicle(525,2485.0183,-2114.2949,13.3213,2.6560,129,135,60); // mechcar3
mechanic_veh[ 3 ] = CreateVehicle(525,2490.4072,-2114.0449,13.3223,2.6560,129,135,60); // mechcar4
mechanic_veh[ 4 ] = CreateVehicle(525,2497.4038,-2113.7207,13.3236,2.6560,129,135,60); // mechcar5
mechanic_veh[ 5 ] = CreateVehicle(525,2504.9688,-2113.3699,13.3250,2.6560,129,135,60); // mechcar6
mechanic_veh[ 6 ] = CreateVehicle(525,2511.7051,-2113.0574,13.3262,2.6560,129,135,60); // mechcar7
CreatePickup(1239,1,2460.5691,-2118.7847,13.5530,0); // repair pickup
Create3DTextLabel("(( Repair your vehicle here for $175, /repairvehicle ))", 0xEB0C0FFF, 2460.5691,-2118.7847,13.5530, 30.0, 0, 0); //repair label
CreatePickup(1239,1,2451.0056,-2118.1301,13.5469,0); // startwork pickup
Create3DTextLabel("(( Start working as mechanic, /startmech ))", 0xEB0C0FFF, 2451.0056,-2118.1301,13.5469, 30.0, 0, 0); //startwork label
}
// Command
if(!IsPlayerInVehicle(playerid, mechanic_veh[ 0 ]) || !IsPlayerInVehicle(playerid, mechanic_veh[ 1 ])
|| !IsPlayerInVehicle(playerid, mechanic_veh[ 2 ]) || !IsPlayerInVehicle(playerid, mechanic_veh[ 3 ])
|| !IsPlayerInVehicle(playerid, mechanic_veh[ 4 ]) || !IsPlayerInVehicle(playerid, mechanic_veh[ 5 ])
|| !IsPlayerInVehicle(playerid, mechanic_veh[ 6 ])) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You are not in a mechanics vehicle! ))");