PDA

View Full Version : Strcmd Help


sanplayer
02/03/2012, 04:53 PM
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

aco_SRBIJA
02/03/2012, 04:56 PM
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;
}

Champ
02/03/2012, 05:00 PM
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.");
}
//

sanplayer
02/03/2012, 05:03 PM
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

aco_SRBIJA
02/03/2012, 05:08 PM
hez code gonna make you 26 errors. Unmatched opening bracket.

sanplayer
02/03/2012, 05:08 PM
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.

sanplayer
02/03/2012, 05:13 PM
I got


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?

Chrillzen
02/03/2012, 05:36 PM
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;

}
}