Help me solve this problem
#1

Hello,

I am making a Fuel system, its working but I can refuel where ever I want, so I tried this.

pawn Код:
forward IsAtGasStation(playerid);

command(refuel, playerid, params[])
{
    #pragma unused params
    if(!IsAtGasStation(playerid)) return SCM(playerid, RED, "You are not at a Gas Sation");
    if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFC800FF,"You are not in an vehicle!"); //if a player isnt in a vehicle, it stops here
    if (isrefuelling[playerid]) return SendClientMessage(playerid,0xFFC800FF,"You are already refuelling!"); //if a player is already refuelling, it stops here
    if (GetPlayerMoney(playerid) - 200 <0) return SendClientMessage(playerid,0xFFC800FF,"You dont have enough money!"); //if a player doesnt have $80 anymore, it stops here
    GivePlayerMoney(playerid,-200); //Sets the player's cash -$80
    SetCameraBehindPlayer(playerid); //Sets the camera behind the player (looks better because the player will be frozen for a few secs)
    TogglePlayerControllable(playerid,0); //freezes the player so he cant drive and refuel at the same time
    isrefuelling[playerid] = 1; //setting isrefuelling to 1 so the player cant spam /refuel
    TextDrawSetString(td_fuel[playerid],"Refuelling..."); //changing textdraw to /refuel
    SetTimerEx("timer_refuel",4500,false,"i",playerid); //setting refueltimer
    return 1;
}

public IsAtGasStation(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid,30,1004.0070,-939.3102,42.1797) || IsPlayerInRangeOfPoint(playerid,30,1944.3260,-1772.9254,13.3906))
        }
        if(IsPlayerInRangeOfPoint(playerid,30,-90.5515,-1169.4578,2.4079) || IsPlayerInRangeOfPoint(playerid,30,-1609.7958,-2718.2048,48.5391))
        }
        if(IsPlayerInRangeOfPoint(playerid,30,-2029.4968,156.4366,28.9498) || IsPlayerInRangeOfPoint(playerid,30,-2408.7590,976.0934,45.4175))
        }
        if(IsPlayerInRangeOfPoint(playerid,30,-2243.9629,-2560.6477,31.8841) || IsPlayerInRangeOfPoint(playerid,30,-1676.6323,414.0262,6.9484))
        }
        if(IsPlayerInRangeOfPoint(playerid,30,2202.2349,2474.3494,10.5258) || IsPlayerInRangeOfPoint(playerid,30,614.9333,1689.7418,6.6968))
        }
        if(IsPlayerInRangeOfPoint(playerid,30,-1328.8250,2677.2173,49.7665) || IsPlayerInRangeOfPoint(playerid,30,70.3882,1218.6783,18.5165))
        }
        if(IsPlayerInRangeOfPoint(playerid,30,2113.7390,920.1079,10.5255) || IsPlayerInRangeOfPoint(playerid,30,-1327.7218,2678.8723,50.0625))
        }
        if(IsPlayerInRangeOfPoint(playerid,30,656.4265,-559.8610,16.5015) || IsPlayerInRangeOfPoint(playerid,30,656.3797,-570.4138,16.5015))
        }
    }
    return 1;
}
But this doesn't work get thousends of error.
I think some of you will know what I try to do, and maybe they can help me.

So please help :P
Reply
#2

pawn Код:
public IsAtGasStation(playerid)
public? Try replace it with stock
pawn Код:
stock IsAtGasStation(playerid)
Reply
#3

Again the errors:

pawn Код:
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2639) : error 029: invalid expression, assumed zero
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2639 -- 2640) : warning 215: expression has no effect
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2640) : error 001: expected token: ";", but found "if"
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2641) : error 029: invalid expression, assumed zero
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2641 -- 2642) : warning 215: expression has no effect
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2642) : error 001: expected token: ";", but found "if"
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2643) : error 029: invalid expression, assumed zero
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2643 -- 2644) : warning 215: expression has no effect
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2644) : error 001: expected token: ";", but found "if"
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2645) : error 029: invalid expression, assumed zero
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2645 -- 2646) : warning 215: expression has no effect
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2646) : error 001: expected token: ";", but found "if"
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2647) : error 029: invalid expression, assumed zero
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2647 -- 2648) : warning 215: expression has no effect
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2648) : error 001: expected token: ";", but found "if"
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2649) : error 029: invalid expression, assumed zero
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2649 -- 2650) : warning 215: expression has no effect
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2650) : error 001: expected token: ";", but found "if"
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2651) : error 029: invalid expression, assumed zero
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2651 -- 2652) : warning 215: expression has no effect
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2652) : error 001: expected token: ";", but found "if"
C:\Users\Stefan Dorst\Desktop\LSRES\gamemodes\LSRES.pwn(2653) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


15 Errors.
Reply
#4

pawn Код:
public IsAtGasStation(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid,30,1004.0070,-939.3102,42.1797) || IsPlayerInRangeOfPoint(playerid,30,1944.3260,-1772.9254,13.3906))
        else if(IsPlayerInRangeOfPoint(playerid,30,-90.5515,-1169.4578,2.4079) || IsPlayerInRangeOfPoint(playerid,30,-1609.7958,-2718.2048,48.5391))
        else if(IsPlayerInRangeOfPoint(playerid,30,-2029.4968,156.4366,28.9498) || IsPlayerInRangeOfPoint(playerid,30,-2408.7590,976.0934,45.4175))
        else if(IsPlayerInRangeOfPoint(playerid,30,-2243.9629,-2560.6477,31.8841) || IsPlayerInRangeOfPoint(playerid,30,-1676.6323,414.0262,6.9484))
        else if(IsPlayerInRangeOfPoint(playerid,30,2202.2349,2474.3494,10.5258) || IsPlayerInRangeOfPoint(playerid,30,614.9333,1689.7418,6.6968))
        else if(IsPlayerInRangeOfPoint(playerid,30,-1328.8250,2677.2173,49.7665) || IsPlayerInRangeOfPoint(playerid,30,70.3882,1218.6783,18.5165))
        else if(IsPlayerInRangeOfPoint(playerid,30,2113.7390,920.1079,10.5255) || IsPlayerInRangeOfPoint(playerid,30,-1327.7218,2678.8723,50.0625))  
        else if(IsPlayerInRangeOfPoint(playerid,30,656.4265,-559.8610,16.5015) || IsPlayerInRangeOfPoint(playerid,30,656.3797,-570.4138,16.5015))
       
    }
    return 1;
}
Try to replace your code with what I gave you...
Reply
#5

It honestly doesn't matter here whether it is a public or stock.

You're using unnecessary } after every if(PlayerToPoint). Try this:
Код:
public IsAtGasStation(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid,30,1004.0070,-939.3102,42.1797) || IsPlayerInRangeOfPoint(playerid,30,1944.3260,-1772.9254,13.3906))
        }
        if(IsPlayerInRangeOfPoint(playerid,30,-90.5515,-1169.4578,2.4079) || IsPlayerInRangeOfPoint(playerid,30,-1609.7958,-2718.2048,48.5391)) return 1;
        if(IsPlayerInRangeOfPoint(playerid,30,-2029.4968,156.4366,28.9498) || IsPlayerInRangeOfPoint(playerid,30,-2408.7590,976.0934,45.4175)) return 1;
        if(IsPlayerInRangeOfPoint(playerid,30,-2243.9629,-2560.6477,31.8841) || IsPlayerInRangeOfPoint(playerid,30,-1676.6323,414.0262,6.9484)) return 1;
        if(IsPlayerInRangeOfPoint(playerid,30,2202.2349,2474.3494,10.5258) || IsPlayerInRangeOfPoint(playerid,30,614.9333,1689.7418,6.6968)) return 1;
        if(IsPlayerInRangeOfPoint(playerid,30,-1328.8250,2677.2173,49.7665) || IsPlayerInRangeOfPoint(playerid,30,70.3882,1218.6783,18.5165)) return 1;
        if(IsPlayerInRangeOfPoint(playerid,30,2113.7390,920.1079,10.5255) || IsPlayerInRangeOfPoint(playerid,30,-1327.7218,2678.8723,50.0625)) return 1;
        if(IsPlayerInRangeOfPoint(playerid,30,656.4265,-559.8610,16.5015) || IsPlayerInRangeOfPoint(playerid,30,656.3797,-570.4138,16.5015)) return 1;
else return 0;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)