y_ini cmd help
#1

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)