SA-MP Forums Archive
[Help] Error - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Error (/showthread.php?tid=268474)



[Help] Error - Kenka - 12.07.2011

i get this error : invalid expression, assumed zero
code :
Код:
public IsAtDealership(playerid)
{
	if(IsPlayerConnected(playerid))
	{
	    if(PlayerToPoint(20,playerid,883.2045,-1664.6119,13.0577) || PlayerToPoint(20,playerid,2155.4507,-1166.2189,23.3321) || PlayerToPoint(20,playerid,2126.8904,-1139.7179,24.7564) || PlayerToPoint(20,playerid,1667.0667,-1055.6960,23.3974) || PlayerToPoint(20,playerid,549.1564,-1282.5328,16.7654) || PlayerToPoint(20,playerid,1085.9401,-1754.1245,12.8987) || PlayerToPoint(20,playerid,1992.6484,-1278.7939,23.3309) || PlayerToPoint(20,playerid,1838.1348,-1864.8322,13.3828))
		{
		    return 1;
		}
		else if(PlayerToPoint(20,playerid,2057.9741,-1913.3403,13.0569) || PlayerToPoint(20,playerid,2516.9893,-1529.9097,23.0431) || PlayerToPoint(20,playerid,2425.1406,-1229.1522,24.4736) || (PlayerToPoint(20,playerid,1658.9684,-1020.9565,23.8984) || PlayerToPoint(20,playerid,1662.3169,-1120.3746,23.9063) || PlayerToPoint(20,playerid,2167.3503,-1801.1819,13.1062) || PlayerToPoint(20,playerid,1942.7716,-2136.1067,13.1914) || PlayerToPoint(20,playerid,1263.4960,-1813.7924,12.9131))
		{ //<---------- THIS IS THE LINE WITH ERROR
		    return 1;
		}
	}
	return 0;
}
Thanks everyone!


Re: [Help] Error - Jay. - 12.07.2011

Those last brackets aren't needed... maybe
pawn Код:
public IsAtDealership(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerToPoint(20,playerid,883.2045,-1664.6119,13.0577) || PlayerToPoint(20,playerid,2155.4507,-1166.2189,23.3321) || PlayerToPoint(20,playerid,2126.8904,-1139.7179,24.7564) || PlayerToPoint(20,playerid,1667.0667,-1055.6960,23.3974) || PlayerToPoint(20,playerid,549.1564,-1282.5328,16.7654) || PlayerToPoint(20,playerid,1085.9401,-1754.1245,12.8987) || PlayerToPoint(20,playerid,1992.6484,-1278.7939,23.3309) || PlayerToPoint(20,playerid,1838.1348,-1864.8322,13.3828))
        {
            return 1;
        }
        else if(PlayerToPoint(20,playerid,2057.9741,-1913.3403,13.0569) || PlayerToPoint(20,playerid,2516.9893,-1529.9097,23.0431) || PlayerToPoint(20,playerid,2425.1406,-1229.1522,24.4736) || (PlayerToPoint(20,playerid,1658.9684,-1020.9565,23.8984) || PlayerToPoint(20,playerid,1662.3169,-1120.3746,23.9063) || PlayerToPoint(20,playerid,2167.3503,-1801.1819,13.1062) || PlayerToPoint(20,playerid,1942.7716,-2136.1067,13.1914) || PlayerToPoint(20,playerid,1263.4960,-1813.7924,12.9131))
        return 1;
    }
    return 0;
}



Re: [Help] Error - Kush - 12.07.2011

The '//' are simply comments. Also, Jay's way should work, but I dont see why you need an 'else if' return statement underneath the public function.

pawn Код:
public IsAtDealership(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerToPoint(20,playerid,883.2045,-1664.6119,13.0577) || PlayerToPoint(20,playerid,2155.4507,-1166.2189,23.3321) || PlayerToPoint(20,playerid,2126.8904,-1139.7179,24.7564) || PlayerToPoint(20,playerid,1667.0667,-1055.6960,23.3974) || PlayerToPoint(20,playerid,549.1564,-1282.5328,16.7654) || PlayerToPoint(20,playerid,1085.9401,-1754.1245,12.8987) || PlayerToPoint(20,playerid,1992.6484,-1278.7939,23.3309) || PlayerToPoint(20,playerid,1838.1348,-1864.8322,13.3828))
        {
            return 1;
        }
    }
    return 0;
}
If you simply want when the player is at those positions, simply create another public function.
pawn Код:
forward YourFunction(playerid)
public YourFunction(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerToPoint(20,playerid,2057.9741,-1913.3403,13.0569) || PlayerToPoint(20,playerid,2516.9893,-1529.9097,23.0431) || PlayerToPoint(20,playerid,2425.1406,-1229.1522,24.4736) || (PlayerToPoint(20,playerid,1658.9684,-1020.9565,23.8984) || PlayerToPoint(20,playerid,1662.3169,-1120.3746,23.9063) || PlayerToPoint(20,playerid,2167.3503,-1801.1819,13.1062) || PlayerToPoint(20,playerid,1942.7716,-2136.1067,13.1914) || PlayerToPoint(20,playerid,1263.4960,-1813.7924,12.9131))
        {
            return 1;
        }
    }
    return 0;
}
For future references, use the [PAWN] tags instead of the [CODE]. This way, we can see the code much 'clearer' and can respond easily.


Re: [Help] Error - Kenka - 12.07.2011

i tried
pawn Код:
public IsAtDealership(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerToPoint(20,playerid,883.2045,-1664.6119,13.0577) || PlayerToPoint(20,playerid,2155.4507,-1166.2189,23.3321) || PlayerToPoint(20,playerid,2126.8904,-1139.7179,24.7564) || PlayerToPoint(20,playerid,1667.0667,-1055.6960,23.3974) || PlayerToPoint(20,playerid,549.1564,-1282.5328,16.7654) || PlayerToPoint(20,playerid,1085.9401,-1754.1245,12.8987) || PlayerToPoint(20,playerid,1992.6484,-1278.7939,23.3309) || PlayerToPoint(20,playerid,1838.1348,-1864.8322,13.3828))
        {
            return 1;
        }
        else if(PlayerToPoint(20,playerid,2057.9741,-1913.3403,13.0569) || PlayerToPoint(20,playerid,2516.9893,-1529.9097,23.0431) || PlayerToPoint(20,playerid,2425.1406,-1229.1522,24.4736) || (PlayerToPoint(20,playerid,1658.9684,-1020.9565,23.8984) || PlayerToPoint(20,playerid,1662.3169,-1120.3746,23.9063) || PlayerToPoint(20,playerid,2167.3503,-1801.1819,13.1062) || PlayerToPoint(20,playerid,1942.7716,-2136.1067,13.1914) || PlayerToPoint(20,playerid,1263.4960,-1813.7924,12.9131))
        return 1;
    }
    return 0;
}
but i get another error :
Код:
error 001: expected token: ")", but found "return"



Re: [Help] Error - Kenka - 12.07.2011

i know it's not allowed to double post but i can't do anything when i can't get rid of this error and this post is only going down without double post
Seriously sorry!

EDIT:: solved the problem myself.