29.12.2011, 21:22
hello, could somebody say me how to do a /changename and a /clearchat cmd.
NOTE: i am giving rep for the best answer
NOTE: i am giving rep for the best answer
CMD:clearchat(playerid, params[])
{
if(!IsPlayerAdmin(playerid) return SendClientMessage(playerid,COLOR_HERE,"You need to be RCON Admin to use this command");
SendClientMessageToAll,COLOR_HERE," ");
SendClientMessageToAll,COLOR_HERE," ");
SendClientMessageToAll,COLOR_HERE," ");
SendClientMessageToAll,COLOR_HERE," ");
SendClientMessageToAll,COLOR_HERE," ");
SendClientMessageToAll,COLOR_HERE," ");
SendClientMessageToAll,COLOR_HERE," ");
SendClientMessageToAll,COLOR_HERE," ");
SendClientMessageToAll,COLOR_HERE," ");
SendClientMessageToAll,COLOR_HERE," ");
SendClientMessageToAll,COLOR_HERE," ");
SendClientMessageToAll,COLOR_HERE," ");
SendClientMessageToAll,COLOR_HERE," ");
SendClientMessageToAll,COLOR_HERE," ");
SendClientMessageToAll,COLOR_HERE," ");
SendClientMessageToAll,COLOR_HERE," ");
SendClientMessageToAll,COLOR_HERE," ");
SendClientMessageToAll,COLOR_HERE," ");
return 1;
}
COMMAND:clearchat(playerid, params[])
{
if(PlayerInfo[playerid][pAdminLevel] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use this command.");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,"");
SendClientMessageToAll(0xFFFFFFFF,""embed_blue"Valley Gamming TDM has cleared chat");
return 1;
}
clearchat
pawn Код:
|
CMD:changename(playerid, params[])
{
if(PlayerInfo[playerid][pAdminLevel] >=1)
{
new id;
if(!sscanf(params, "u", id))
{
if(IsPlayerConnected(id))
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X,Y,Z);
if(IsPlayerInRangeOfPoint(id, 20.0, X,Y,Z))
{
new string[64];
new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME],newname[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(id, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "Name have been changed by %s", name);
SendClientMessage(id, 0xD8D8D8FF, string);
format(string, sizeof(string), "You changed name: %s", PlayerName);
SendClientMessage(playerid, 0xD8D8D8FF, string);
format(newname, sizeof(newname), "%s", PlayerName);
SetPlayerName(playerid,newname);
return 1;
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "You Are Not Near The Player.");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "Player Is Not Conected.");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /changename [PlayerId/PartOfName] [new name]");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "You are not allowed to use this command.");
}
Changename
pawn Код:
|
CMD:clearchat(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1, "You are not an admin!");
for(new chat = 0; chat <= 50; chat++) SendClientMessageToAll(-1, " ");
SendClientMessageToAll(-1, "An admin cleared the chat!");
return 1;
}
Why do you guys make your code so big?
pawn Код:
|
OMFG then every play would change another player name without being admin duuuuuuuuuh
Mastermids those days No he want it for admins only as Normal people do. |
CMD:changename(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You are not an admin!");
new pID, pOldName[MAX_PLAYER_NAME], pNewName[MAX_PLAYER_NAME], string[128];
if(sscanf(params, "us[24]", pID, pNewName)) return SendClientMessage(playerid,-1, "Usage: /changename ID NewName");
GetPlayerName(pID,pOldName,sizeof(pOldName));
SetPlayerName(pID,pNewName);
format(string, sizeof(string), "You have set %s(%d) name to: %s", pOldName, pID, pNewName);
SendClientMessage(playerid, -1, string);
return 1;
}