SA-MP Forums Archive
Army only 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: Army only command (/showthread.php?tid=215705)



Army only command - MEC - 23.01.2011

i'm trying to limit a /air command from an Airstrike FS only to TEAM_ARMY

Код:
6038  //Airstrike command, Army only, Hoorah!
6039	if(strcmp(cmd, "/air", true) == 0) (
6040	if(IsPlayerConnected(playerid)) (
6041	if(IsSpawned[playerid] == 0) (
6042	SendClientMessage(playerid, COLOR_ERROR, "Your are dead. You cannot use this command");
6043	return 1;
6044	)
6045	if(gTeam[playerid] != TEAM_ARMY) (
6046	SendClientMessage(playerid, COLOR_ERROR, "This command can only be used by the Army");
6047	return 1;
6048	)
do i do this in the FS or the GM? or am i doing this wrong all together?

when i tried to do this in the GM it gave me these errors:
Код:
MEC.pwn(6039 -- 6040) : error 029: invalid expression, assumed zero
MEC.pwn(6040) : error 001: expected token: ";", but found ")"
MEC.pwn(6040) : error 029: invalid expression, assumed zero
MEC.pwn(6040) : fatal error 107: too many error messages on one line



Re: Army only command - Kitten - 23.01.2011

can you actually show the lines on those errors i know you posted them but its really confusing finding out which line it is.


Re: Army only command - ricardo178 - 23.01.2011

Quote:
Originally Posted by MEC
Посмотреть сообщение
i'm trying to limit a /air command from an Airstrike FS only to TEAM_ARMY

Код:
//Airstrike command, Army only, Hoorah!
	if(strcmp(cmd, "/air", true) == 0) (
	if(IsPlayerConnected(playerid)) (
	if(IsSpawned[playerid] == 0) (
	SendClientMessage(playerid, COLOR_ERROR, "Your are dead. You cannot use this command");
	return 1;
	)
	if(gTeam[playerid] != TEAM_ARMY) (
	SendClientMessage(playerid, COLOR_ERROR, "This command can only be used by the Army");
	return 1;
	)
do i do this in the FS or the GM? or am i doing this wrong all together?

when i tried to do this in the GM it gave me these errors:
Код:
MEC.pwn(6039 -- 6040) : error 029: invalid expression, assumed zero
MEC.pwn(6040) : error 001: expected token: ";", but found ")"
MEC.pwn(6040) : error 029: invalid expression, assumed zero
MEC.pwn(6040) : fatal error 107: too many error messages on one line
WTF? Using () where to use {}??
OMG!... ok, open yout gamemode and post here the command /air code


Re: Army only command - MEC - 23.01.2011

updated main post.

the airstrike command is a Filterscript, its in the filterscripts section of this forums


Re: Army only command - PeteShag - 23.01.2011

Edit : Too slow

Edit 2:

pawn Код:
if(strcmp(cmd, "/air", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(IsSpawned[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_ERROR, "Your are dead. You cannot use this command");
            return 1;
        }
        if(gTeam[playerid] != TEAM_ARMY)
        {
            SendClientMessage(playerid, COLOR_ERROR, "This command can only be used by the Army");
            return 1;
        }
}
Edit 3: Sorry dunno how to use strcmp


Re: Army only command - Kitten - 23.01.2011

pawn Код:
//Airstrike command, Army only, Hoorah!
if(strcmp(cmd, "/air", true) == 0) {
if(IsPlayerConnected(playerid)) {
if(IsSpawned[playerid] == 0) {
SendClientMessage(playerid, COLOR_ERROR, "Your are dead. You cannot use this command");
return 1;
    }
if(gTeam[playerid] != TEAM_ARMY) {
SendClientMessage(playerid, COLOR_ERROR, "This command can only be used by the Army");
return 1;
}
EDIT: To late


Re: Army only command - ricardo178 - 23.01.2011

Try this:


pawn Код:
if(strcmp(cmd, "/air", true) == 0)
  {
    if(IsPlayerConnected(playerid))
    {
    if(IsSpawned[playerid] == 0) (
        SendClientMessage(playerid, COLOR_ERROR, "Your are dead. You cannot use this command");
        return 1;
    }
    if(gTeam[playerid] != TEAM_ARMY) (
        SendClientMessage(playerid, COLOR_ERROR, "This command can only be used by the Army");
        return 1;
    }



Re: Army only command - MEC - 23.01.2011

ty. its hard to see those on pawno.


Re: Army only command - ricardo178 - 23.01.2011

it work?


Re: Army only command - MEC - 23.01.2011

yes. but now i found a ton of errors from something else.
dont you love that when that happens
ty