Plss help Near by msg +REP
#1

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



Thank u !
Reply
#2

What command you want make ?
Reply
#3

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 ...
Reply
#4

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;
}
Reply
#5

4 errors ...
Reply
#6

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

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


Forum Jump:


Users browsing this thread: 4 Guest(s)