SA-MP Forums Archive
Plss help Near by msg +REP - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Plss help Near by msg +REP (/showthread.php?tid=546125)



Plss help Near by msg +REP - C0olp1x - 13.11.2014

I'm new to pawno , and i tryed to make this commands but i ***** it up ... !
So plsss help i give +REP



Thank u !


Re: Plss help Near by msg +REP - LaPiMoNsTeR - 13.11.2014

What command you want make ?


Re: Plss help Near by msg +REP - C0olp1x - 13.11.2014

I want to make /me,/do and near by message.. I made /me and /do but its SendClientMessageToAll, but i want only people around me see that ...


Re: Plss help Near by msg +REP - LaPiMoNsTeR - 13.11.2014

Install sscanf.
Code for /me
pawn Код:
if(strcmp(cmdtext, "/me", true) == 0)
{
    new msg [145], name[MAX_PLAYER_NAME], str [145];
    GetPlayerName(playerid, name, sizeof(name));
    if(sscanf(cmdtext, "z[144]", msg))
    {
        SendClientMessage(playerid, -1, "Usage : /me [action]");
    }
    else
    {
        format(str, sizeof(str), "%s %s", name, msg);
        SendClientMessageToAll(-1, str) ;
    }
    return 1;
}
Code for /do
pawn Код:
if(strcmp(cmdtext, "/do", true) == 0)
{
    new msg[145], str [145], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name , sizeof(name));
    if(sscanf(cmdtext, "z[144]", msg))
    {
        SendClientMessage(playerid, -1, "Usage : /do [action]");
    }
    else
    {
        format(str, sizeof(str), "%s (( %s ))", msg, name);
        SendClientMessageToAll(-1, str);
    }
    return 1;
}



Re: Plss help Near by msg +REP - C0olp1x - 13.11.2014

4 errors ...


Re: Plss help Near by msg +REP - Banana_Ghost - 13.11.2014

Try this. Also get sscanf from the link inside of the code.
What this code basically does is checks if the player is connected, if the player is in range of the other player, etc.
pawn Код:
#include <a_samp>
//Included In Main Server Includes
#include <sscanf>
//https://sampforum.blast.hk/showthread.php?tid=120356 - sscanf



public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/me", cmdtext, true, 3) == 0)
    {
        new chat[256],str1[128],Float:X,Float:Y,Float:Z,playername[MAX_PLAYER_NAME];
        if(sscanf(cmdtext, "s[128]", chat)) return SendClientMessage(playerid, -1, "USAGE: /me [text]");
        else
        {
            GetPlayerPos(playerid,X,Y,Z);
            GetPlayerName(playerid,playername,sizeof(playername));
            format(str1,sizeof(str1),"%s (%d): %s",playername,playerid,chat);
            for(new i; i<MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(IsPlayerInRangeOfPoint(i,15,X,Y,Z))
                    {
                        SendClientMessage(i,-1,str1);
                    }
                }
            }
        }
        return 1;
    }
    return 0;
}



Re: Plss help Near by msg +REP - LaPiMoNsTeR - 13.11.2014

Give me the error. ( sorry, i'm on my iPad )