SA-MP Forums Archive
Stuck with /me - 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)
+--- Thread: Stuck with /me (/showthread.php?tid=292347)



Stuck with /me - iNorton - 23.10.2011

Hai there... I know when you see /me your like "Oh noez..." well here I am stuck and bare with me...

The problem is, I am using Norn's SQLlite RP Base script, did a lot of commands but I am stuck with local commands aka /me, /do & /b.

I tried a lot of /me's and nope didn't work as the script already has its own local chat implemented which is

pawn Код:
PlayerLocalMessage(15.0, playerid, string, COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
(used for IC chat)

and here is the base of it
pawn Код:
PlayerLocalMessage(Float:radi, playerid, string[],col1,col2,col3,col4,col5); // Local message
And here is my... old me from old project.

pawn Код:
CMD:me(playerid, params[])

  {
    if(!strlen(params))return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
    new str[128];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "* %s %s", str, !strlen(params));
    SendClientMessageToAll(0xFFFF00AA, str);
    return 1;
  }
And with added

pawn Код:
CMD:me(playerid, params[])

  {
    if(!strlen(params))return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
    new str[128];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "* %s %s", str, !strlen(params));
    PlayerLocalMessage(15.0, playerid, string, COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
    return 1;
  }
I get error of

pawn Код:
: error 017: undefined symbol "string"
the normal one without playerlocalmessage works but it sends /me to everyone.

(I don't wanna post it in his topic where the script belongs because I know it will be like... gtfo read the script...)
So could anyone help me figure the puzzle out?

EDIT: I have forgotten to say
pawn Код:
RemovePlayerUnderscoreString(Character[playerid][cName]));
is to get a character name (there are two types of name, master account and character name, character name is rp)


Re: Stuck with /me - .:Kaos:. - 23.10.2011

I think I see the problem, you are saving the players name as "str" and also trying to use "str" as a message. Try replacing
Код:
format(str, sizeof(str)
with
Код:
format(string, sizeof(string)
You are trying to send the message "string" but in the format it was "str". Hope this helps.


Re: Stuck with /me - iNorton - 23.10.2011

Quote:
Originally Posted by .:Kaos:.
Посмотреть сообщение
I think I see the problem, you are saving the players name as "str" and also trying to use "str" as a message. Try replacing
Код:
format(str, sizeof(str)
with
Код:
format(string, sizeof(string)
You are trying to send the message "string" but in the format it was "str". Hope this helps.
Sadly not, I just had to change string to str HOWEVER another problem accrued which is this



When ever i do /me andsometesxt in here it only shows my Master Account name not CHARACTER name so the /me have problem getting the character name from the script which is

pawn Код:
RemovePlayerUnderscoreString(Character[playerid][cName])
So this gotta get somewhere into /me command to get the name of the character and show the text

EDIT: even if I do /me it does it...


Re: Stuck with /me - JaTochNietDan - 23.10.2011

pawn Код:
format(str, sizeof(str), "* %s %s", str, !strlen(params));
This piece of code doesn't make a lot of sense, why are you trying to insert the return value of the strlen function, which is also an integer, not a string like you've specified in the format.

I think what you're looking for is more along the lines of passing the string directly in there, for example:

pawn Код:
format(str, sizeof(str), "* %s %s", str, params);
strlen is for getting the length of a string, not getting the value of a string.


Re: Stuck with /me - iNorton - 23.10.2011

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
pawn Код:
format(str, sizeof(str), "* %s %s", str, !strlen(params));
This piece of code doesn't make a lot of sense, why are you trying to insert the return value of the strlen function, which is also an integer, not a string like you've specified in the format.

I think what you're looking for is more along the lines of passing the string directly in there, for example:

pawn Код:
format(str, sizeof(str), "* %s %s", str, params);
strlen is for getting the length of a string, not getting the value of a string.
Gotta love ya man, text appears but the Master Account name is still on as I need a character name apear (aka Firstname_Lastname atm it shows only the one i provided in the screenshot)


Re: Stuck with /me - JaTochNietDan - 23.10.2011

Well looking at some more of your code it would appear that the variable that stores your characters name is:

pawn Код:
Character[playerid][cName]
So you need to do:

pawn Код:
format(str, sizeof(str), "* %s %s", Character[playerid][cName], params);
That means you can get rid of GetPlayerName also.


Re: Stuck with /me - iNorton - 23.10.2011

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
Well looking at some more of your code it would appear that the variable that stores your characters name is:

pawn Код:
Character[playerid][cName]
So you need to do:

pawn Код:
format(str, sizeof(str), "* %s %s", , Character[playerid][cName], params);
That means you can get rid of GetPlayerName also.
gives me 4 errors now...

(3250) : error 029: invalid expression, assumed zero
(3250) : warning 215: expression has no effect
(3250) : warning 215: expression has no effect
(3250) : error 001: expected token: ";", but found ")"
(3250) : error 029: invalid expression, assumed zero
(3250) : fatal error 107: too many error messages on one line

EDIT: What I think I need to do is add
pawn Код:
RemovePlayerUnderscoreString(Character[playerid][cName]));
but than ir gives me 2 or 1 error

EDIT: Got rid of errors gonna check if it works


Re: Stuck with /me - .:Kaos:. - 23.10.2011

Use this:
Код:
format(str, sizeof(str), "* %s %s", Character[playerid][cName], params);
There was an extra comma. " , "


Re: Stuck with /me - iNorton - 23.10.2011

Quote:
Originally Posted by .:Kaos:.
Посмотреть сообщение
Use this:
Код:
format(str, sizeof(str), "* %s %s", Character[playerid][cName], params);
There was an extra comma. " , "
Yea that what I have found in there

EDIT: Works