Clearchat command?
#1

Код:
CMD:cc(pid, params[])
}
	#pragma unused params
	for(new cc = 0; cc < 250; cc++) SCMToAll(COLOR_WHITE," ");
	format(string, sizeof(string), " The chat has been cleared by {FF0000}%s, name);
	SCMToAll(COLOR_WHITE, string);
}
What's wrong with it?
Код:
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(125) : error 029: invalid expression, assumed zero
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(125 -- 127) : warning 215: expression has no effect
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(127) : error 001: expected token: ";", but found "for"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#2

new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
Reply
#3

look xD
Код:
CMD:cc(pid, params[])
}
	#pragma unused params
	for(new cc = 0; cc < 250; cc++) SCMToAll(COLOR_WHITE," ");
	format(string, sizeof(string), " The chat has been cleared by {FF0000}%s, name);
	SCMToAll(COLOR_WHITE, string);
}
Reply
#4

Why not keep it simple?

Код:
CMD:cc(pid, params[])
{
	#pragma unused params
	for(new cc = 0; cc < 250; cc++)
	{
		SCMToAll(COLOR_WHITE, " ");
	}

	new name[MAX_PLAYER_NAME + 1];
	GetPlayerName(playerid, name, sizeof(name));
	format(string, sizeof(string), "The chat has been cleared by {FF0000}%s", name);
	SCMToAll(COLOR_WHITE, string);
}
You were using first bracket wrong way around and you've missed quote mark after string formatting.
Reply
#5

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
Why not keep it simple?

Код:
CMD:cc(pid, params[])
{
	#pragma unused params
	for(new cc = 0; cc < 250; cc++)
	{
		SCMToAll(COLOR_WHITE, " ");
	}

	new name[MAX_PLAYER_NAME + 1];
	GetPlayerName(playerid, name, sizeof(name));
	format(string, sizeof(string), "The chat has been cleared by {FF0000}%s", name);
	SCMToAll(COLOR_WHITE, string);
}
You were using first bracket wrong way around and you've missed quote mark after string formatting.
thanks.
How do I make it so pAdmin >= 3 does not get their chat cleared?
also this command to be available from pAdmin >= 1
Reply
#6

Quote:
Originally Posted by JXF
Посмотреть сообщение
thanks.
How do I make it so pAdmin >= 3 does not get their chat cleared?
also this command to be available from pAdmin >= 1
If(playerinfo[pAdmin] < 1) return SCM(-1, playerid, " A1+ Only");

Add that after pragma code / underneath CMD:clearchat
Reply
#7

PHP код:
CMD:cc(pidparams[])
{
    
#pragma unused params
    
for(new 0MAX_PLAYERSi++) {
       if(!
IsPlayerConnected(i) || IsPlayerAdmin(i)) continue;
       for(new 
cc 0cc 250cc++)
       {
           
SendClientMessage(iCOLOR_WHITE" ");
       }
    }
    new 
name[MAX_PLAYER_NAME 1];
    
GetPlayerName(playeridnamesizeof(name));
    
format(stringsizeof(string), "The chat has been cleared by {FF0000}%s"name);
    
SCMToAll(COLOR_WHITEstring);

change IsPlayerAdmin With your admin check, example : pInfo[i][Admin] >= 3
Reply
#8

Like this
Код:
CMD:cc(pid, params[])
{
	#pragma unused params
        if(Playerinfo[pAdmin] == 0) return SCM(playerid,-1,"Only admins with level 1 or higher can use this command.");
        if(Playerinfo[pAdmin] < 3)
        {
	for(new cc = 0; cc < 250; cc++)
	{
		SCMToAll(COLOR_WHITE, " ");
	}

	new name[MAX_PLAYER_NAME + 1];
	GetPlayerName(playerid, name, sizeof(name));
	format(string, sizeof(string), "The chat has been cleared by {FF0000}%s", name);
	SCMToAll(COLOR_WHITE, string);
        }
}
Reply
#9

Just a question, which "string" are you formatting? please tell me it's not global cuz that would make so many many problems for you. I recommend using local variables when not needed like this string.
Reply
#10

Quote:
Originally Posted by PrO.GameR
Посмотреть сообщение
Just a question, which "string" are you formatting? please tell me it's not global cuz that would make so many many problems for you. I recommend using local variables when not needed like this string.
it is not global.
I put:

new name[MAX_PLAYER_NAME + 1], string[128]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)