SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 29/12/2011, 10:22 PM   #1
diego_p11
Big Clucker
 
Join Date: Aug 2011
Posts: 70
Reputation: 5
Default /changename /clearchat cmds

hello, could somebody say me how to do a /changename and a /clearchat cmd.
NOTE: i am giving rep for the best answer
diego_p11 is offline   Reply With Quote
Old 29/12/2011, 10:44 PM   #2
Notis123
Big Clucker
 
Join Date: Jun 2011
Posts: 156
Reputation: 12
Default Re: /changename /clearchat cmds

/Clearchat

pawn Code:
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;
}
__________________
My Works:
[FS]NAdmin
Notis123 is offline   Reply With Quote
Old 29/12/2011, 10:47 PM   #3
SpiderWalk
Gangsta
 
SpiderWalk's Avatar
 
Join Date: Apr 2010
Location: Serbia
Posts: 970
Reputation: 26
Default Re: /changename /clearchat cmds

clearchat
pawn Code:
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;
}
SpiderWalk is offline   Reply With Quote
Old 29/12/2011, 10:51 PM   #4
Notis123
Big Clucker
 
Join Date: Jun 2011
Posts: 156
Reputation: 12
Default Re: /changename /clearchat cmds

Quote:
Originally Posted by SpiderWalk View Post
clearchat
pawn Code:
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.
__________________
My Works:
[FS]NAdmin
Notis123 is offline   Reply With Quote
Old 29/12/2011, 10:52 PM   #5
SpiderWalk
Gangsta
 
SpiderWalk's Avatar
 
Join Date: Apr 2010
Location: Serbia
Posts: 970
Reputation: 26
Default Re: /changename /clearchat cmds

Changename
pawn Code:
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.");
}
SpiderWalk is offline   Reply With Quote
Old 29/12/2011, 10:56 PM   #6
Notis123
Big Clucker
 
Join Date: Jun 2011
Posts: 156
Reputation: 12
Angry Re: /changename /clearchat cmds

Quote:
Originally Posted by SpiderWalk View Post
Changename
pawn Code:
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?
__________________
My Works:
[FS]NAdmin
Notis123 is offline   Reply With Quote
Old 29/12/2011, 10:56 PM   #7
Fj0rtizFredde
Gangsta
 
Fj0rtizFredde's Avatar
 
Join Date: Jun 2008
Location: Sweden
Posts: 888
Reputation: 120
Default Re: /changename /clearchat cmds

Why do you guys make your code so big?
pawn Code:
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?
__________________
Latest crap I've made:
[Include]CleverBot - Never Be Alone Again!
Fj0rtizFredde is offline   Reply With Quote
Old 29/12/2011, 10:58 PM   #8
Notis123
Big Clucker
 
Join Date: Jun 2011
Posts: 156
Reputation: 12
Default Re: /changename /clearchat cmds

Quote:
Originally Posted by Fj0rtizFredde View Post
Why do you guys make your code so big?
pawn Code:
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.
__________________
My Works:
[FS]NAdmin
Notis123 is offline   Reply With Quote
Old 29/12/2011, 10:59 PM   #9
Amine_Mejrhirrou
Gangsta
 
Amine_Mejrhirrou's Avatar
 
Join Date: Dec 2010
Location: RAbat
Posts: 555
Reputation: 6
Default Re : /changename /clearchat cmds

Code:
for( new i = 0; i < 25; i ++ )
		   	{
      			SendClientMessageToAll( 0x33FF33AA, " " );
		      	GameTextForAll("~b~Chat cleared!", 3, 1);
		   	}
this is faster
Amine_Mejrhirrou is offline   Reply With Quote
Old 29/12/2011, 11:01 PM   #10
SpiderWalk
Gangsta
 
SpiderWalk's Avatar
 
Join Date: Apr 2010
Location: Serbia
Posts: 970
Reputation: 26
Default Re: /changename /clearchat cmds

Quote:
Originally Posted by Notis123 View Post
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!
SpiderWalk is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/clearchat? Type-R Help Archive 10 06/05/2011 03:08 PM
Clearchat CMD Linus- Help Archive 29 02/01/2011 08:29 PM
/clearchat command for admins? Face9000 Help Archive 2 19/09/2010 02:07 PM
Clearchat Ihsan_Cingisiz Help Archive 6 04/06/2010 08:58 AM
/Cd & /ClearChat _System_ Help Archive 3 07/04/2009 12:36 PM


All times are GMT. The time now is 08:42 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.