SA-MP Forums Archive
y_ini cmd help - 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: y_ini cmd help (/showthread.php?tid=476293)



y_ini cmd help - Pepsicola123 - 17.11.2013

Hello everyone, I need some help doing some cmds and I need to know how to make a IC chat for a RP base server Thanks you the cmd I need is /me and /do thats all.


Re: y_ini cmd help - NeMoK - 17.11.2013

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

#define SCM SendClientMessage
#define ACTIONRANGE 10 //metres
//COMMAND ME ACTION
CMD:me(playerid, params[])
{
    new string[350], action[350];
    if(sscanf(params, "s[350]", action))
    {
        SCM(playerid, COLOR_ERROR, "Usage: /me [action]");
        return 1;
    }
    else
    {
        new pName[32];
GetPlayerName(playerid,pName,32);
        format(string, sizeof(string), "%s %s", pName, action);
        ProxDetector(ACTIONRANGE, playerid, string, COLOR_ACTION);
    }
    return 1;
}

//COMMAND DO ACTION
CMD:do(playerid, params[])
{
    new
        string[128],
        action[100];
    if(sscanf(params, "s[100]", action))
    {
        SCM(playerid, COLOR_ERROR, "Usage: /do [action]");
        return 1;
    }
    else
    {
new pName[32];
GetPlayerName(playerid,pName,32);
        format(string, sizeof(string), "* %s * (( %s ))", params, pName);
        ProxDetector(ACTIONRANGE, playerid, string, COLOR_ACTION);
    }
    return 1;
}

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))
        {
            SCM(i,color,string);
        }
    }
}



Re: y_ini cmd help - Pepsicola123 - 17.11.2013

Quote:
Originally Posted by NeMoK
Посмотреть сообщение
pawn Код:
#include zcmd
#include sscanf2

#define SCM SendClientMessage
#define ACTIONRANGE 10 //metres
//COMMAND ME ACTION
CMD:me(playerid, params[])
{
    new string[350], action[350];
    if(sscanf(params, "s[350]", action))
    {
        SCM(playerid, COLOR_ERROR, "Usage: /me [action]");
        return 1;
    }
    else
    {
        new pName[32];
GetPlayerName(playerid,pName,32);
        format(string, sizeof(string), "%s %s", pName, action);
        ProxDetector(ACTIONRANGE, playerid, string, COLOR_ACTION);
    }
    return 1;
}

//COMMAND DO ACTION
CMD:do(playerid, params[])
{
    new
        string[128],
        action[100];
    if(sscanf(params, "s[100]", action))
    {
        SCM(playerid, COLOR_ERROR, "Usage: /do [action]");
        return 1;
    }
    else
    {
new pName[32];
GetPlayerName(playerid,pName,32);
        format(string, sizeof(string), "* %s * (( %s ))", params, pName);
        ProxDetector(ACTIONRANGE, playerid, string, COLOR_ACTION);
    }
    return 1;
}

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))
        {
            SCM(i,color,string);
        }
    }
}
Didnt work.