Clear chat command text
#1

How can i set when an admin clears the chat,that is says "Admin (name) cleared the chat" ?

oc is cc
my command:

Код:
COMMAND:oc(playerid,params[])
{
	SendAdminText(playerid, "/oc", params);
	if (APlayerData[playerid][LoggedIn] == true && APlayerData[playerid][PlayerLevel] > 1)
	{
    	for(new i = 0; i < 50; i++){
 			SendClientMessageToAll(0xFFFFFF," ");
 		}
		return 1;
	}

	return 0;
}
Reply
#2

Use

pawn Код:
// Put this in your script to avoid "undefined name" error..
new name[MAX_PLAYER_NAME], string[23 + MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));

// This is for message you want
format(string, sizeof(string), "Administrator %s used that cmd", name);
SendClientMessageToAll(0xFFFFFF,string)
Your command should look like this:
pawn Код:
COMMAND: oc(playerid,params[])
{
SendAdminText(playerid, "/oc", params);
if (APlayerData[playerid][LoggedIn] == true && APlayerData[playerid][PlayerLevel] > 1)
{
for(new i = 0; i < 50; i++){
format(string, sizeof(string), "Administrator %s used that cmd", name);
SendClientMessageToAll(0xFFFFFF,string)
}
return 1;
}

return 0;
}
Rep če sam ti pomagao haha :P
Reply
#3

When i set it like that this error pops up:

Код:
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\dutils.inc(28) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\dutils.inc(132) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\dutils.inc(172) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\dutils.inc(280) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\dutils.inc(337) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\dutils.inc(379) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\sscanf2.inc(151) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\sscanf2.inc(270) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\sscanf2.inc(270) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\sscanf2.inc(330) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\sscanf2.inc(330) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\Geo.inc(69) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\Geo.inc(78) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\Geo.inc(89) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\Geo.inc(125) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\Geo.inc(265) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\Geo.inc(433) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\GeoIP_Plugin.inc(37) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_GPS.inc(96) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_MissionsRibar.inc(10) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_MissionsRibar.inc(11) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_MissionsRibar.inc(71) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_MissionsRibar.inc(102) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_MissionsRibar.inc(112) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_MissionsRibar.inc(156) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_MissionsRibar.inc(210) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_MissionsRibar.inc(335) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_Dialogs.inc(3226) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_Dialogs.inc(3237) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_PlayerCommands.inc(670) : error 001: expected token: ";", but found "}"
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_PlayerCommands.inc(6316) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_PlayerCommands.inc(6359) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_PlayerCommands.inc(6384) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_Toll.inc(33) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\gamemodes\YT.pwn(1184) : warning 219: local variable "string" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#4

Umm remove this crap

pawn Код:
new name[MAX_PLAYER_NAME], string[23 + MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
Tell me what's up.

And copy and paste this one I forgot ";" somewhere, here is fixed.
EDIT:

pawn Код:
COMMAND: oc(playerid,params[])
{
SendAdminText(playerid, "/oc", params);
if (APlayerData[playerid][LoggedIn] == true && APlayerData[playerid][PlayerLevel] > 1)
{
for(new i = 0; i < 50; i++){
format(string, sizeof(string), "Administrator %s used that cmd", name);
SendClientMessageToAll(0xFFFFFF,string);
}
return 1;
}

return 0;
}
Reply
#5

Now it says

Код:
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_PlayerCommands.inc(667) : error 017: undefined symbol "string"
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_PlayerCommands.inc(667) : error 017: undefined symbol "string"
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_PlayerCommands.inc(667) : error 029: invalid expression, assumed zero
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_PlayerCommands.inc(667) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#6

new string[128]; - if it's to small use [256];
Reply
#7

I need to put that before the cmd or on the top of the script?
Reply
#8

pawn Код:
COMMAND: oc(playerid,params[])
{
new string[256];
SendAdminText(playerid, "/oc", params);
if (APlayerData[playerid][LoggedIn] == true && APlayerData[playerid][PlayerLevel] > 1)
{
for(new i = 0; i < 50; i++){
format(string, sizeof(string), "Administrator %s used that cmd", name);
SendClientMessageToAll(0xFFFFFF,string);
}
return 1;
}

return 0;
}
Reply
#9

No you don't put it inside your command
Reply
#10

We are getting close
Код:
C:\Users\Korisnik\Desktop\Yugoslavi Trucking v.0.3.7\include\BT_PlayerCommands.inc(668) : error 017: undefined symbol "name"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)