PDA

View Full Version : /changename /clearchat cmds


diego_p11
29/12/2011, 10:22 PM
hello, could somebody say me how to do a /changename and a /clearchat cmd.
NOTE: i am giving rep for the best answer

Notis123
29/12/2011, 10:44 PM
/Clearchat


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;
}

SpiderWalk
29/12/2011, 10:47 PM
clearchat

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;
}

Notis123
29/12/2011, 10:51 PM
clearchat

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;
}


nice copy paste from your script.

SpiderWalk
29/12/2011, 10:52 PM
Changename

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.");
}

Notis123
29/12/2011, 10:56 PM
Changename

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.");
}


May i ask you something ? Why the hell i need to be near to the player to change his name?

Fj0rtizFredde
29/12/2011, 10:56 PM
Why do you guys make your code so big?

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;
}

About the "changename" do you want so every player can use it or just admins? :)

Notis123
29/12/2011, 10:58 PM
Why do you guys make your code so big?

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;
}

About the "changename" do you want so every player can use it or just admins? :)

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.

Amine_Mejrhirrou
29/12/2011, 10:59 PM
for( new i = 0; i < 25; i ++ )
{
SendClientMessageToAll( 0x33FF33AA, " " );
GameTextForAll("~b~Chat cleared!", 3, 1);
}
this is faster ;)

SpiderWalk
29/12/2011, 11:01 PM
May i ask you something ? Why the hell i need to be near to the player to change his name?

Becouse i was editing it fast!

Fj0rtizFredde
29/12/2011, 11:14 PM
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.

I know a few server's that allows every player to change their name thats why I'm asking.


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;
}

Notice: The code above is not tested but it should work. :p

Gh05t_
29/12/2011, 11:30 PM
for( new i = 0; i < 25; i ++ )
{
SendClientMessageToAll( 0x33FF33AA, " " );
GameTextForAll("~b~Chat cleared!", 3, 1);
}
this is faster ;)

The looping instruction would output content within the compound statement until it has been fulfilled.


for(new i;i<25;i++) SendClientMessageToAll(-1, " ");
GameTextForAll("~b~Chat cleared!", 3, 1);


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.

The OP hasn't specified his purpose nor intentions for use of the command, just help regarding it's creation. If the command was to be used for this purpose (admins), Fj0rtizFredde post is valid.