SA-MP Forums Archive
Help DOF2 to Dini - 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: Help DOF2 to Dini (/showthread.php?tid=505140)



Help DOF2 to Dini - [IND]Crazy - 07.04.2014

help me to convert DOF2 to dini .

pawn Код:
CMD:changename(playerid,params[])
{
    if(AccInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
    {
        new Index;
        new tmp[256];  tmp  = strtok(params,Index);
        new tmp2[256]; tmp2 = strtok(params,Index);
        if(isnull(tmp) || isnull(tmp2)) return
        Inter_SendClientMessage(playerid, LIGHTBLUE2, "Usage: /changename [PlayerID] [NewName]") &&
        Inter_SendClientMessage(playerid, orange, "Function: Will Permanently Change Name of specified player!");
        new player1 = strval(tmp);
        new length = strlen(tmp2);
        new string[128];
        if(DOF2_FileExists(DOF2_File(tmp2))) return Inter_SendClientMessage(playerid, COLOR_RED, "That Name is already in use!");
        if(length < 3 || length > MAX_PLAYER_NAME) return
        Inter_SendClientMessage(playerid,red,"ERROR: Incorrect Name Length");
        if(AccInfo[player1][Level] == ServerInfo[MaxAdminLevel] && AccInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
        return Inter_SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
        {
            strmid(VehicleInfo[AccInfo[player1][vowned]][owner], tmp2, 0, strlen(tmp2), 255);
            strmid(VehicleInfo[AccInfo[player1][vowned2]][owner], tmp2, 0, strlen(tmp2), 255);
            strmid(VehicleInfo[AccInfo[player1][vowned3]][owner], tmp2, 0, strlen(tmp2), 255);
            strmid(VehicleInfo[AccInfo[player1][vowned4]][owner], tmp2, 0, strlen(tmp2), 255);
            strmid(VehicleInfo[AccInfo[player1][vowned5]][owner], tmp2, 0, strlen(tmp2), 255);

                        new str1[256];
            new housenumber = DOF2_GetInt(DOF2_File(tmp2), "Houseid");
            format(str1, sizeof(str1), "SATDM/Houses/houseid%d", housenumber);
            dini_Set(str1, "Name",tmp2);
            strmid(hInfo[housenumber][Name],tmp2,sizeof(tmp2),255);

            new hnowner[30];
            format(hnowner,128,"%s",hInfo[housenumber][Name]);
            if(strcmp(hInfo[housenumber][Name],DEFAULT_OWNER,false) == 0) {
                format(hnowner,128,"Not Owned");
            }
            UpdateDynamic3DTextLabelText(hTextInfo[housenumber],0xFF0000FF,hnowner);
           
            new BizID = AccInfo[player1][bowned];
            strmid(BizInfo[BizID][owner], tmp2, 0, strlen(tmp2), 255);
            new bizowner[30];
            format(bizowner,128,"%s",BizInfo[BizID][owner]);
            if(strcmp(BizInfo[BizID][owner],DEFAULT_OWNER,false) == 0) {
                format(bizowner,128,"Not Owned");
            }
            UpdateDynamic3DTextLabelText(bizTextInfo[BizID],0xFF0000FF,bizowner);

            DOF2_RenameFile(DOF2_File(PlayerName2(player1)), DOF2_File(tmp2));
            SetPlayerName(player1, tmp2);
            SendCommandToAdmins(playerid,"SetName");
            format(string, sizeof(string), "|- You have set \"%s's\" Name to \"%s\" -|", PlayerName2(player1), tmp2);
            Inter_SendClientMessage(playerid,BlueMsg,string);
            if(player1 != playerid)
            {
                format(string,sizeof(string),"|- Administrator \"%s\" has set your Name to \"%s\" -|", pName(playerid), tmp2);
                Inter_SendClientMessage(player1,blue,string);
            }
            return OnPlayerConnect(player1);
        }
        else return ErrorMessages(playerid, 2);
    }
    else return ErrorMessages(playerid, 1);
}
Rep ++ for helped


Re: Help DOF2 to Dini - ]Rafaellos[ - 07.04.2014

Why not converting DOF to Y_INI?


Re: Help DOF2 to Dini - iBanner - 07.04.2014

@rafaellos yeah you're right! Y_INI is much better than DINI. You should probably teach him how. LOL