Check if player inside a taxi and has it's job - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Check if player inside a taxi and has it's job (
/showthread.php?tid=595189)
Check if player inside a taxi and has it's job -
DemME - 29.11.2015
Thats the stock itself
PHP код:
IsPlayerInsideTaxi(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
if (GetVehicleModel(vehicleid) == 420 || GetVehicleModel(vehicleid) == 438)
{
foreach (new i : Player)
{
if ((i != playerid) && (PlayerData[i][pJob] == JOB_TAXI && PlayerData[i][pTaxiDuty] && GetPlayerState(i) == PLAYER_STATE_DRIVER) && GetPlayerVehicleID(i) == vehicleid)
return 1;
}
}
return 0;
}
Now how I can do that if the player isn't has a taxi job (JOB_TAXI) it will return an error message and kick him out of the taxi. + rep for helpers
Re: Check if player inside a taxi and has it's job -
Beckett - 29.11.2015
Why are you looping there?
I don't understand...
Re: Check if player inside a taxi and has it's job -
Denying - 29.11.2015
Your function is checking if the player is in a taxi with a taxi driver in it. I think. At least, that what's I understand from that code. So.. what exactly do you want to do with that function?
Re: Check if player inside a taxi and has it's job -
DemME - 29.11.2015
Quote:
Originally Posted by Denying
Your function is checking if the player is in a taxi with a taxi driver in it. I think. At least, that what's I understand from that code. So.. what exactly do you want to do with that function?
|
I want it to check if the player hasn't possessing the job of the taxi driver, and if not it will eject him out of the taxi.
Re: Check if player inside a taxi and has it's job -
Denying - 29.11.2015
Oh, that's easy then.
Put in OnPlayerEnterVehicle the following:
Код:
if((GetVehicleModel(vehicleid) == 420 || GetVehicleModel(vehicleid) == 438) && PlayerData[playerid][pJob] != JOB_TAXI)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, -1, "Error: You are not a taxi driver!");
}
Re: Check if player inside a taxi and has it's job -
gurmani11 - 29.11.2015
PHP код:
IsPlayerInsideTaxi(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
if (GetVehicleModel(vehicleid) == 420 || GetVehicleModel(vehicleid) == 438)
{
if(PlayerData[playerid][pJob] == JOB_TAXI && PlayerData[playerid][pTaxiDuty])return 1;
}
return 0;
}