PDA

View Full Version : how to make a command check for some thing


RiChArD_A
10/06/2013, 01:15 AM
Hi, i need this command:

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:

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:

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;
}

ViruZz
10/06/2013, 01:22 AM
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;
}

Goldilox
10/06/2013, 01:29 AM
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. :(

RiChArD_A
10/06/2013, 01:42 AM
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)

_____________________
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.

Kirollos
10/06/2013, 02:26 AM
tag mismatch means that you didn't set your variable to bool:,


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.

ViruZz
10/06/2013, 02:29 AM
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)