01.02.2013, 14:29
So, I've made a Taxi Driver job. Now, I tried to create a /fare system, but it kinda fails. I've tried numerous things, but they just fail. Here's what I have so far.
My OnPlayerExitVehicle
Anybody knows how to fix this problem? I've tried a lot of things, but they just fail. The client won't send any message and nobodoy receives money.
pawn Код:
forward IsVehicleDriver(vehicleid)
pawn Код:
public IsVehicleDriver(vehicleid)
{
for(new i=0;i<=MAX_PLAYERS;i++)
{
if(IsPlayerInAnyVehicle(i))
{
if(GetPlayerVehicleID(i)==vehicleid)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
return 1;
}
}
}
}
return 0;
}
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(IsATaxi(vehicleid))
{
new s[180];
GivePlayerMoney(IsVehicleDriver(vehicleid), PlayerFare[IsVehicleDriver(vehicleid)]);
GivePlayerMoney(playerid, -PlayerFare[IsVehicleDriver(vehicleid)]);
format(s,sizeof(s),"You've exited the taxi and paid $%d.", PlayerFare[IsVehicleDriver(vehicleid)]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, s);
format(s,sizeof(s),"%s has exited your taxi. You've received $%d.", GetName(playerid), PlayerFare[IsVehicleDriver(vehicleid)]);
SendClientMessage(IsVehicleDriver(vehicleid), COLOR_LIGHTBLUE, s);
}
return 1;
}