/changenick doesnt overwrite the existing file.
#4

I made this but get two errors
pawn Код:
if(strcmp(cmd,"/changenick",true)==0)
    {
        if(PlayerInfo[playerid][power] >= 10)
        {
            new tmp[128],nickid;
            new oldname[ MAX_PLAYER_NAME +9 ], newname[ MAX_PLAYER_NAME +9 ];
            new stringa[MAX_STRING];
            tmp = strtok(cmdtext,idx); // line 24752
            if(!strlen(tmp))
            {
                SendClientUsage(playerid, cmd, "[exaclty name] [new name] (case sensitive)");
                return 1;
            }
            nickid=INVALID_PLAYER_ID;
            if(IsPlayerConnected(PlayerID(tmp)))  nickid=PlayerID(tmp);
            tmp=strtok(cmdtext,idx); // line 24760
            if(!strlen(tmp))
            {
                SendClientUsage(playerid, cmd, "[exaclty name] [new name] (case sensitive)");
                return 1;
            }
            format(oldname, sizeof(oldname), "%s.dudb.sav", udb_encode(PlayerName(playerid)));//#1
            format(newname, sizeof(newname), "%s.dudb.sav", udb_encode(tmp));
            frenametextfile(oldname, newname);//#2
            SetPlayerName(playerid, tmp);//#3
            if(dini_Exists(oldname))
            {
                if(!dini_Exists(newname))
                {
                    frenametextfile(oldname,newname);
                    format(stringa,sizeof(stringa),"%s renamed in %s succesfully",oldname,newname);
                    SendClientInfo(playerid,  stringa);
                    if(IsPlayerConnected(nickid))
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "NickName Succesfully Changed :. ");
                          SetPlayerName(nickid,tmp);
                    }
                    format(stringa,sizeof(stringa),"Admin(%s) renamed %s in %s",PlayerName(playerid),oldname,newname);
                    AppendTo(adminlog,stringa);
                    return 1;
                }
                else
                {
                    format(stringa,sizeof(stringa),"%s - ACCOUNT ALREADY EXIST",newname);
                    SendClientError(playerid,   stringa);
                    return 1;
                }
            }
            else
            {
                format(stringa,sizeof(stringa),"%s, Account not found",oldname);
                SendClientError(playerid,   stringa);
                return 1;
            }
        }
        return 1;
    }
pawn Код:
(24752) : error 047: array sizes do not match, or destination array is too small
(24760) : error 047: array sizes do not match, or destination array is too small
Reply


Messages In This Thread
/changenick doesnt overwrite the existing file. - by deltapro - 24.06.2012, 14:49
Re: /changenick doesnt overwrite the existing file. - by Badger(new) - 24.06.2012, 22:11
Re: /changenick doesnt overwrite the existing file. - by Makaveli93 - 25.06.2012, 00:19
Re: /changenick doesnt overwrite the existing file. - by deltapro - 26.06.2012, 21:19
Re: /changenick doesnt overwrite the existing file. - by deltapro - 01.07.2012, 00:58

Forum Jump:


Users browsing this thread: 1 Guest(s)