Not sure what the issue is..
#1

Not sure why I'm getting these errors..


Код:
C:\Users\Odysseus\Documents\SAMP\Akthar Deathmatch\gamemodes\atd.pwn(460) : error 001: expected token: "]", but found "-identifier-"
C:\Users\Odysseus\Documents\SAMP\Akthar Deathmatch\gamemodes\atd.pwn(460) : warning 215: expression has no effect
C:\Users\Odysseus\Documents\SAMP\Akthar Deathmatch\gamemodes\atd.pwn(460) : error 001: expected token: ";", but found "]"
C:\Users\Odysseus\Documents\SAMP\Akthar Deathmatch\gamemodes\atd.pwn(460) : error 029: invalid expression, assumed zero
C:\Users\Odysseus\Documents\SAMP\Akthar Deathmatch\gamemodes\atd.pwn(460) : fatal error 107: too many error messages on one line

Script:


pawn Код:
if(dialogid == DIALOG_TNAME)
    {
        if(response)
        {
            new TID, String[128];
            TID = pInfo[playerid][tEdit];
            format(tData[playerid][Name], sizeof(tData[playerid][Name]), inputtext );
            format(String, sizeof(String), "You have created the name %s (%d)",tData[TID][Name]);
            SendClientMessage(playerid, COLOR_GREY, String);
            ShowPlayerDialog(playerid, DIALOG_TCOLOR, DIALOG_STYLE_INPUT,"Create Team - Team Color", "Type the desired team color using Hex Code:", "Create","Cancel");
        }
        else
        {
            pInfo[playerid][tEdit] = 0;
            SendClientMessage(playerid, COLOR_GREY,"Team Name Modifier canceled.");
        }
        return 0;
    }
Reply
#2

pawn Код:
sizeof(tData[playerid][Name])
You cannot do that. Use the size of the index "Name" (from the enum) instead.

EDIT:
But format is slow, so use strcat (strcpy):

pawn Код:
#define strcpy(%0,%1,%2) strcat((%0[0] = '\0', %0), %1, %2)
and you can do:
pawn Код:
strcpy(tData[playerid][Name], inputtext, 50); // 50 is an example, change it to the size you use
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
sizeof(tData[playerid][Name])
You cannot do that. Use the size of the index "Name" (from the enum) instead.
Worked perfectly, Thanks.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)