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



Taxi - Akcent_Voltaj - 04.04.2013

i made a cmd..so if the player that enters taxi doesent have enough money to remove him from vehicle..i dosent work..can you help?i dont even know where to put it..

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(newstate == PLAYER_STATE_PASSENGER )
    {
        if(GetPlayerCash(i) > TransportCost[i])
        {
            RemovePlayerFromVehicle(i);
        }
    }
}



Re: Taxi - DaRk_RaiN - 04.04.2013

You shouuld have used < not >
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(newstate == PLAYER_STATE_PASSENGER )
    {
        if(GetPlayerCash(i) < TransportCost[i])
        {
            RemovePlayerFromVehicle(i);
        }
    }
}
ADD:Not sure why you used the loop, i just gave you the fix.


Re: Taxi - Faisal_khan - 04.04.2013

Edit:
OnPlayerStateChange, add it in it.


Re: Taxi - thefatshizms - 04.04.2013

use OnPlayerStateChange..

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_PASSENGER) {
        if(GetPlayerMoney(playerid) < TransportCost[playerid]) RemovePlayerFromVehicle(playerid);
    }
   
    return 1;
}
Although, I'm not quite sure what you are doing with the TransportCost[i]. Is it the transport cost for the player? or the taxi driver?


Re: Taxi - Akcent_Voltaj - 04.04.2013

Quote:
Originally Posted by thefatshizms
Посмотреть сообщение
use OnPlayerStateChange..

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_PASSENGER) {
        if(GetPlayerMoney(playerid) < TransportCost[playerid]) RemovePlayerFromVehicle(playerid);
    }
   
    return 1;
}
Although, I'm not quite sure what you are doing with the TransportCost[i]. Is it the transport cost for the player? or the taxi driver?
this is when i enter but..if the taxi driver ties me..he makes money..so i want if the fare is over 400..to kick me out of car.


Re: Taxi - Faisal_khan - 04.04.2013

Show us how you defined TransportCost.