Command Problems
#1

Commands in my script that I added are /me /do /b however when player use them thats what they get:



here is a pawn code of these three cmds

pawn Код:
}
CMD:me(playerid, params[])
{
    if(isnull(params))
        return SendClientMessage(playerid, COLOR_GREY, "SYNTAX:/me [action]");

    new string[128];
    format(string, sizeof(string), "* %s %s", GetName(playerid), params);
    SendNearbyMessage(playerid, COLOR_ME, string);
    return 1;
}

CMD:do(playerid, params[])
{
    if(isnull(params))
        return SendClientMessage(playerid, COLOR_GREY, "SYNTAX:/do [enviornment]");

    new string[128];
    format(string, sizeof(string), "%s (( %s ))", params, GetName(playerid));
    SendNearbyMessage(playerid, COLOR_ME, string);
    return 1;
}
CMD:b(playerid, params[])
{
    if(isnull(params))
        return SendClientMessage(playerid, COLOR_GREY, "SYNTAX:/b [message]");
    if(strlen(params) > 90)
        return SendClientMessage(playerid, COLOR_RED1, "ERROR: Your message cannot be longer than 90 characters.");

    new string[128];
    format(string, sizeof(string), "(( %s(%d): %s ))", GetName(playerid), playerid, params);
    SendNearbyMessage(playerid, COLOR_GREY, string);
    return 1;
}
I have got ProxDetector working fine, local chat is made, Im a newbie in scripting so Im sorry about these problems I post around :\

Thank you very much if you will look and help me out!
Reply
#2

Show us your GetName function.
Reply
#3

Quote:
Originally Posted by SILENT!
Посмотреть сообщение
Show us your GetName function.
So that could be the problem? i have searched around the script and I couldnt find it >.<!

EDIT: I have added it now and still not working:

pawn Код:
stock GetNames(playerid, ...)
{
  new names[64], pnames[MAX_PLAYER_NAME], num;
  for(new i; i<numargs(); i++)
  {
            if(IsPlayerConnected(getarg(i)))
        {
          num++;
          GetPlayerName(getarg(i), pnames, MAX_PLAYER_NAME);
          format(names, sizeof(names), "Number %d: [ID:%i] Name: %s",num,getarg(i),pnames);
          SendClientMessage(playerid,0xDA635CFF,names);
        }
            else continue;
  }
}
something like that Im 99% its totally wrong tho
Reply
#4

Try:

pawn Код:
CMD:me(playerid, params[])
{
    if(isnull(params))
        return SendClientMessage(playerid, COLOR_GREY, "SYNTAX:/me [action]");

    new string[128], name;
    GetPlayerName(playerid,name,sizeof(name));
    format(string, sizeof(string), "* %s %s", name, params);
    SendNearbyMessage(playerid, COLOR_ME, string);
    return 1;
}

CMD:do(playerid, params[])
{
    if(isnull(params))
        return SendClientMessage(playerid, COLOR_GREY, "SYNTAX:/do [enviornment]");

    new string[128], name;
    GetPlayerName(playerid,name,sizeof(name));
    format(string, sizeof(string), "%s (( %s ))", params, name);
    SendNearbyMessage(playerid, COLOR_ME, string);
    return 1;
}
CMD:b(playerid, params[])
{
    if(isnull(params))
        return SendClientMessage(playerid, COLOR_GREY, "SYNTAX:/b [message]");
    if(strlen(params) > 90)
        return SendClientMessage(playerid, COLOR_RED1, "ERROR: Your message cannot be longer than 90 characters.");

    new string[128], name;
    GetPlayerName(playerid,name,sizeof(name))
    format(string, sizeof(string), "(( %s(%d): %s ))", name, playerid, params);
    SendNearbyMessage(playerid, COLOR_GREY, string);
    return 1;
}
Reply
#5

Quote:
Originally Posted by SILENT!
Посмотреть сообщение
Try:

pawn Код:
CMD:me(playerid, params[])
{
    if(isnull(params))
        return SendClientMessage(playerid, COLOR_GREY, "SYNTAX:/me [action]");

    new string[128], name;
    GetPlayerName(playerid,name,sizeof(name));
    format(string, sizeof(string), "* %s %s", name, params);
    SendNearbyMessage(playerid, COLOR_ME, string);
    return 1;
}

CMD:do(playerid, params[])
{
    if(isnull(params))
        return SendClientMessage(playerid, COLOR_GREY, "SYNTAX:/do [enviornment]");

    new string[128], name;
    GetPlayerName(playerid,name,sizeof(name));
    format(string, sizeof(string), "%s (( %s ))", params, name);
    SendNearbyMessage(playerid, COLOR_ME, string);
    return 1;
}
CMD:b(playerid, params[])
{
    if(isnull(params))
        return SendClientMessage(playerid, COLOR_GREY, "SYNTAX:/b [message]");
    if(strlen(params) > 90)
        return SendClientMessage(playerid, COLOR_RED1, "ERROR: Your message cannot be longer than 90 characters.");

    new string[128], name;
    GetPlayerName(playerid,name,sizeof(name))
    format(string, sizeof(string), "(( %s(%d): %s ))", name, playerid, params);
    SendNearbyMessage(playerid, COLOR_GREY, string);
    return 1;
}
Gives 9 errors when adding this one
pawn Код:
gamemodes\TC-RP1.pwn(677) : error 035: argument type mismatch (argument 2)
gamemodes\TC-RP1.pwn(679) : error 017: undefined symbol "SendNearbyMessage"
gamemodes\TC-RP1.pwn(689) : error 035: argument type mismatch (argument 2)
gamemodes\TC-RP1.pwn(689) : error 035: argument type mismatch (argument 2)
gamemodes\TC-RP1.pwn(691) : error 017: undefined symbol "SendNearbyMessage"
gamemodes\TC-RP1.pwn(702) : error 035: argument type mismatch (argument 2)
gamemodes\TC-RP1.pwn(702) : error 035: argument type mismatch (argument 2)
gamemodes\TC-RP1.pwn(704) : error 017: undefined symbol "SendNearbyMessage"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


9 Errors.
Reply
#6

Le Bump? anyone knows the solution for this?

Because prox detector is totally fine as OOC and local chat is working perfectly...
Reply
#7

Show your GetName function, You posted a function called GetNames
Reply
#8

Quote:
Originally Posted by PrawkC
Посмотреть сообщение
Show your GetName function, You posted a function called GetNames
pawn Код:
stock GetNames(playerid, ...)
{
  new names[64], pnames[MAX_PLAYER_NAME], num;
  for(new i; i<numargs(); i++)
  {
            if(IsPlayerConnected(getarg(i)))
        {
          num++;
          GetPlayerName(getarg(i), pnames, MAX_PLAYER_NAME);
          format(names, sizeof(names), "Number %d: [ID:%i] Name: %s",num,getarg(i),pnames);
          SendClientMessage(playerid,0xDA635CFF,names);
        }
            else continue;
  }
}
But I am sure it is wrong I just dont know if it is a problem not or wth :\
Reply
#9

pawn Код:
stock GetName( playerid )
{
    new
        pName[ 24 ]
    ;

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

CMD:me(playerid, params[])
{
    if(isnull(params))
        return SendClientMessage(playerid, COLOR_GREY, "SYNTAX:/me [action]");

    new string[128];
    format(string, sizeof(string), "* %s %s", GetName(playerid), params);
    SendNearbyMessage(playerid, COLOR_ME, string);
    return 1;
}
Should works, about "undefined symbol: SendNearbyMessage", you didn't have the function.
Reply
#10

Quote:
Originally Posted by Basicz
Посмотреть сообщение
pawn Код:
stock GetName( playerid )
{
    new
        pName[ 24 ]
    ;

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

CMD:me(playerid, params[])
{
    if(isnull(params))
        return SendClientMessage(playerid, COLOR_GREY, "SYNTAX:/me [action]");

    new string[128];
    format(string, sizeof(string), "* %s %s", GetName(playerid), params);
    SendNearbyMessage(playerid, COLOR_ME, string);
    return 1;
}
Should works, about "undefined symbol: SendNearbyMessage", you didn't have the function.
pawn Код:
: warning 219: local variable "pName" shadows a variable at a preceding level
: warning 219: local variable "pName" shadows a variable at a preceding level
: warning 219: local variable "pName" shadows a variable at a preceding level
: warning 219: local variable "pName" shadows a variable at a preceding level
: warning 219: local variable "pName" shadows a variable at a preceding level
: warning 219: local variable "pName" shadows a variable at a preceding level
: error 001: expected token: "-identifier-", but found "("
: error 010: invalid function or declaration
: warning 203: symbol is never used: "pName"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
When adding this, This is what I get.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)