Help with commands.
#1

1. How do i make a command like /me? so i would do like "/me noms on potato chips." and it says *Whatcha noms on potato chips.

2. How do i make a command that when i type /fu it acts like i sayed Fuck you. So it would do "Whatcha: Fuck You" just like if i typed it?

3. How do i make a /givemoney command like /givemoney playerid amount? And when i send it it says for example "$500 given to Whatcha" and to the person who receives it it says for example "Bimbo gave you $500"

I use the normal strcmp or whatever its called.
Reply
#2

Anyone?
Reply
#3

I suggest you open and examine the lvdm script. We all started somewhere.
Reply
#4

I know you said you use the normal command processor, but I don't know how to do all the shit required with it:

pawn Код:
#define COLOR_RED 0xA10000AA
#define COLOR_WHITE 0xFFFFFFAA

native sscanf(const data[], const format[], {Float,_}:...);

CMD:givemoney(playerid, params[])
{
    new Float:Pos[3], id, amount, string[128];
    if(sscanf(params, "ud", id, amount))
        return SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /givemoney [nick/id] [amount]");
    if(id == INVALID_PLAYER_ID)
        return SendClientMessage(playerid, COLOR_RED, "ERROR: That player is not connected!");
    GetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
    if(!IsPlayerInRangeOfPoint(playerid, 10.0, Pos[0], Pos[1], Pos[2]))
        return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not near that player!");

    new pName[MAX_PLAYER_NAME], iName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    GetPlayerName(id, iName, sizeof(iName));

    GivePlayerMoney(id, amount);
    GivePlayerMoney(playerid, -amount);
    format(string, sizeof(string), "%s(%d) has given you $%d!", pName, playerid, amount):
    SendClientMessage(playerid, COLOR_WHITE, string);
    format(string, sizeof(string), "You have given %s(%d) $%d!", iName, id, amount);
    SendClientMessage(id, COLOR_WHITE, string);
    return 1;
}

CMD:me(playerid, params[])
{
    new string[128], action[95], pName[MAX_PLAYER_NAME];
    if(sscanf(params, "s[95]", action))
        return SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /me [action]");
    if(strlen(message) > 95)
        return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid Action Length!");

    GetPlayerName(playerid, pName, sizeof(pName));

    format(string, sizeof(string), "* %s(%d) %s", pName, playerid, action);
    SendClientMessageToAll(COLOR_WHITE, string);
    return 1;
}

CMD:fu(playerid, params[]
{
    #pragma unused params
    SendPlayerMessageToAll(playerid, "Fuck You!");
    return 1;
}
Reply
#5

it does not recognize message


C:\Users\ET183105\Desktop\New folder\ServerFinal\gamemodes\1.pwn(1885) : error 017: undefined symbol "message"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#6

This line in the /me command:
pawn Код:
new string[128], action[95], pName[MAX_PLAYER_NAME];
Needs to be:
pawn Код:
new string[128], action[95], pName[MAX_PLAYER_NAME], message[96];
Should fix it.
Reply
#7

No. It should be this:

pawn Код:
CMD:me(playerid, params[])
{
    new string[128], action[95], pName[MAX_PLAYER_NAME];
    if(sscanf(params, "s[95]", action))
        return SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /me [action]");
    if(strlen(action) > 95)
        return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid Action Length!");

    GetPlayerName(playerid, pName, sizeof(pName));

    format(string, sizeof(string), "* %s(%d) %s", pName, playerid, action);
    SendClientMessageToAll(COLOR_WHITE, string);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)