SA-MP Forums Archive
error 017: undefined symbol "strcpy" - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: error 017: undefined symbol "strcpy" (/showthread.php?tid=594086)



error 017: undefined symbol "strcpy" - MayaEU - 13.11.2015

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);
                }
            }
        }
    }



Re: error 017: undefined symbol "strcpy" - 7days7 - 13.11.2015

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


Re: error 017: undefined symbol "strcpy" - DeathCore - 13.11.2015

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



Re: error 017: undefined symbol "strcpy" - Abagail - 13.11.2015

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.


Re: error 017: undefined symbol "strcpy" - 7days7 - 13.11.2015

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


Re: error 017: undefined symbol "strcpy" - Abagail - 13.11.2015

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.


Re: error 017: undefined symbol "strcpy" - 7days7 - 13.11.2015

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...