SA-MP Forums Archive
how to make a command check for some thing - 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: how to make a command check for some thing (/showthread.php?tid=443019)



how to make a command check for some thing - RiChArD_A - 10.06.2013

Hi, i need this command:
pawn Код:
CMD:fun(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 2)
    {
gPaceMode = false;
GivePlayerWeapon(playerid,24,100000);
GivePlayerWeapon(playerid,31,100000);
GivePlayerWeapon(playerid,29,100000);
    }
    else
    {
        SendClientMessage(playerid, -1, "{FF3300}Must be an Admin level 2 or higher to use this command.");
    }
    return 1;
}
to check if pace mode is true:
pawn Код:
gPaceMode = true;
If yes, then do what the command is supposed to do. But if not send a message saying: Pace Mode is not ON.

__________________________________________

I already tried this but didn't work:
pawn Код:
CMD:fun(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 2)
    gPaceMode = true;
    {
gPaceMode = false;
GivePlayerWeapon(playerid,24,100000);
GivePlayerWeapon(playerid,31,100000);
GivePlayerWeapon(playerid,29,100000);
    }
    SendClientMessage(playerid, -1, "{FF3300}Pace Mode is not ON.");
    {
        SendClientMessage(playerid, -1, "{FF3300}Must be an Admin level 2 or higher to use this command.");
    }
    return 1;
}



Re: how to make a command check for some thing - ViruZz - 10.06.2013

pawn Код:
CMD:fun(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 2)
    {
        if(gPaceMode == 1)
        {
            gPaceMode = false;
            GivePlayerWeapon(playerid,24,100000);
            GivePlayerWeapon(playerid,31,100000);
            GivePlayerWeapon(playerid,29,100000);
        }
        else return SendClientMessage(playerid, -1, "{FF3300}Pace Mode is not ON.");
    }
    else return SendClientMessage(playerid, -1, "{FF3300}Must be an Admin level 2 or higher to use this command.");
    return 1;
}



Re: how to make a command check for some thing - Goldilox - 10.06.2013

pawn Код:
CMD:fun(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 2)
    {
      if(gPaceMode = true)
        {
GivePlayerWeapon(playerid,24,100000);
GivePlayerWeapon(playerid,31,100000);
GivePlayerWeapon(playerid,29,100000);
        }
       else{
SendClientMessage(playerid,0xCCCCCCAA,"Your Pace Mode isn't ON");
return 1;
}
    else
    {
        SendClientMessage(playerid, -1, "{FF3300}Must be an Admin level 2 or higher to use this command.");
    }
    return 1;
}
Hope this helps and please +rep

EDIT: OMG I wanted to be first.


Re: how to make a command check for some thing - RiChArD_A - 10.06.2013

Quote:
Originally Posted by ViruZz
Посмотреть сообщение
pawn Код:
CMD:fun(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 2)
    {
        if(gPaceMode == true)
        {
            gPaceMode = false;
            GivePlayerWeapon(playerid,24,100000);
            GivePlayerWeapon(playerid,31,100000);
            GivePlayerWeapon(playerid,29,100000);
        }
        else return SendClientMessage(playerid, -1, "{FF3300}Pace Mode is not ON.");
    }
    else return SendClientMessage(playerid, -1, "{FF3300}Must be an Admin level 2 or higher to use this command.");
    return 1;
}
Look:
Код:
.pwn(1376) : warning 213: tag mismatch
the line is: if(gPaceMode == true)

_____________________
Quote:
Originally Posted by Goldilox
Посмотреть сообщение
pawn Код:
CMD:fun(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 2)
    {
      if(gPaceMode = true)
        {
GivePlayerWeapon(playerid,24,100000);
GivePlayerWeapon(playerid,31,100000);
GivePlayerWeapon(playerid,29,100000);
        }
       else{
SendClientMessage(playerid,0xCCCCCCAA,"Your Pace Mode isn't ON");
return 1;
}
    else
    {
        SendClientMessage(playerid, -1, "{FF3300}Must be an Admin level 2 or higher to use this command.");
    }
    return 1;
}
Hope this helps and please +rep

EDIT: OMG I wanted to be first.
A lot more lol. i even get errors for other commands.


Re: how to make a command check for some thing - Kirollos - 10.06.2013

tag mismatch means that you didn't set your variable to bool:,

pawn Код:
CMD:fun(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 2)
    {
        if(gPaceMode == 1)
        {
            gPaceMode = 0;
            GivePlayerWeapon(playerid,24,100000);
            GivePlayerWeapon(playerid,31,100000);
            GivePlayerWeapon(playerid,29,100000);
        }
        else return SendClientMessage(playerid, -1, "{FF3300}Pace Mode is not ON.");
    }
    else return SendClientMessage(playerid, -1, "{FF3300}Must be an Admin level 2 or higher to use this command.");
    return 1;
}
so you should use 0 & 1 instead of false & true.


Re: how to make a command check for some thing - ViruZz - 10.06.2013

Quote:
Originally Posted by RiChArD_A
Посмотреть сообщение
Look:
Код:
.pwn(1376) : warning 213: tag mismatch
the line is: if(gPaceMode == true)
herp derp

It's supposed to be equal to 1 and not the actual word true so if(gPaceMode == 1)