Stuck with /me
#1

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)
Reply
#2

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.
Reply
#3

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...
Reply
#4

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.
Reply
#5

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)
Reply
#6

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.
Reply
#7

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
Reply
#8

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

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)