SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Scripting Help (https://forum.sa-mp.com/forumdisplay.php?f=12)
-   -   /changename /clearchat cmds (https://forum.sa-mp.com/showthread.php?t=307275)

diego_p11 29/12/2011 10:22 PM

/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

Notis123 29/12/2011 10:44 PM

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

SpiderWalk 29/12/2011 10:47 PM

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

Notis123 29/12/2011 10:51 PM

Re: /changename /clearchat cmds
 
Quote:

Originally Posted by SpiderWalk (Post 1598871)
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.

SpiderWalk 29/12/2011 10:52 PM

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

Notis123 29/12/2011 10:56 PM

Re: /changename /clearchat cmds
 
Quote:

Originally Posted by SpiderWalk (Post 1598879)
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?

Fj0rtizFredde 29/12/2011 10:56 PM

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? :)

Notis123 29/12/2011 10:58 PM

Re: /changename /clearchat cmds
 
Quote:

Originally Posted by Fj0rtizFredde (Post 1598889)
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.

Amine_Mejrhirrou 29/12/2011 10:59 PM

Re : /changename /clearchat cmds
 
Code:

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

Re: /changename /clearchat cmds
 
Quote:

Originally Posted by Notis123 (Post 1598886)
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!


All times are GMT. The time now is 02:06 PM.

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