need help with a command - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: need help with a command (
/showthread.php?tid=69106)
need help with a command -
killar456 - 15.03.2009
ok, i got a /gov command that kinda works. but it says "You Are Not A FBI Agent" even when they are
Код:
if(strcmp(cmd, "/gov", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pMember]==2)
{
SendClientMessage(playerid, COLOR_GREY, " You Not A FBI Agent !");
return 1;
}
if(PlayerInfo[playerid][pRank] < 5)
{
SendClientMessage(playerid, COLOR_GREY, " You need to be Rank 5 to be able to use this !");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/gov)ernment [text]");
return 1;
}
SendClientMessageToAll(COLOR_WHITE, "|___________ Government News Announcement ___________|");
format(string, sizeof(string), "Goverment Offical %s: %s", sendername, result);
SendClientMessageToAll(COLOR_DBLUE, string);
}
return 1;
}
i thought it was
Код:
if(PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pMember]==2)
{
SendClientMessage(playerid, COLOR_GREY, " You Not A FBI Agent !");
return 1;
}
and i tried removing that, and gave me abunch of errors
Re: need help with a command -
Zoopaman - 15.03.2009
change
if(PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pMember]==2)
to
if(PlayerInfo[playerid][pLeader]!=2||PlayerInfo[playerid][pMember]!=2)
== is equal
!= not equal
Re: need help with a command -
[RP]Rav - 15.03.2009
I think he should use
pawn Код:
if(PlayerInfo[playerid][pLeader] != 2 && PlayerInfo[playerid][pMember] != 2)
Re: need help with a command -
killar456 - 15.03.2009
ok, i tried both of those codes, and it comes up with the same thing
EDIT:
nevermind
i used the last suggestion and put a else before the next code
Код:
if(PlayerInfo[playerid][pLeader]!=2 && PlayerInfo[playerid][pMember]!=2)
{
SendClientMessage(playerid, COLOR_GREY, " You Not A FBI Agent !");
return 1;
}
else if(PlayerInfo[playerid][pRank] < 5)