And stuck again with this
#1

Similar to my old post on /me now on /do ... I do have to say local chats are my worse sections when doing script, normal cmds is normal for me...

So here is the script

pawn Код:
COMMAND:do(playerid, params[])
{
    new text[128], string[128];
    if(sscanf(params, "s[127]", text)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: /do [Environment]");
    format(string, sizeof(string), "** %s (( %s ))", text, Character[playerid][cName], params);
    PlayerLocalMessage(15.0, playerid, string, COLOR_MEDIUMPURPLE,COLOR_MEDIUMPURPLE,COLOR_MEDIUMPURPLE,COLOR_MEDIUMPURPLE,COLOR_MEDIUMPURPLE);
    return 1;
}
And what happens is that when ever you do /do test it does [SYNTAX]: /do [Environment] no text beside that appears.

Did I missed anything in the /do script? Or made wrong?
Reply
#2

/do is the exact same as /me, just a different syntax message and different message that comes out when you type it..

edit: try if(!sscanf(params, "s[127]", text))
Reply
#3

I don't really understand why you need to use sscanf in this code, there is no need to use sscanf here. It is for unformatting code, not checking if a string is not empty. Here is a fixed example of this code:

pawn Код:
COMMAND:do(playerid, params[])
{
    if(!strlen(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: /do [Environment]");
    new string[128];
    format(string, sizeof(string), "** %s (( %s ))", Character[playerid][cName], params);
    PlayerLocalMessage(15.0, playerid, string, COLOR_MEDIUMPURPLE,COLOR_MEDIUMPURPLE,COLOR_MEDIUMPURPLE,COLOR_MEDIUMPURPLE,COLOR_MEDIUMPURPLE);
    return 1;
}
Reply
#4

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
I don't really understand why you need to use sscanf in this code, there is no need to use sscanf here. It is for unformatting code, not checking if a string is not empty. Here is a fixed example of this code:

pawn Код:
COMMAND:do(playerid, params[])
{
    if(!strlen(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: /do [Environment]");
    new string[128];
    format(string, sizeof(string), "** %s (( %s ))", Character[playerid][cName], params);
    PlayerLocalMessage(15.0, playerid, string, COLOR_MEDIUMPURPLE,COLOR_MEDIUMPURPLE,COLOR_MEDIUMPURPLE,COLOR_MEDIUMPURPLE,COLOR_MEDIUMPURPLE);
    return 1;
}
People say you gotta use sscanf with zcmd :\ oh well thank you...
Reply
#5

Quote:
Originally Posted by iNorton
Посмотреть сообщение
People say you gotta use sscanf with zcmd :\ oh well thank you...
Well they are wrong, you only use sscanf when it is needed, if you're using multiple parameters, then you should use sscanf to split and "unformat" the string, as that is the nature of what sscanf is made for.
Reply
#6

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
Well they are wrong, you only use sscanf when it is needed, if you're using multiple parameters, then you should use sscanf to split and "unformat" the string, as that is the nature of what sscanf is made for.
Now I get it, done /b aka local ooc without a problem now owe u a lot man!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)