Local chat, /b /do /me
#1

Hello, I've got a small question, could someone help me with this?
I need commands like /b /me /do, I was searching whole the samp forum and internet but coulnd not find something good. I'm still using strcmp.

Thank you in advance, aVc.
Reply
#2

Well for a command processor ZCMD. They are easily converted.
Reply
#3

Quote:

Well for a command processor ZCMD. They are easily converted.

Well, then I'll use ZCMD.
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=470093
Reply
#5

chatcmds.fs which was included in one of my previous releases.

pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>

public OnPlayerText(playerid, text[])
{
    new string[128];
   
    format(string, sizeof (string), "%s says: %s", GetPlayerRPName(playerid), text);
    SendNearbyMessage(playerid, 0xDBDBDBFF, string, 5.0);

    return false;
}

CMD:pm(playerid, params[])
{
    new str[128], text[128], targetid;
 
    if(sscanf(params, "us[128]", targetid, text)) return SendClientMessage(playerid, -1, "Usage: /pm [player] [text]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "Usage: Player isn't connected!");

    format(str, sizeof(str), "PM To %s (%d): %s", GetPlayerRPName(targetid), targetid, text);
    SendClientMessage(playerid, 0xE0E800FF, str);
 
    format(str, sizeof(str), "PM From %s (%d): %s", GetPlayerRPName(playerid), playerid, text);
    SendClientMessage(targetid, 0xE8C900FF, str);
 
    return true;
}
 
CMD:privmsg(playerid, params[]) return cmd_pm(playerid, params);
 
CMD:ooc(playerid, params[])
{
    new text[128], string[128];

    if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "Usage: /o(oc) [text]");

    format(string, sizeof(string), "(( [%d] %s: %s ))", playerid, GetPlayerRPName(playerid), text);
    SendClientMessageToAll(-1, string);

    return true;
}

CMD:o(playerid, params[]) return cmd_ooc(playerid, params);

CMD:b(playerid, params[])
{
    new text[128], string[128];

    if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "Usage: /b [text]");

    format(string, sizeof(string), "(( [%d] %s: %s ))", playerid, GetPlayerRPName(playerid), text);
    SendNearbyMessage(playerid, 0xB3B3B3FF, string, 5.0);

    return true;
}
 
CMD:low(playerid, params[])
{
    new text[128], string[128];

    if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "Usage: /low [text]");

    format(string, sizeof(string), "%s says [low]: %s", GetPlayerRPName(playerid), text);
    SendNearbyMessage(playerid, 0xA3A3A3FF, string, 2.0);

    return true;
}
 
CMD:shout(playerid, params[])
{
    new text[128], string[128];

    if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "Usage: /s(hout) [text]");

    format(string, sizeof(string), "%s shouts: %s", GetPlayerRPName(playerid), text);
    SendNearbyMessage(playerid, -1, string, 9.0);

    return true;
}

CMD:s(playerid, params[]) return cmd_shout(playerid, params);
 
CMD:me(playerid, params[])
{
    new text[128], string[128];

    if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "Usage: /me [action]");

    format(string, sizeof(string), "%s %s", GetPlayerRPName(playerid), text);
    SendNearbyMessage(playerid, 0xC2A2DAAA, string, 6.0);

    return true;
}
 
CMD:mes(playerid, params[])
{
    new text[128], string[128];

    if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "Usage: /mes [action]");

    format(string, sizeof(string), "%s's %s", GetPlayerRPName(playerid), text);
    SendNearbyMessage(playerid, 0xC2A2DAAA, string, 6.0);

    return true;
}
 
CMD:do(playerid, params[])
{
    new text[128], string[128];

    if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "Usage: /do [action]");

    format(string, sizeof(string), "%s (( %s ))", text, GetPlayerRPName(playerid));
    SendNearbyMessage(playerid, 0xC2A2DAAA, string, 6.0);

    return true;
}

stock SendNearbyMessage(playerid, color, string[], Float: range)
{
    new Float: cX, Float: cY, Float: cZ;
    GetPlayerPos(playerid, cX, cY, cZ);

    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if(IsPlayerInRangeOfPoint(i, range, cX, cY, cZ))
        {
            SendClientMessage(i, color, string);
        }
    }

    return true;
}

stock GetPlayerRPName(playerid)
{
    new RPName[MAX_PLAYER_NAME], i_pos;
    GetPlayerName(playerid, RPName, MAX_PLAYER_NAME);

    while((i_pos = strfind(RPName, "_", false, i_pos)) != -1)
        RPName[i_pos] = ' ';

    return RPName;
}
Reply
#6

Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)