Need help for Chat commands
#2

For PM on and off,

pawn Код:
CMD:pm(playerid, params[])
{
    new str[128], target, pName[MAX_PLAYER_NAME],targetname[MAX_PLAYER_NAME];
    if(sscanf(params, "us[50]",target, str)) return SendClientMessage(playerid, 0xFFFF00AA, "SERVER:/pm [ID] [Text]");
    if(!IsPlayerConnected(target)) return SendClientMessage(playerid, 0xFFFF00AA, "SERVER:The player you're trying to PM is offline.");
    if(nopms == 0)
    {
        SendClientMessage(playerid, -1, "SERVER: The PM System is disabled!");
    }
    else if(nopms == 1)
    {
        new string[128];
        GetPlayerName(target, targetname, sizeof(targetname));
        GetPlayerName(playerid, pName, sizeof(pName));
        format(string, 128, "((PM from %s: %s))", pName, str);
        SendClientMessage(target, 0xFFFF00AA, string);
        format(string, 128, "((PM to %s: %s))", targetname, str);
        SendClientMessage(playerid,0xFFFF00AA, string);
    }
    return 1;
}

CMD:nopms(playerid, params[])
{
    new str[128];
    if(Player[playerid][Admin] <= 5) return SendClientMessage(playerid, -1, "SERVER: You're not a high enough level!");
    if(nopms == 0)
    {
        format(str, 128, "SERVER: The PM System has been enabled!");
        SendClientMessageToAll(-1,str);
        nopms = 1;
    }
    else if(nopms == 1)
    {
        format(str, 128, "SERVER: The PM System has been disabled!");
        SendClientMessageToAll(-1,str);
        nopms = 0;
    }
    return 1;
}
Make sure you put this at the top of your script

pawn Код:
new nopms = 0;
I'll edit it and add some more commands when i'm done scripting them.

----------------------------------------------------------------------------------

Here is the /me and /do.

pawn Код:
CMD:do(playerid, params[])
{
    new string[128], text, pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    if(sscanf(params, "s", text))
    {
        SendClientMessage(playerid, -1, "USAGE: /do [text]");
        return 1;
    }
    else
    {
        format(string, sizeof(string), "* %s (( %s ))", text, pName);
        ProxDetector(30, playerid, string, GREY);
    }
    return 1;
}
pawn Код:
CMD:me(playerid, params[])
{
    new str[128], pName[MAX_PLAYER_NAME], text;
    GetPlayerName(playerid, pName, sizeof(pName));
    if(sscanf(params, "s",text)) return SendClientMessage(playerid, -1, "USAGE:/me [Text]");
    format(str,128,"%s %s",pName,text);
    ProxDetector(30, playerid, str, GREY);
    return 1;
}
You'll need to add this aswell. It makes it so if the player is a certain distance away they can't see it.

pawn Код:
stock ProxDetector(Float:radi, playerid, string[],color)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInRangeOfPoint(i,radi,x,y,z))
        {
            SendClientMessage(i,color,string);
        }
    }
}
Reply


Messages In This Thread
Need help for Chat commands - by KennJie - 07.03.2014, 08:35
Re: Need help for Chat commands - by Keyhead - 07.03.2014, 08:42
Re: Need help for Chat commands - by KennJie - 07.03.2014, 08:47
Re: Need help for Chat commands - by RajatPawar - 07.03.2014, 08:50
Re: Need help for Chat commands - by Keyhead - 07.03.2014, 08:52
Re: Need help for Chat commands - by KennJie - 07.03.2014, 08:52
Re: Need help for Chat commands - by HK - 07.03.2014, 08:54
Re: Need help for Chat commands - by Keyhead - 07.03.2014, 08:56
Re: Need help for Chat commands - by Keyhead - 07.03.2014, 09:05
Re: Need help for Chat commands - by KennJie - 07.03.2014, 09:05

Forum Jump:


Users browsing this thread: 1 Guest(s)