SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 10/06/2013, 01:15 AM   #1
RiChArD_A
Gangsta
 
RiChArD_A's Avatar
 
Join Date: Jul 2012
Location: Florida
Posts: 683
Reputation: -105
Default how to make a command check for some thing

Hi, i need this command:
pawn Code:
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 Code:
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 Code:
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;
}
__________________
RiChArD_A is offline   Reply With Quote
Old 10/06/2013, 01:22 AM   #2
ViruZz
Banned
 
Join Date: Feb 2012
Location: Montreal
Posts: 320
Reputation: 56
Default Re: how to make a command check for some thing

pawn Code:
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;
}

Last edited by ViruZz; 10/06/2013 at 02:30 AM.
ViruZz is offline   Reply With Quote
Old 10/06/2013, 01:29 AM   #3
Goldilox
Huge Clucker
 
Join Date: Mar 2012
Posts: 265
Reputation: 8
Default Re: how to make a command check for some thing

pawn Code:
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.
Goldilox is offline   Reply With Quote
Old 10/06/2013, 01:42 AM   #4
RiChArD_A
Gangsta
 
RiChArD_A's Avatar
 
Join Date: Jul 2012
Location: Florida
Posts: 683
Reputation: -105
Default Re: how to make a command check for some thing

Quote:
Originally Posted by ViruZz View Post
pawn Code:
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:
Code:
.pwn(1376) : warning 213: tag mismatch
the line is: if(gPaceMode == true)

_____________________
Quote:
Originally Posted by Goldilox View Post
pawn Code:
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.
__________________
RiChArD_A is offline   Reply With Quote
Old 10/06/2013, 02:26 AM   #5
Kirollos
Gangsta
 
Kirollos's Avatar
 
Join Date: Jun 2010
Location: Cairo, Egypt
Posts: 566
Reputation: 83
Default Re: how to make a command check for some thing

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

pawn Code:
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.
__________________
My github profile: https://github.com/Kirollos/

( ͡ ͜ʖ ͡)
Kirollos is offline   Reply With Quote
Old 10/06/2013, 02:29 AM   #6
ViruZz
Banned
 
Join Date: Feb 2012
Location: Montreal
Posts: 320
Reputation: 56
Default Re: how to make a command check for some thing

Quote:
Originally Posted by RiChArD_A View Post
Look:
Code:
.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)
ViruZz is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I make all this thing's ? yaron0600 Scripting Help 0 13/12/2012 09:27 PM
Help: Command to make Player say certain thing jakejohnsonusa Scripting Help 8 05/11/2012 10:23 PM
[Help] How can i make this thing? andruz99 Help Archive 7 05/05/2011 06:59 PM
how to make the drop thing Micko9 Help Archive 2 01/05/2010 11:42 AM
Can't make that jail thing. Erkan Help Archive 3 30/08/2009 07:44 AM


All times are GMT. The time now is 04:19 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.