13.08.2013, 18:09
I made a simple trucking-like job system. It shows no errors when I compile it but somehow the IsPlayerInVehicle function doesn't work how I'd like it to work. When I type in the command inside the car (id 498 which is Boxville from the car id list) it just tells me "unknown command". I tried taking off all the IsPlayerInVehicle functions and it works fine but it's just that I'd like it to work only when I'm inside this car(id 498).
It might've been that I've understoon this function wrongly as I though that vehicle id means the id that the car model is for example from https://sampwiki.blast.hk/wiki/Vehicle_Model_ID_List.
Please correct me here.
It might've been that I've understoon this function wrongly as I though that vehicle id means the id that the car model is for example from https://sampwiki.blast.hk/wiki/Vehicle_Model_ID_List.
Please correct me here.
pawn Код:
new Job2[256];
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
if (strcmp("/job 2", cmdtext, true, 10) == 0)
{
if(IsPlayerInVehicle(playerid , 498))
{
Job2[playerid] = 1;
SetPlayerCheckpoint(playerid, 247.1548 , 17.8391 , 2.5254 , 2);
SendClientMessage(playerid , 0x489048FF , "---------------------------------------------------------");
SendClientMessage(playerid , 0x489048FF , "Pick up the load");
return 1;
}
}
return 0;
}
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
if(Job2[playerid] == 1)
{
if(IsPlayerInVehicle(playerid , 498))
{
Job2[playerid] = 2;
SetPlayerCheckpoint(playerid , 1423.0439 , 273.5977 , 19.5547 , 2 );
SendClientMessage(playerid , 0x489048FF , "------------------------------------------------------");
SendClientMessage(playerid , 0x489048FF , "Go to the Montgomery Hardware Store to deliever the tools");
return 1;
}
}
if(Job2[playerid] == 2)
{
if(IsPlayerInVehicle(playerid , 498))
{
Job2[playerid] = 3;
SetPlayerCheckpoint(playerid , -174.3220 , 1170.8254 , 19.7500 , 2);
SendClientMessage(playerid , 0x489048FF , "------------------------------------------------------");
SendClientMessage(playerid , 0x489048FF , "Now go to Fort Carson to deliever the chemicals to the Laundry");
return 1;
}
}
if(Job2[playerid] == 3)
{
if(IsPlayerInVehicle(playerid , 498))
{
Job2[playerid] = 4;
SetPlayerCheckpoint(playerid , 655.4785 , 1697.1421 ,6.9922 , 2);
SendClientMessage(playerid , 0x489048FF , "------------------------------------------------------");
SendClientMessage(playerid , 0x489048FF , "Now go to the gas station to deliever the tools");
return 1;
}
}
if(Job2[playerid] == 4)
{
if(IsPlayerInVehicle(playerid , 498))
{
Job2[playerid] = 5;
SetPlayerCheckpoint(playerid , 247.1548 , 17.8391 , 2.5254 , 2);
GivePlayerMoney(playerid , 1000);
SendClientMessage(playerid , 0x489048FF , "------------------------------------------------------");
SendClientMessage(playerid , 0x489048FF , "Now go to back to the trucking company to claim your payment");
return 1;
}
}
if(Job2[playerid] == 5)
{
if(IsPlayerInVehicle(playerid , 498))
{
GivePlayerMoney(playerid , 1000);
SendClientMessage(playerid , 0x489048FF , "------------------------------------------------------");
SendClientMessage(playerid , 0x489048FF , "You have completed your job and you recieved 1000$");
}
}
return 1;
}