CMD:announce( playerid, params[ ] )
{
if ( GetAdminLevel( playerid ) < 3 ) // Here you put your admin levels defined.
return 1;
new temptext[ 128 ]; // Here we define the first parameter in the command, for like /announce "TEXT" - text is the parameter
if ( sscanf( params, "s[128]", temptext ) ) // Here we check if there`s any parameter ... if not, it`ll SendClientMessage to admin that uses /announce
return SendClientMessage( playerid, -1, "Usage: /(ann)ounce <Text>");
new String[ 128 ];
format( String, sizeof String, "Admin announce: %s", temptext ); // Here`s the output of the command. This message we`ll be send to all players
SendClientMessageToAll( -1, String );
return 1;
}
CMD:ann( playerid, params[] ) return cmd_announce( playerid,params ); // With this, you can use /ann instead of /announce
CMD:loadfs(playerid,params[])
{
if(PInfo[playerid][Level] >=5 || IsPlayerAdmin(playerid))
{
new fs, string[128];
if(sscanf(params,"s",fs)) return SendClientMessage(playerid,RED,"Usage: /loadfs [FilterScript Name]");
else {
format(string,sizeof(string),"%s",fs);
SendRconCommand(string);
}
}
else return SendClientMessage(playerid,RED,"You are not a high enough level to use this command");
return 1;
}
I`ll help you with the second problem. Here`s a /announce command, in ZCMD:
pawn Код:
|
Just a question: Why "temptext" (or it could be any other names?) and why "128" in String[ 128 ]; ?
But thanks to you both, I'll test that asap. |
0
1
2
3
CMD:ann(playerid, params[]) {
// Replace 'IsPlayerAdmin(playerid)' with a check for your scripts admin levels.
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFF00AA, "You are not an admin or do not retain the sufficient power to execute this command.");
if(isnull(params)) return SendClientMessage(playerid, 0xFFFF00AA, "Usage: /ann [announcement]");
SendClientMessageToAll(0xFFFF00AA, params);
return 1;
}
CMD:startfs(playerid, params[]) {
// Replace 'IsPlayerAdmin(playerid)' with a check for your scripts admin levels.
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFF00AA, "You are not an admin or do not retain the sufficient power to execute this command.");
if(isnull(params)) return SendClientMessage(playerid, 0xFFFF00AA, "Usage: /startfs [filterscript]");
new
szCommand[128]; // Arbitrary size as I'm unsure of the size of your FS names...
format(szCommand, sizeof(szCommand), "loadfs %s", params);
SendRconCommand(szCommand);
return 1;
}
stock SendClientMessageToAdmins(color, params[]) {
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && GetPVarInt(i, "Level") >= 1) {
SendClientMessage(i, color, params);
}
}
return 1;
}
CMD:startfs(playerid, params[]) {
// Replace 'IsPlayerAdmin(playerid)' with a check for your scripts admin levels.
if( GetPVarInt( playerid, "Level" ) < 3) return SendClientMessage(playerid, 0xFFFF00AA, "You are not an admin or do not retain the sufficient power to execute this command.");
if(isnull(params)) return SendClientMessage(playerid, 0xFFFF00AA, "Usage: /startfs [filterscript]");
new
szCommand[128]; // Arbitrary size as I'm unsure of the size of your FS names...
format(szCommand, sizeof(szCommand), "loadfs %s", params);
SendRconCommand(szCommand);
new string[128];
format(string,128,"Ressource '%s' has been started.",params);
SendClientMessageToAdmins(RED,string);
return 1;
}
C:\Documents and Settings\Anthony Dupont\Bureau\KrazyParadise\filterscripts\regandadminsystem.pwn(830) : error 035: argument type mismatch (argument 1)
SendClientMessageToAdmins(RED,string);