#1

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);
        }
    }
}
Reply
#2

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.
Reply
#3

Edit:
OnPlayerStateChange, add it in it.
Reply
#4

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?
Reply
#5

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.
Reply
#6

Show us how you defined TransportCost.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)