dini rename
#1

Hey guyz i again got problem with this rename cmd well it was y ini but some how i convert few things to dini
but there is one line which idk how to do in dini and also correct the cmd if there is something wrong plz

PHP код:
CMD:changename(playerid,params[]){
    if(
PlayerInfo[playerid][Level] >= || IsPlayerAdmin(playerid)){
        new 
Index;
        new 
tmp[256];  tmp  strtok(params,Index);
        new 
tmp2[256]; tmp2 strtok(params,Index);
        if(
isnull(tmp) || isnull(tmp2)) return SendClientMessage(playeridred"Usage: /changename [PlayerID] [NewName]");
        new 
player1 strval(tmp);
        new 
length strlen(tmp2);
        new 
string[128];
        if(
udb_Exists(PlayerName2(tmp2))) return SendClientMessage(playeridCOLOR_RED"That Name is already in use!");  //error 035: argument type mismatch (argument 1)
        
if(length || length MAX_PLAYER_NAME) return SendClientMessage(playerid,red,"ERROR: Incorrect Name Length");
        if(
PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
        return 
SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(
IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
        {
            
strmid(VehicleInfo[PlayerInfo[player1][vowned]][owner], tmp20strlen(tmp2), 255);
            
strmid(VehicleInfo[PlayerInfo[player1][vowned2]][owner], tmp20strlen(tmp2), 255);
            
strmid(VehicleInfo[PlayerInfo[player1][vowned3]][owner], tmp20strlen(tmp2), 255);
            
strmid(VehicleInfo[PlayerInfo[player1][vowned4]][owner], tmp20strlen(tmp2), 255);
            
strmid(VehicleInfo[PlayerInfo[player1][vowned5]][owner], tmp20strlen(tmp2), 255);
            
strmid(VehicleInfo[PlayerInfo[player1][vowned6]][owner], tmp20strlen(tmp2), 255);
            
strmid(VehicleInfo[PlayerInfo[player1][vowned7]][owner], tmp20strlen(tmp2), 255);
            
strmid(VehicleInfo[PlayerInfo[player1][vowned8]][owner], tmp20strlen(tmp2), 255);
            new 
str1[256];
            new 
housenumber dini_Int(str1"Houseid");
            
format(str1sizeof(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 PlayerInfo[player1][bowned];
            
strmid(BizInfo[BizID][owner], tmp20strlen(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)); // error 017: undefined symbol "DOF2_RenameFile"
            
SetPlayerName(player1tmp2);
            
CMDMessageToAdmins(playerid,"ChangeName");
            
format(stringsizeof(string), "|- You have set \"%s's\" Name to \"%s\" -|"PlayerName2(player1), tmp2);
            
SendClientMessage(playerid,blue,string);
            if(
player1 != playerid)
            {
                
format(string,sizeof(string),"|- Administrator \"%s\" has set your Name to \"%s\" -|"pName(playerid), tmp2);
                
SendClientMessage(player1,blue,string);
            }
               return 
OnPlayerConnect(player1);
          } else return 
SendClientMessage(playerid,red,"ERROR: Player is not connected");
    } else return 
SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");

those two errors are added after lines
Reply
#2

Change this
Код:
        if(udb_Exists(PlayerName2(tmp2))) return SendClientMessage(playerid, COLOR_RED, "That Name is already in use!");  //error 035: argument type mismatch (argument 1)
to this
PHP код:
        if(udb_Exists(mp2)) return SendClientMessage(playeridCOLOR_RED"That Name is already in use!");  //error 035: argument type mismatch (argument 1) 
and you missing DOF2 include [ Download ]
Reply
#3

ty jlalt but cant i make it without dof2 ?
Reply
#4

Quote:
Originally Posted by Miller007
Посмотреть сообщение
ty jlalt but cant i make it without dof2 ?
you can by these functions:

fopen
fread
fwrite
fclose
fremove
Reply
#5

For manipulation of the archives with file functions is very simple.

Principals functions:

fexists:
Quote:

fexists(FileName);

fopen:
Quote:

fopen(FileName);

with params:
Read only
Quote:

fopen(FileName, io_read);

Write only
Quote:

fopen(FileName, io_write);

Append only
Quote:

fopen(FileName, io_append);

Read e Write only (use loop in this function)
Quote:

fopen(FileName, io_readwrite);

fread:
Quote:

fread(FileName, String);

with loop:
Quote:

for(new i; i < fread(FileName, String); i ++) printf(String);

fwrite:
Quote:

fwrite(FileName, String);

fclose:
Quote:

fclose(FileName);

fremove:
Quote:

fremove(FileName);

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)