/me and /do commands PLEASE!
#1

I want /me and /do commands in RP and with range

ZCMD or anything
Reply
#2

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

Put this somewhere inyour script
pawn Код:
stock NearBy(playerid, Float:radius, string[], col1, col2, col3, col4, col5)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    new Float:ix, Float:iy, Float:iz;
    new Float:cx, Float:cy, Float:cz;
    foreach(Player, i)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
            {
                GetPlayerPos(i, ix, iy, iz);
                cx = (x - ix);
                cy = (y - iy);
                cz = (z - iz);
                if(((cx < radius/16) && (cx > -radius/16)) && ((cy < radius/16) && (cy > -radius/16)) && ((cz < radius/16) && (cz > -radius/16)))
                {
                    SendClientMessage(i, col1, string);
                }
                else if(((cx < radius/8) && (cx > -radius/8)) && ((cy < radius/8) && (cy > -radius/8)) && ((cz < radius/8) && (cz > -radius/8)))
                {
                    SendClientMessage(i, col2, string);
                }
                else if(((cx < radius/4) && (cx > -radius/4)) && ((cy < radius/4) && (cy > -radius/4)) && ((cz < radius/4) && (cz > -radius/4)))
                {
                    SendClientMessage(i, col3, string);
                }
                else if(((cx < radius/2) && (cx > -radius/2)) && ((cy < radius/2) && (cy > -radius/2)) && ((cz < radius/2) && (cz > -radius/2)))
                {
                    SendClientMessage(i, col4, string);
                }
                else if(((cx < radius) && (cx > -radius)) && ((cy < radius) && (cy > -radius)) && ((cz < radius) && (cz > -radius)))
                {
                    SendClientMessage(i, col5, string);
                }
            }
        }
    }
    return 1;
}
And these are the commands
ZCMD
If you dont have the zcmd include download it from here https://sampforum.blast.hk/showthread.php?tid=91354 and put the include in the pawno include folder and then put this on the top of your script
pawn Код:
#include <zcmd>
pawn Код:
#define COLOR_PURPLE 0xC2A2DAFF
CMD:me(playerid, params[])
{
    new string[128];
    new name[MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, name, sizeof(name));
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "You must be logged in!");
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /me [action]");
    format(string, sizeof(string), "* %s %s", name, params);
    Nearby(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
    return 1;
}

CMD:do(playerid, params[])
{
    new string[128];
    new name[MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, name, sizeof(name));
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "You must be logged in!");
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /do [action]");
    format(string, sizeof(string), "* %s (( %s ))", params, name);
    Nearby(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
    return 1;
}
Reply
#4

How can i define colours ?
Reply
#5

Quote:
Originally Posted by Le3aT
Посмотреть сообщение
How can i define colours ?
Example : (Rep Me )

Код:
#define COLOR_WHITE 0xFFFFFFAA
Reply
#6

It says define Nearby
Reply
#7

C:\Users\zero\Desktop\SAMP Server\gamemodes\Test.pwn(1081) : error 017: undefined symbol "Nearby"
C:\Users\zero\Desktop\SAMP Server\gamemodes\Test.pwn(1093) : error 017: undefined symbol "Nearby"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#8

THis is the code

#define COLOR_PURPLE 0xC2A2DAFF
CMD:me(playerid, params[])
{
new string[128];
new name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "You must be logged in!");
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /me [action]");
format(string, sizeof(string), "* %s %s", name, params);
Nearby(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}

CMD:do(playerid, params[])
{
new string[128];
new name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "You must be logged in!");
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /do [action]");
format(string, sizeof(string), "* %s (( %s ))", params, name);
Nearby(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
Reply
#9

EDIT: You need zCMD and SSCANF.

sscanf2
ZCMD


Top of script:

pawn Код:
#define COLOR_ACTION        0xC2A2DAAA
pawn Код:
CMD:me(playerid, params[])
{
    new
        string[128],
        text[100];

    if(sscanf(params, "s[100]", text))
    {
        SendClientMessage(playerid, -1, "USAGE: /me [action]");
        return 1;
    }
    else
    {
        format(string, sizeof(string), "* %s %s", GetICName(playerid), text);
        ProxDetector(30.0, playerid, string, COLOR_ACTION, COLOR_ACTION, COLOR_ACTION, COLOR_ACTION, COLOR_ACTION);
    }
    return 1;
}

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

    if(sscanf(params, "s[100]", text))
    {
        SendClientMessage(playerid, -1, "USAGE: /do [action]");
        return 1;
    }
    else
    {
        format(string, sizeof(string), "* %s (( %s ))", text, GetICName(playerid));
        ProxDetector(30.0, playerid, string, COLOR_ACTION, COLOR_ACTION, COLOR_ACTION, COLOR_ACTION, COLOR_ACTION);
    }
    return 1;
}

Replace Nearby with:

pawn Код:
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
            {
                GetPlayerPos(i, posx, posy, posz);
                tempposx = (oldposx -posx);
                tempposy = (oldposy -posy);
                tempposz = (oldposz -posz);
                if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) // If the player is within 16 meters
                {
                    SendClientMessage(i, col1, string);
                }
                else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) // within 8 meters
                {
                    SendClientMessage(i, col2, string);
                }
                else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) //4 meters
                {
                    SendClientMessage(i, col3, string);
                }
                else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) //2 meters
                {
                    SendClientMessage(i, col4, string);
                }
                else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) //1 meter
                {
                    SendClientMessage(i, col5, string);
                }
            }
            else
            {
                SendClientMessage(i, col1, string);
            }
        }
    }
    return 1;
}
Reply
#10

Sorry about that it was my fault you need to get the sscanf and foreach includes and then use
pawn Код:
#include <sscanf2>
#include <foreach>
on the top of your script
foreach: https://sampforum.blast.hk/showthread.php?tid=92679

sscanf: https://sampforum.blast.hk/showthread.php?tid=120356
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)