SA-MP Forums Archive
[HELP] I cant fix that 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] I cant fix that error!! :( (/showthread.php?tid=83836)



[HELP] I cant fix that error!! :( - Moustafa - 27.06.2009

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SECONDARY_ATTACK)
    {

    if (PlayerToPoint(0.5, playerid, -2038.6663,-87.8214,35.3203))
    {
            SetPlayerPos(playerid, -2038.6670,-87.1617,35.4203);
            return 1;
        }
    SendClientMessage(playerid, 0x804040FF, "You're not near any door !");
    return 1;
        }

    if (PlayerToPoint(1, playerid, -2038.7289,-86.5928,35.4203))
    {
            SetPlayerPos(playerid, -2038.5620,-88.3436,35.3203);
            return 1;
        }
    SendClientMessage(playerid, 0x804040FF, "You're not near any door !");
    return 1;
        }
    return 1; // <-------------- line 249
    }
After compile:
pawn Код:
C:\Documents and Settings\xxxxxxx\Desktop\Desktop\server\gamemodes\gmtest.pwn(249) : error 010: invalid function or declaration
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.



Re: [HELP] I cant fix that error!! :( - Grim_ - 27.06.2009

Which line does it occur


Re: [HELP] I cant fix that error!! :( - farse - 27.06.2009

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SECONDARY_ATTACK)
{
if (PlayerToPoint(0.5, playerid, -2038.6663,-87.8214,35.3203))
{
SetPlayerPos(playerid, -2038.6670,-87.1617,35.4203);
}else SendClientMessage(playerid, 0x804040FF, "You're not near any door !");

if (PlayerToPoint(1, playerid, -2038.7289,-86.5928,35.4203))
{
SetPlayerPos(playerid, -2038.5620,-88.3436,35.3203);
}elseSendClientMessage(playerid, 0x804040FF, "You're not near any door !");
}
return 1;
}
Is good?


Re: [HELP] I cant fix that error!! :( - Moustafa - 27.06.2009

Quote:
Originally Posted by Swift_
Which line does it occur
Scroll down the code little bit -.-'


When you scroll down:
pawn Код:
if (PlayerToPoint(1, playerid, -2038.7289,-86.5928,35.4203))
    {
            SetPlayerPos(playerid, -2038.5620,-88.3436,35.3203);
            return 1;
        }
    SendClientMessage(playerid, 0x804040FF, "You're not near any door !");
    return 1;
        }
    return 1; // <-------------- line 249
    }



Re: [HELP] I cant fix that error!! :( - farse - 27.06.2009

You give that error because you put too many "return 1".
Put this:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SECONDARY_ATTACK)
{
if (PlayerToPoint(0.5, playerid, -2038.6663,-87.8214,35.3203)) return SetPlayerPos(playerid, -2038.6670,-87.1617,35.4203);
else SendClientMessage(playerid, 0x804040FF, "You're not near any door !");

if (PlayerToPoint(1, playerid, -2038.7289,-86.5928,35.4203)) return SetPlayerPos(playerid, -2038.5620,-88.3436,35.3203);
else SendClientMessage(playerid, 0x804040FF, "You're not near any door !");
}
return 1;
}



Re: [HELP] I cant fix that error!! :( - Moustafa - 27.06.2009

Thanks dude it works


Re: [HELP] I cant fix that error!! :( - ByFukara - 27.06.2009

Код:
return 0;