SA-MP Forums Archive
Strcmd Help - 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: Strcmd Help (/showthread.php?tid=322518)



Strcmd Help - sanplayer - 02.03.2012

I have not edited it from /mycommand yet but.

It says "SERVER: Unknown Command"

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext))
	{
		if(!IsPlayerAdmin(playerid))
		{
		    SendClientMessage(playerid, 0xFF0000, "You are not authorised to use this command.");
		}
		else
		{
			SendClientMessage(playerid, 0xFFFF00, "{FFFFFF}RCON ADMIN: {FF0000}INSERT COMMANDS");
		}

	}
	return 1;
}
Also how do I change it from

"SERVER: Unknown command"

To

"[RpF Clan] Command Unreconised.

And Script in a faction


Re: Strcmd Help - aco_SRBIJA - 02.03.2012

try with

if (!strcmp("/mycommand", cmdtext))

And about second, there it is:

public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if( !success ) return SendClientMessage( playerid,-1,"Command does not exist! Check /commands!");
return 1;
}


Re: Strcmd Help - Champ - 02.03.2012

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext))
    {
        if(!IsPlayerAdmin(playerid))
        {
            SendClientMessage(playerid, 0xFF0000, "You are not authorised to use this command.");
        }
        else
        {
            SendClientMessage(playerid, 0xFFFF00, "{FFFFFF}RCON ADMIN: {FF0000}INSERT COMMANDS");
        }

    }
    return 1;
}


    return SendClientMessage(playerid,COLOR_Robbers,"[RpF Clan] Command Unreconised.");
}
//


Re: Strcmd Help - sanplayer - 02.03.2012

thanks for the command error but to make the command work failed.

How do I turn it into ZCMD?

EDIT: CHAMP I WILL TRY YOURS


Re: Strcmd Help - aco_SRBIJA - 02.03.2012

hez code gonna make you 26 errors. Unmatched opening bracket.


Re: Strcmd Help - sanplayer - 02.03.2012

Quote:
Originally Posted by Champ
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext))
    {
        if(!IsPlayerAdmin(playerid))
        {
            SendClientMessage(playerid, 0xFF0000, "You are not authorised to use this command.");
        }
        else
        {
            SendClientMessage(playerid, 0xFFFF00, "{FFFFFF}RCON ADMIN: {FF0000}INSERT COMMANDS");
        }

    }
    return 1;
}


    return SendClientMessage(playerid,COLOR_Robbers,"[RpF Clan] Command Unreconised.");
}
//
Failed.


Re: Strcmd Help - sanplayer - 02.03.2012

I got

pawn Код:
COMMAND:mycommand(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
    {
        SendClientMessage(playerid, 0xFF0000, "You are not authorised to use this command.");
    }
    else
    {
        SendClientMessage(playerid, 0xFFFF00, "{FFFFFF}RCON ADMIN: {FF0000}INSERT COMMANDS");
    }
}
It shows now but it says underneath unknown command. Maybe a small coding error.

A fix for that is?


Re: Strcmd Help - Chrillzen - 02.03.2012

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext))
	{
		if(!IsPlayerAdmin(playerid))
		{
		    SendClientMessage(playerid, 0xFF0000, "You are not authorised to use this command.");
		}
		else
		{
			SendClientMessage(playerid, 0xFFFF00, "{FFFFFF}RCON ADMIN: {FF0000}INSERT COMMANDS");
		}
                return 1;

	}
}