[Ajuda]/abastecer
#1

Boas, eu ao fazer /abastecer tipo ao abastecer 100% ele paga 10k como diminuo? nao consigo encontrar vejam

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp("/abastecer"cmdtexttrue) == 0)
    {
        new 
Boolean:found false;
        
        for(new 
i=0sizeof(FuelStationCoords); i++)
        {
            if(
IsPlayerInRangeOfPoint(playerid6.5FuelStationCoords[i][0], FuelStationCoords[i][1], FuelStationCoords[i][2]))
            {
                
found true;
            }
        }
        
        if(!
foundSendClientMessage(playeridCOLOR_RED"Vocк nгo estб em um posto de combustivel!");
        else if(!
IsPlayerInAnyVehicle(playerid)) SendClientMessage(playeridCOLOR_RED"Vocк nгo estб em um veiculo!");
        else
        {
            new 
Float:cost = ((100.00 VehicleInfo[GetPlayerVehicleID(playerid)][E_VEHICLE_FUEL]) * 100);
            if(
GetPlayerMoney(playerid) < cost)
            {
                new 
szOutput[128]; format(szOutputsizeof(szOutput), "Vocк nгo tem dinheiro suficiente para abastecer o seu veiculo ($%i)."floatround(cost));
                
SendClientMessage(playeridCOLOR_REDszOutput);
            }
            else
            {
                
GivePlayerMoney(playerid, -(floatround(cost)));
                
VehicleInfo[GetPlayerVehicleID(playerid)][E_VEHICLE_FUEL] = 100.00;
                
SendClientMessage(playeridCOLOR_BLUE"Seu veнculo foi abastecido!");
            }
        }
        return 
1;
    }
    return 
0;

agradeзo
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/abastecer", cmdtext, true) == 0)
    {
        new Boolean:found = false;
         
        for(new i=0; i < sizeof(FuelStationCoords); i++)
        {
            if(IsPlayerInRangeOfPoint(playerid, 6.5, FuelStationCoords[i][0], FuelStationCoords[i][1], FuelStationCoords[i][2]))
            {
                found = true;
            }
        }
         
        if(!found) SendClientMessage(playerid, COLOR_RED, "Vocк nгo estб em um posto de combustivel!");
        else if(!IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, COLOR_RED, "Vocк nгo estб em um veiculo!");
        else
        {
            new Float:cost = ((100.00 - VehicleInfo[GetPlayerVehicleID(playerid)][E_VEHICLE_FUEL]) * 20);  // diminui esse ultimo "100" coloquei pra 20
            if(GetPlayerMoney(playerid) < cost)
            {
                new szOutput[128]; format(szOutput, sizeof(szOutput), "Vocк nгo tem dinheiro suficiente para abastecer o seu veiculo ($%i).", floatround(cost));
                SendClientMessage(playerid, COLOR_RED, szOutput);
            }
            else
            {
                GivePlayerMoney(playerid, -(floatround(cost)));
                VehicleInfo[GetPlayerVehicleID(playerid)][E_VEHICLE_FUEL] = 100.00;

                SendClientMessage(playerid, COLOR_BLUE, "Seu veнculo foi abastecido!");
            }
        }
        return 1;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)