Amount of time in a vehicle..
#6

exactly..? it was actually better than yours..?

heres peice of my code..

pawn Код:
public ThreeSecondTimer()
{
    foreach(Player,i)
    {
        if(PlayerInfo[i][DriverDuty] == 1)
        {
            new vehicle = GetPlayerVehicleID(i);
            foreach(Player,j)
            {
                if(IsPlayerInAnyVehicle(j) && GetPlayerVehicleID(j) == vehicle && GetPlayerState(j) == PLAYER_STATE_PASSENGER)
                {
                    if(SafeGetPlayerMoney(j) >= PlayerInfo[i][DriverFare])
                    {
                        PlayerInfo[j][Money] -= PlayerInfo[i][DriverFare];
                        PlayerInfo[i][Money] += PlayerInfo[i][DriverFare];
                        PlayerInfo[i][TotalIncome]+=PlayerInfo[i][DriverFare];
                        new tstr[50];
                        format(tstr,sizeof(tstr),"~b~Income~w~:~g~$%d",PlayerInfo[i][TotalIncome]);
                        TextDrawSetString(DriverText[i],tstr);
                    }
                    else if(SafeGetPlayerMoney(j) < PlayerInfo[i][DriverFare])
                    {
                        RemovePlayerFromVehicle(j);
                        SendClientMessage(j,COLOR_RED,"Ejected: You've Been Ejected From The Driver's Vehicle For Not Being Able To Afford His Fare!");
                        new str[95];
                        format(str,sizeof(str),"Ejected:%s(%d) Could Not Afford Your Fare, He Has Been Ejected!");
                        SendClientMessage(i,COLOR_RED,str);
                    }
                }
            }
        }
    }
    return 1;
}
look at this as soon has a person enters a drivers car, it starts, instead of a command.

pawn Код:
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_PASSENGER)
    {
        if(IsPlayerInDriverVehicle(playerid))
        {
            if(IsDriverATaxiDriver(GetPlayerVehicleID(playerid)))
            {
                new driverid = GetVehDriverID(GetPlayerVehicleID(playerid));
                if(driverid != -1)
                {
                    if(PlayerInfo[driverid][DriverDuty] == 1)
                    {
                        new str[128];
                        format(str,sizeof(str),"Public: You Entered %s(%d)'s Taxi, You Will Be Charged $%d Per 3 Seconds!",Playername(driverid),driverid,PlayerInfo[driverid][DriverFare]);
                        SendClientMessage(playerid,LIME,str);
                        format(str,sizeof(str),"%s(%d) Has Entered Your Vehicle. Will Be Charged $%d Per 3 Seconds",Playername(playerid),playerid,PlayerInfo[driverid][DriverFare]);
                        SendClientMessage(driverid,LIME,str);
                        TextDrawShowForPlayer(driverid,DriverBox[driverid]);
                        TextDrawShowForPlayer(driverid,DriverStatText[driverid]);
                        TextDrawShowForPlayer(driverid,DriverText[driverid]);
                    }
                }
            }
        }
and when they exit. it automatically stops. L
Reply


Messages In This Thread
Amount of time in a vehicle.. - by [L3th4l] - 13.11.2010, 23:52
Re: Amount of time in a vehicle.. - by GaGlets(R) - 13.11.2010, 23:59
Re: Amount of time in a vehicle.. - by [L3th4l] - 14.11.2010, 00:02
Re: Amount of time in a vehicle.. - by The_Gangstas - 14.11.2010, 00:02
Re: Amount of time in a vehicle.. - by GaGlets(R) - 14.11.2010, 00:05
Re: Amount of time in a vehicle.. - by The_Gangstas - 14.11.2010, 00:08
Re: Amount of time in a vehicle.. - by GaGlets(R) - 14.11.2010, 00:18
Re: Amount of time in a vehicle.. - by The_Gangstas - 14.11.2010, 00:24
Re: Amount of time in a vehicle.. - by GaGlets(R) - 14.11.2010, 00:33
Re: Amount of time in a vehicle.. - by The_Gangstas - 14.11.2010, 00:38

Forum Jump:


Users browsing this thread: 7 Guest(s)