/o command by me not working well!
#1

Hey guys, my /o command isn't working very well....

If i just type /o it could say USAGE: /o [Text] and it show: [OOC] Ricardo_Manuel say: z
amd if i type /o test it show:[OOC] Ricardo_Manuel say: z and after show UnknownCommand

Please help me!
Reply
#2

Probably you have used %d in stead of %s or your string is too low
Reply
#3

show the code so we can understand better your proplem
Reply
#4

Your sscanf code could be fucked. (messed up)
Reply
#5

Code here(o forgeted on first post...
pawn Код:
COMMAND:o(playerid, params[])
{
    new text;
    if(!sscanf(params, "z", text))
    {
        new name[MAX_PLAYER_NAME], string[64];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "[OOC]%s say: %z ", name, text);
        SendClientMessageToAll(0xFFFFFF, string);
        return 1;
    }
    else return SendClientMessage(playerid, 0xFFFFFF, "USAGE: /o [Text]");
}
Reply
#6

Use %s in stead of %z

pawn Код:
COMMAND:o(playerid, params[])
{
    new text;
    if(!sscanf(params, "s", text))
    {
        new name[MAX_PLAYER_NAME], string[64];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "[OOC]%s say: %s ", name, text);
        SendClientMessageToAll(0xFFFFFF, string);
        return 1;
    }
    else return SendClientMessage(playerid, 0xFFFFFF, "USAGE: /o [Text]");
}
Reply
#7

pawn Код:
COMMAND:o(playerid, params[])
{
    new text[127];
    if(!sscanf(params, "s", text))
    {
        new name[MAX_PLAYER_NAME], string[64];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "[OOC]%s say: %s ", name, text);
        SendClientMessageToAll(0xFFFFFF, string);
        return 1;
    }
    else return SendClientMessage(playerid, 0xFFFFFF, "USAGE: /o [Text]");
}
Reply
#8

Quote:
Originally Posted by [ISS]jumbo
Посмотреть сообщение
pawn Код:
COMMAND:o(playerid, params[])
{
    new text[127];
    if(!sscanf(params, "s", text))
    {
        new name[MAX_PLAYER_NAME], string[64];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "[OOC]%s say: %s ", name, text);
        SendClientMessageToAll(0xFFFFFF, string);
        return 1;
    }
    else return SendClientMessage(playerid, 0xFFFFFF, "USAGE: /o [Text]");
}
If he uses the plugin, an array size must be added near the 's' .
pawn Код:
if ( !sscanf( params, "s[127]", text ) )
Reply
#9

pawn Код:
COMMAND:o(playerid, params[])
{
    new text[129];
    if(!sscanf(params, "s[128]", text))//z is optional string so null string is still valid
    {
        new name[MAX_PLAYER_NAME];//To save memory, you don't need to use another string.
        GetPlayerName(playerid, name, sizeof(name));
        format(text, sizeof(text), "[OOC]%s say: %s ", name, text);//There's no %z in format.Only in sscanf.
        //Use the same string here is okay
        SendClientMessageToAll(0xFFFFFF, string);//Do you need white colour or cyan?The colour is 32-bit here.
        return 1;
    }
    else return SendClientMessage(playerid, 0xFFFFFF, "USAGE: /o [Text]");//Same as above
}
Reply
#10

Quote:
Originally Posted by leong124
Посмотреть сообщение
pawn Код:
COMMAND:o(playerid, params[])
{
    new text[129];
    if(!sscanf(params, "s[128]", text))//z is optional string so null string is still valid
    {
        new name[MAX_PLAYER_NAME], string[64];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "[OOC]%s say: %s ", name, text);//There's no %z in format.Only in sscanf.
        SendClientMessageToAll(0xFFFFFF, string);//Do you need white colour or cyan?The colour is 32-bit here.
        return 1;
    }
    else return SendClientMessage(playerid, 0xFFFFFF, "USAGE: /o [Text]");//Same as above
}
If the Alpha isn't set it will automatically be set to FF. as far as i know.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)