07.10.2012, 17:14
Hello, this is the code:
1.
2. OnPlayerEnterVehicle:
3. VehicleDriver stock:
The problem is that it says: "The taxi driver charges $0" all the time, even when I set /setfare 5.
1.
pawn Код:
CMD:setfare(playerid, params[])
{
if(PlayerInfo[playerid][pJob] !=6)
return SendClientMessage(playerid,C_RED,"You're not a taxi driver.");
new
fare
;
if(sscanf(params,"i",fare))
return SendClientMessage(playerid,C_NICE,"[Usage] {FFFFFF}/setfare [fare]");
if(fare < 1) return 1;
SendFormat(playerid,C_NICE,"You have set your fare to $%i per second.",fare);
PlayerInfo[playerid][TaxiFare] = fare;
return 1;
}
pawn Код:
if(VehicleData[vehicleid][vModel] == 420 && ispassenger && !PlayerInfo[playerid][Aduty])
{
if(PlayerInfo[VehicleDriver(vehicleid)][TaxiFare] < 1)
return AC_SetPlayerPos(playerid, pos[0], pos[1], pos[2] + 5), SendClientMessage(playerid,C_RED,"Taxi doors are still closed.");
SendFormat(playerid,C_YELLOW,"[Taxi] {FFFFFF}This taxi driver charges $%i per second.",PlayerInfo[VehicleDriver(vehicleid)][TaxiFare]);
}
pawn Код:
stock VehicleDriver(vehicleid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPlayerVehicleID(i) == vehicleid && GetPlayerState(i) == PLAYER_STATE_DRIVER) return i;
}
return 1;
}