SA-MP Forums Archive
Command problem. - 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)
+--- Thread: Command problem. (/showthread.php?tid=508984)



Command problem. - DCatalin - 24.04.2014

We have the command:

pawn Код:
if(strcmp(cmd, "/exam", true) == 0)
{
   
    if(PlayerToPoint(2.0,playerid,2045.9504,-1913.1392,13.5469))
    {
        if(PlayerInfo[playerid][pDrivingLicense] == 1)
        {
        SendClientMessage(playerid, 0xFFFFFFFFFF, "{CC0066}[DMV]: {FFFFFF}You already have a driving license!");
        }
        else
        {
        SendClientMessage(playerid, 0xFFFFFFFFFF, "{CC0066}[DMV]: {FFFFFF}Get in a car and follow the checkpoints!");
        CP[playerid] = DMV;
        }
    }
    else
    {
    SendClientMessage(playerid, 0xFFFFFFFFFF, "{CC0066}[DMV]: {FFFFFF}You are not at DMV. I have placed a checkpoint to DMV, go there to get your driving license.");
    SetPlayerCheckpoint(playerid, 2045.9504,-1913.1392,13.5469, 2.0);
    CP[playerid] = 1;
    }  
    return 1;
}
and the errors:

Код:
(325) : error 010: invalid function or declaration
(328) : error 010: invalid function or declaration
(330) : error 010: invalid function or declaration
(334) : error 010: invalid function or declaration
(340) : error 010: invalid function or declaration
(346) : error 010: invalid function or declaration
and the lines:

pawn Код:
325: if(strcmp(cmd, "/exam", true) == 0)
328: if(PlayerToPoint(2.0,playerid,2045.9504,-1913.1392,13.5469))
330: if(PlayerInfo[playerid][pDrivingLicense] == 1)
334: else
340: else
346: return 1;

Sorry for my bad english, thank you.


Re: Command problem. - arakuta - 24.04.2014

Is this CMD inside OnPlayerCommandText ?


Re: Command problem. - Aerotactics - 25.04.2014

"cmd" needs to be "cmdtext"


Re : Command problem. - Ramoboss - 25.04.2014

Show us your OnPlayerCommandText,
it might be a Bracket problem


Re: Command problem. - Mattakil - 25.04.2014

Big hint, if you're writing a script, don't use string compare, use zcmd.

Also...
pawn Код:
if(PlayerToPoint(2.0,playerid,2045.9504,-1913.1392,13.5469))
Maybe you've defined it elsewhere, but it should look like
pawn Код:
if(IsPlayerInRangeOfPoint(2.0, playerid, 2045.9504, -1913.1392, 13.5469))