error 017: undefined symbol "strcpy"
#1

Anyone who know what is wrong? rep+

i get this error
pawn Код:
error 017: undefined symbol "strcpy"
pawn Код:
if (dialogid == DIALOG_NEWGOWNER)
    {
        if (response)
        {
            new ostring[MAX_PLAYER_NAME], astring[128];
            strcpy(ostring, gowner[gsaveid[playerid]]);
            new plid;
            if (sscanf(inputtext, "u", plid)) SendClientMessage(playerid, -1, ""COL_RED"Invalid Player ID/Name");
            else if (plid == INVALID_PLAYER_ID) SendClientMessage(playerid, -1, ""COL_RED"Invalid Player");
            else
            {
                new pname[MAX_PLAYER_NAME];
                GetPlayerName(plid, pname, MAX_PLAYER_NAME);
                if(!strcmp(gowner[gsaveid[playerid]], pname))
                {
                    format(astring, 128, ""COL_WHITE"%s is already the owner of the gate %i", pname, gsaveid[playerid]);
                    SendClientMessage(playerid, -1, astring);
                }
                else
                {
                    new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
                    INI_SetTag(gatefile, "data");
                    INI_WriteString(gatefile, "owner", pname);
                    INI_Close(gatefile);
                    if (!strcmp(ostring, "none")) format(astring, 128, ""COL_GREEN"You have set %s to be the owner of the gate %i.", pname, gsaveid[playerid]);
                    else format(astring, 128, ""COL_GREEN"%s is no longer the owner of the gate %i. %s is the new owner", ostring, gsaveid[playerid], pname);
                    SendClientMessage(playerid, -1, astring);
                }
            }
        }
    }
Reply
#2

I'm first time see this function, you're put one variable to another? If yes you can use
Quote:

format(ostring, sizeof(ostring), "%s", gowner[gsaveid[playerid]]);

or
Quote:

strins(ostring, gowner[gsaveid[playerid]], 0);

https://sampwiki.blast.hk/wiki/Strins
Reply
#3

Код:
stock strcpy(dest[], const source[], maxlength=sizeof dest) 
return strcat((dest[0] = EOS, dest), source, maxlength);
Reply
#4

Quote:
Originally Posted by 7days7
Посмотреть сообщение
format(ostring, sizeof(ostring), "%s", gowner[gsaveid[playerid]]);
I don't know why you think this is a good example. It will work, yes however it is considerably slow compared to other methods and therefore is not recommended.
Reply
#5

I'm not ever sayed that is the good example. Just example for fix problem nothing more and yea you're right.
Reply
#6

Quote:
Originally Posted by 7days7
Посмотреть сообщение
I'm not ever sayed that is the good example. Just example for fix problem nothing more and yea you're right.
When you are giving help you should try to give the best answer. I am sure this has come up numerous times throughout the forums where format is a bad thing to use for copying strings.
Reply
#7

Look, I'm the begginer. I see many topics without help (for example: my topic) and when I can help* I'm doing this. Don't blame me...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)