i need to make it so cops dont pay for fuel
#1

Код:
CMD:refuel(playerid, params[])//Fuel System CMD REDONE BY BELKIN
{
	for(new i=1; i < MAX_FUEL_STATIONS; i++)
	{
		if(FuelStationCreated[i])
		{
			if(IsPlayerInRangeOfPoint(playerid, 15.0, FuelStationPos[i][0], FuelStationPos[i][1], FuelStationPos[i][2]))
			{
               if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFC800FF,"You are not in an vehicle!");
               if (isrefuelling[playerid]) return SendClientMessage(playerid,0xFFC800FF,"refuelling your vehicle!");
               if(!IsACop(playerid) || !IsAGov(playerid) || !IsMedic(playerid))
               {
			       GivePlayerCash(playerid, -0);
			   }
               GivePlayerCash(playerid, -100); //Sets the player's cash -$100
               SetCameraBehindPlayer(playerid);
               TogglePlayerControllable(playerid,0);
               isrefuelling[playerid] = 1;
               TextDrawSetString(td_fuel[playerid],"Refuelling...");
               SetTimerEx("timer_refuel",4500,false,"i",playerid);
			}
		}
	}
	SendClientMessage(playerid, COLOR_RED, "You are not in a fuel station!");
	return 1;
}
Reply
#2

pawn Код:
CMD:refuel(playerid, params[])//Fuel System CMD REDONE BY BELKIN
{
    for(new i=1; i < MAX_FUEL_STATIONS; i++)
    {
        if(FuelStationCreated[i])
        {
            if(IsPlayerInRangeOfPoint(playerid, 15.0, FuelStationPos[i][0], FuelStationPos[i][1], FuelStationPos[i][2]))
            {
               if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFC800FF,"You are not in an vehicle!");
               if (isrefuelling[playerid]) return SendClientMessage(playerid,0xFFC800FF,"refuelling your vehicle!");
               if(IsACop(playerid) || IsAGov(playerid) || IsMedic(playerid))
               {
                   GivePlayerCash(playerid, -0);
               }
               GivePlayerCash(playerid, -100); //Sets the player's cash -$100
               SetCameraBehindPlayer(playerid);
               TogglePlayerControllable(playerid,0);
               isrefuelling[playerid] = 1;
               TextDrawSetString(td_fuel[playerid],"Refuelling...");
               SetTimerEx("timer_refuel",4500,false,"i",playerid);
            }
        }
    }
    SendClientMessage(playerid, COLOR_RED, "You are not in a fuel station!");
    return 1;
}
Done.
Reply
#3

Quote:
Originally Posted by Mriss
Посмотреть сообщение
pawn Код:
CMD:refuel(playerid, params[])//Fuel System CMD REDONE BY BELKIN
{
    for(new i=1; i < MAX_FUEL_STATIONS; i++)
    {
        if(FuelStationCreated[i])
        {
            if(IsPlayerInRangeOfPoint(playerid, 15.0, FuelStationPos[i][0], FuelStationPos[i][1], FuelStationPos[i][2]))
            {
               if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFC800FF,"You are not in an vehicle!");
               if (isrefuelling[playerid]) return SendClientMessage(playerid,0xFFC800FF,"refuelling your vehicle!");
               if(IsACop(playerid) || IsAGov(playerid) || IsMedic(playerid))
               {
                   GivePlayerCash(playerid, -0);
               }
               GivePlayerCash(playerid, -100); //Sets the player's cash -$100
               SetCameraBehindPlayer(playerid);
               TogglePlayerControllable(playerid,0);
               isrefuelling[playerid] = 1;
               TextDrawSetString(td_fuel[playerid],"Refuelling...");
               SetTimerEx("timer_refuel",4500,false,"i",playerid);
            }
        }
    }
    SendClientMessage(playerid, COLOR_RED, "You are not in a fuel station!");
    return 1;
}
Done.
not working
Reply
#4

Show us timer_refuel timer...
Reply
#5

Код:
forward timer_refuel(playerid);
public timer_refuel(playerid)
{
    new vid = GetPlayerVehicleID(playerid);
    CarFuel[vid] = CarFuel[vid] = 100;
    isrefuelling[playerid] = 0;
    TogglePlayerControllable(playerid,1);
}
Reply
#6

try this

Код:
 CMD:refuel(playerid, params[])//Fuel System CMD REDONE BY BELKIN
{
	for(new i=1; i < MAX_FUEL_STATIONS; i++)
	{
		if(FuelStationCreated[i])
		{
			if(IsPlayerInRangeOfPoint(playerid, 15.0, FuelStationPos[i][0], FuelStationPos[i][1], FuelStationPos[i][2]))
			{
               if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFC800FF,"You are not in an vehicle!");
               if (isrefuelling[playerid]) return SendClientMessage(playerid,0xFFC800FF,"refuelling your vehicle!");
               if(!IsACop(playerid) || !IsAGov(playerid) || !IsMedic(playerid)) GivePlayerCash(playerid, 0);
 	       else GivePlayerCash(playerid, -100);
               SetCameraBehindPlayer(playerid);
               TogglePlayerControllable(playerid,0);
               isrefuelling[playerid] = 1;
               TextDrawSetString(td_fuel[playerid],"Refuelling...");
               SetTimerEx("timer_refuel",4500,false,"i",playerid);
			}
		}
	}
	SendClientMessage(playerid, COLOR_RED, "You are not in a fuel station!");
	return 1;
}
You need it to check if its gov if not what else to do. Your did not charge them and charged them
Reply
#7

That is poorly written as a heads up.

Replace this from the code in the first post:
pawn Код:
if(!IsACop(playerid) || !IsAGov(playerid) || !IsMedic(playerid))
               {
                   GivePlayerCash(playerid, -0);
               }
               GivePlayerCash(playerid, -100); //Sets the player's cash -$100
With:

pawn Код:
if(IsACop(playerid) || IsAGov(playerid) || IsMedic(playerid))
{
      GivePlayerCash(playerid, -0);//They are a government official, so the charge is $0
}
else
{
      GivePlayerCash(playerid, -100); //Sets the non-governmental player's cash -$100
}
Reply
#8

Here try this:
Код:
CMD:refuel(playerid, params[])//Fuel System CMD REDONE BY BELKIN
{
	for(new i=1; i < MAX_FUEL_STATIONS; i++)
	{
		if(FuelStationCreated[i])
		{
			if(IsPlayerInRangeOfPoint(playerid, 15.0, FuelStationPos[i][0], FuelStationPos[i][1], FuelStationPos[i][2]))
			{
               if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFC800FF,"You are not in an vehicle!");
               if (isrefuelling[playerid]) return SendClientMessage(playerid,0xFFC800FF,"refuelling your vehicle!");
               if (!IsACop(playerid) || !IsAGov(playerid) || !IsMedic(playerid)) GivePlayerCash(playerid, -100); //Sets the player's cash -$100
               SetCameraBehindPlayer(playerid);
               TogglePlayerControllable(playerid,0);
               isrefuelling[playerid] = 1;
               TextDrawSetString(td_fuel[playerid],"Refuelling...");
               SetTimerEx("timer_refuel",4500,false,"i",playerid);
			}
		}
	}
	SendClientMessage(playerid, COLOR_RED, "You are not in a fuel station!");
	return 1;
}
Reply
#9

pawn Код:
CMD:refuel(playerid, params[])//Fuel System CMD REDONE BY BELKIN
{
    for(new i=1; i < MAX_FUEL_STATIONS; i++)
    {
        if(FuelStationCreated[i])
        {
            if(IsPlayerInRangeOfPoint(playerid, 15.0, FuelStationPos[i][0], FuelStationPos[i][1], FuelStationPos[i][2]))
            {
               if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFC800FF,"You are not in an vehicle!");
               if (isrefuelling[playerid]) return SendClientMessage(playerid,0xFFC800FF,"refuelling your vehicle!");
               if (!IsACop(playerid) || !IsAGov(playerid) || !IsMedic(playerid)) return GivePlayerCash(playerid, -100); //Sets the player's cash -$100
               SetCameraBehindPlayer(playerid);
               TogglePlayerControllable(playerid,0);
               isrefuelling[playerid] = 1;
               TextDrawSetString(td_fuel[playerid],"Refuelling...");
               SetTimerEx("timer_refuel",4500,false,"i",playerid);
            }
        }
    }
    SendClientMessage(playerid, COLOR_RED, "You are not in a fuel station!");
    return 1;
}
It will work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)