SA-MP Forums Archive
Taxi Job bugged - 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: Taxi Job bugged (/showthread.php?tid=586717)



Taxi Job bugged please help +rep - toxicape - 24.08.2015

I make in my GM a taxi job but its bugged, the driver don't get money, the passenger don't give money, and the timer don't works. Gimme some ideas from what can be. When the passenger get in the taxi need to start count for the money at, but no count, no money gets, no money for the driver.


Re: Taxi Job bugged - NickMirra - 24.08.2015

How does the system work? we need more information if your not going to show us code.. when he types a command it brings up checkpoints? when he enters the checkpoint it pays him? it could be multiple things show us some code!


Re: Taxi Job bugged - toxicape - 24.08.2015

This is where he need to pay.
Код:
if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == 2 && TransportDuty[i] > 0)
       		{
				if(GetPlayerCash(playerid) < TransportValue[i])
				{
					new string[28];
					format(string, sizeof(string), "* You need $%d to enter.", TransportValue[i]);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
					//RemovePlayerFromVehicle(playerid);
					new Float:X, Float:Y, Float:Z;
					GetPlayerPos(playerid, X, Y, Z);
					SetPlayerPos(playerid, X, Y, Z+2);
					TogglePlayerControllable(playerid, 1);
				}
				else
				{
					new string[64];
					if(TransportDuty[i] == 1)
					{
						format(string, sizeof(string), "* You paid $%d to the Taxi Driver.", TransportValue[i]);
						SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Passenger %s has entered your Taxi.", GetPlayerNameEx(playerid));
						SendClientMessageEx(i, COLOR_LIGHTBLUE, string);
						TransportTime[i] = 1;
						TransportTime[playerid] = 1;
						TransportCost[playerid] = TransportValue[i];
						TransportCost[i] = TransportValue[i];
						TransportDriver[playerid] = i;
					}
					else if(TransportDuty[i] == 2)
					{
						format(string, sizeof(string), "* You paid $%d to the Taxi Driver.", TransportValue[i]);
						SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Passenger %s has entered your Taxi.", GetPlayerNameEx(playerid));
						SendClientMessageEx(i, COLOR_LIGHTBLUE, string);
					}
					GivePlayerCash(playerid, -TransportValue[i]);
					TransportMoney[i] += TransportValue[i];
				}



Re: Taxi Job bugged - toxicape - 24.08.2015

If someone call for taxi or hop in the cab, he need to drive to where the passenger wants, and when he left need to pick from passenger's money and give them to the taxi driver, but don't work.


Re: Taxi Job bugged - toxicape - 24.08.2015

Someone help?


Re: Taxi Job bugged - toxicape - 24.08.2015

Please help am gonna +rep this who help me


Re: Taxi Job bugged - Logofero - 24.08.2015

Quote:
Originally Posted by toxicape
Посмотреть сообщение
Please help am gonna +rep this who help me
Simplify the system of issuing money and find an error.

You have a lot of extra variables.

Start simple: Go sit in the cab, checked his money > taxi driver gets money > etc


Re: Taxi Job bugged - toxicape - 24.08.2015

Can't you fix this bug in the lines which i give? Because its a lot of work to put a new system on the GM.


Re: Taxi Job bugged - Logofero - 24.08.2015

Quote:
Originally Posted by toxicape
Посмотреть сообщение
Can't you fix this bug in the lines which i give? Because its a lot of work to put a new system on the GM.
I can give you the code that is now written for you, analyzing it and add their own items

PHP код:
stock IsVehicleTaxi(vehicleid) {
    switch (
GetVehicleModel(vehicleid)) {
        case 
420,438 : return true;
    }
    return 
false;
}
forward OnPlayerEnteredTaxi(playeridvehicleid);
public 
OnPlayerEnteredTaxi(playeridvehicleid
{
    new 
        
msg[256],
        
name[MAX_PLAYER_NAME]
    ;
    
GetPlayerName(playeridnamesizeof(name));
    
format(msgsizeof(msg), "Taxi: %s(%d) entered in taxi %d"nameplayeridvehicleid);
    
SendClientMessageToAll(-1msg);
    return 
true;
}
forward OnPlayerExitedTaxi(playeridvehicleid);
public 
OnPlayerExitedTaxi(playeridvehicleid
{
    new 
        
msg[256],
        
name[MAX_PLAYER_NAME]
    ;
    
GetPlayerName(playeridnamesizeof(name));
    
format(msgsizeof(msg), "Taxi: %s(%d) exited in taxi %d"nameplayeridvehicleid);
    
SendClientMessageToAll(-1msg);    
    return 
true;
}
public 
OnPlayerUpdate(playerid)
{
    static
        
p_vehicleid[MAX_PLAYERS]
    ;
    new 
vehicleid GetPlayerVehicleID(playerid);
    if (
vehicleid && vehicleid != p_vehicleid[playerid]) {
        if (
IsVehicleTaxi(vehicleid)) {
            
OnPlayerEnteredTaxi(playeridvehicleid);
        }
        
p_vehicleid[playerid] = vehicleid;
    } else {
        if (
IsVehicleTaxi(p_vehicleid[playerid])) {
            
OnPlayerExitedTaxi(playeridp_vehicleid[playerid]);
        }
        
p_vehicleid[playerid] = vehicleid;
    }
    return 
1;




Re: Taxi Job bugged - Logofero - 24.08.2015

Quote:
Originally Posted by toxicape
Посмотреть сообщение
TransportDriver[playerid] = i; // Error You are here
Why do you write in the player to be a taxi driver a passenger?

Or do you have in the variable i taxi driver?
The code is not fully represented.

PS: Poor you do not want to disassemble my example, it clearly