/GOV is not working properly - 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: /GOV is not working properly (
/showthread.php?tid=565909)
/GOV is not working properly -
Blade_Cervetti - 02.03.2015
I can't seem to figure out what I have done wrong here. I've tried to rewrite it several different ways. I can't figure out what is happing. I am the chief of lspd, but yet I still cant use the cmd. (pFLeader == 11)
pawn Код:
if(strcmp(cmd, "/gov", true) == 0)
{
if((PlayerInfo[playerid][pFLeader] != 11) || (PlayerInfo[playerid][pFLeader] != 13) || (PlayerInfo[playerid][pFLeader] != 12) || (PlayerInfo[playerid][pFLeader] != 16))
{
SendClientMessage(playerid, COLOR_YELLOW, "Leader of LSPD, EMS, GOV, or NG only!");
return ;
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_USAGE, "USAGE: /gov [message]");
return 1;
}
format(string, sizeof(string), "* City Message: %s", result);
SendClientMessageToAll(COLOR_DBLUE, string);
return 1;
}
Any help is greatly appreciated
Re: /GOV is not working properly -
CalvinC - 02.03.2015
pawn Код:
if((PlayerInfo[playerid][pFLeader] != 11) || (PlayerInfo[playerid][pFLeader] != 13) || (PlayerInfo[playerid][pFLeader] != 12) || (PlayerInfo[playerid][pFLeader] != 16))
Shouldn't you be using &&?
Using || is basically
or, while && is basically
and.
Right now you're checking and sending the message if he's not leader of 11, or 12, or 13, or 16, so he has to be leader of all of them to use the command.
You should send the message if he's not leader of 11
and 12
and 13
and 16, so he only has to be leader of one of them.