SA-MP Forums Archive
Help with a command. - 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 with a command. (/showthread.php?tid=194694)



Help with a command. - M3NK5 - 30.11.2010

Hey, I tried making a command to enter a specific area, ( a custom made fire department ) for some reason, in pawno it says that there is an error.

If you could fix this, thankyou
The co-ordinates are correct, and what i've set them to.
I just need this working ;[
pawn Код:
if (strcmp("/enterfd", cmdtext, true, 6) == 0)
            {
                if(IsPlayerInRangeOfPoint(playerid,1342.4213867188,-1669.3712158203,17.7265625))
                    {
                        SetPlayerPos(playerid,1289.4602050781,-1604.3106689453,1242.7280273438);
                        return 1;

            }
        if (strcmp("/exitfd", cmdtext, true, 6) == 0)
            {
                if(IsPlayerInRangeOfPoint(playerid,1289.4602050781,-1604.3106689453,1242.7280273438))
                    {
                        SetPlayerPos(playerid,1342.4213867188,-1669.3712158203,17.7265625);
                        return 1;
                    }
Thanks, Menkz (M3NK5)


Re: Help with a command. - ExEx - 30.11.2010

show us the error


Re: Help with a command. - iggy1 - 30.11.2010

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/enterfd", cmdtext, true, 6) == 0)
            {
                if(IsPlayerInRangeOfPoint(playerid, 5.0, 1342.4213867188,-1669.3712158203,17.7265625))
                    {                             //^^^range
                        SetPlayerPos(playerid,1289.4602050781,-1604.3106689453,1242.7280273438);
                        return 1;
                    }

            }
        if (strcmp("/exitfd", cmdtext, true, 6) == 0)
            {
                if(IsPlayerInRangeOfPoint(playerid,5.0,1289.4602050781,-1604.3106689453,1242.7280273438))
                    {
                        SetPlayerPos(playerid,1342.4213867188,-1669.3712158203,17.7265625);
                        return 1;
                    }
            }
    return 0;
}
Missing closing brace and "IsPlayerInRangeOfPoint" has range parameter. Not touched the indentation. (incase you didn't notice lol)


Re: Help with a command. - M3NK5 - 30.11.2010

Still getting this,
Quote:

C:\Documents and Settings\user\Desktop\Mitchells Stuff\Ravens\gamemodes\larp.pwn(39612) : warning 217: loose indentation
C:\Documents and Settings\user\Desktop\Mitchells Stuff\Ravens\gamemodes\larp.pwn(39617) : warning 217: loose indentation
C:\Documents and Settings\user\Desktop\Mitchells Stuff\Ravens\gamemodes\larp.pwn(39623) : warning 225: unreachable code

:S


Re: Help with a command. - iggy1 - 30.11.2010

The unreachable code is caused by another part of your script because when i compile that code i just get loose indentation warnings which you should know how to fix.
Indentation<< Look here

As for the unreachable code warning that is a problem, but you will need to post more code because the warning isn't from the code i posted.


Re: Help with a command. - Menkz - 30.11.2010

when I get home i'll get the lines, i'm using ravens roleplay..


Re: Help with a command. - Steven82 - 01.12.2010

Quote:
Originally Posted by iggy1
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/enterfd", cmdtext, true, 6) == 0)
            {
                if(IsPlayerInRangeOfPoint(playerid, 5.0, 1342.4213867188,-1669.3712158203,17.7265625))
                    {                             //^^^range
                        SetPlayerPos(playerid,1289.4602050781,-1604.3106689453,1242.7280273438);
                        return 1;
                    }

            }
            if (strcmp("/exitfd", cmdtext, true, 6) == 0)
            {
                if(IsPlayerInRangeOfPoint(playerid,5.0,1289.4602050781,-1604.3106689453,1242.7280273438))
                    {
                        SetPlayerPos(playerid,1342.4213867188,-1669.3712158203,17.7265625);
                        return 1;
                    }
            }
    return 0;
}
Missing closing brace and "IsPlayerInRangeOfPoint" has range parameter. Not touched the indentation. (incase you didn't notice lol)
Alright the 6 after the true.

The 6 needs to be changed to 7-8 on /enterfd


Try this
pawn Код:
if (strcmp("/enterfd", cmdtext, true, 8) == 0)
//
if (strcmp("/exitfd", cmdtext, true, 8) == 0)
Just try that above and if it doesn't work then something is conflicting with this script..


Re: Help with a command. - M3NK5 - 01.12.2010

close this please, I fixed it

Thanks guys