txd Help
#1

Hi all

here is the prob

PHP код:
Textdraw20 CreatePlayerTextDraw(playerid,546.00000022.000000"AOTD :%s"AOTD_WinnerName); 
giving this error :
[code]warning 202: number of arguments does not match definition[code]

actually i made a copy of this function to make that txd

PHP код:
if(strcmp(cmd"/aotd"true) == 0)
    {
        new 
msg[256];
        
format(msg,sizeof(msg),"[AOTD] The current Airline of the Day is {00FF00}%s {FFFFFF}with total earnings of {00FF00}$%d{FFFFFF}."AOTD_WinnerNameAOTD_FinalAmount2);
        
SendClientMessage(playeridCOLOR_WHITEmsg);
        return 
1;
    } 
Reply
#2

Quote:
Originally Posted by Shaheen
Посмотреть сообщение
Hi all

here is the prob

PHP код:
Textdraw20 CreatePlayerTextDraw(playerid,546.00000022.000000"AOTD :%s"AOTD_WinnerName); 
giving this error :
[code]warning 202: number of arguments does not match definition[code]

actually i made a copy of this function to make that txd

PHP код:
if(strcmp(cmd"/aotd"true) == 0)
    {
        new 
msg[256];
        
format(msg,sizeof(msg),"[AOTD] The current Airline of the Day is {00FF00}%s {FFFFFF}with total earnings of {00FF00}$%d{FFFFFF}."AOTD_WinnerNameAOTD_FinalAmount2);
        
SendClientMessage(playeridCOLOR_WHITEmsg);
        return 
1;
    } 
Try this and tell me

PHP код:
new AOTD_WinnerName[MAX_PLAYER_NAME],str[24];
GetPlayerName(wname,  AOTD_WinnerNamesizeofAOTD_WinnerName));
fomat(strsizeof(str), "AOTD :%s"AOTD_WinnerName); 
PHP код:
Textdraw20 CreatePlayerTextDraw(playerid,546.00000022.000000str,); 
change the "wname" which whatever fits the Winner's name in your code
Reply
#3

giving this errors:
warning 219: local variable "AOTD_WinnerName" shadows a variable at a preceding level
error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 2)
Reply
#4

Solution

CreatePlayerTextDraw does not support formatting of strings, you need to create a variable that can hold the string, then using format you can format the string with your said replacements and then put that into the CreatePlayerTextDraw

An Example:
Код:
new 
    string[ 32 ]
;

format( string, sizeof( string ), "AOTD :%s", AOTD_WinnerName );
Textdraw20 = CreatePlayerTextDraw(playerid,546.000000, 22.000000, string );
As you can see, CreatePlayerTextDraw does not support string formatting.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)