SA-MP Forums Archive
Command Problems - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Command Problems (/showthread.php?tid=263562)



Command Problems - Tachibana - 22.06.2011

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!


Re: Command Problems - SILENT! - 22.06.2011

Show us your GetName function.


Re: Command Problems - Tachibana - 22.06.2011

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


Re: Command Problems - SILENT! - 22.06.2011

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;
}



Re: Command Problems - Tachibana - 22.06.2011

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.



Re: Command Problems - Tachibana - 23.06.2011

Le Bump? anyone knows the solution for this?

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


Re: Command Problems - PrawkC - 23.06.2011

Show your GetName function, You posted a function called GetNames


Re: Command Problems - Tachibana - 23.06.2011

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 :\


Re: Command Problems - Basicz - 23.06.2011

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.


Re: Command Problems - Tachibana - 23.06.2011

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.