[HELP] Update3DTextLabelText
#6

Okay, first off, you can't do this:
pawn Код:
array[index][cell] = string;
You need to use format:
pawn Код:
format(array, array_size, input);
format(Businesses[Player[playerid][Business]][bName], 16, Name); // in your case
Second of all, you looked for an optional string but you didn't use it at all.

I suggest you to use sscanf ONLY if you have to look for more than two parameters in a command.

Example:
/mycommand [playerid] // 1 parameter
/mycommand [playerid] [something] // 2 parameters
/mycommand [playerid] [something] [something else] // more than 2 params

If you don't have a second parameter, use "params" as an everything.

pawn Код:
strval(params) // same as sscanf(params, "d", variable);
format(string, sizeof(string), "%s", params); // instead of using sscanf + new non-used string
I think you're using zcmd, this might be useful for you:
pawn Код:
command(businessname, playerid, params[])
{
    new
        string[57];
       
    if(isnull(params)) return SendClientMessage(playerid, WHITE, "SYNTAX: /businessname [new name]");
    else if(strlen(params) < 2 || strelen(params) > 15) return SendClientMessage(playerid, WHITE, "The name has to be between 2 and 15 characters long.");
    else if(strfind(params, "~", true) != -1) return SendClientMessage(playerid, WHITE, "You may not use the '~' character.");
    format(string, sizeof(string), "You have changed your business name to %s.", params);
    SendClientMessage(playerid, WHITE, string);
    SaveBusiness(Player[playerid][Business]);
    Update3DTextLabelText(BIZ1, ORANGE, params);
    Update3DTextLabelText(BIZ2, ORANGE, params);
    Update3DTextLabelText(BIZ3, ORANGE, params);
    format(Businesses[Player[playerid][Business]][bName], 16, params);
    return 1;
}
By the way: If you decide to use sscanf, this is the way:
pawn Код:
if(sscanf(params, "s", Name)) // I'm not sure about the "s", it is "s[size]" in sscanf 2.0...
{
    // syntax message
}
Reply


Messages In This Thread
[HELP] Update3DTextLabelText - by Camacorn - 30.10.2010, 04:01
Re: [HELP] Update3DTextLabelText - by Miguel - 30.10.2010, 04:20
Re: [HELP] Update3DTextLabelText - by Camacorn - 30.10.2010, 04:23
Re: [HELP] Update3DTextLabelText - by Miguel - 30.10.2010, 04:30
Re: [HELP] Update3DTextLabelText - by Camacorn - 30.10.2010, 04:37
Re: [HELP] Update3DTextLabelText - by Miguel - 30.10.2010, 04:51
Re: [HELP] Update3DTextLabelText - by Camacorn - 30.10.2010, 05:16
Re: [HELP] Update3DTextLabelText - by Camacorn - 30.10.2010, 11:36
Re: [HELP] Update3DTextLabelText - by Miguel - 30.10.2010, 14:28

Forum Jump:


Users browsing this thread: 2 Guest(s)