/rename not working
#4

PHP код:
CMD:rename(playeridparams[])
{
    if(
PlayerInfo[playerid][Level] < 6) return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
    new 
targetidnewname[MAX_PLAYER_NAME], string[128];
    if(
sscanf(params"us[24]"targetidnewname)) return SendClientMessage(playeridred"Usage: /rename [playerid] [new name]");
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid,red,"ERROR: Player is not connected");
    if(
strlen(newname) < || strlen(inputtext) > MAX_PLAYER_NAME) return SendClientMessage(playerid,red,"ERROR: Incorrect Name Length");
    if(
PlayerInfo[targetid][Level] > PlayerInfo[playerid][Level]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on higher admin level than you.");
    if(
udb_Exists(newname)) return SendClientMessage(playeridCOLOR_RED"That Name is already in use!");
    
    
SetPlayerName(targetidnewname);
    
    
// I haven't done any changes to this part because I'm not the best with Dini. I suggest you to move onto MySQL.
    /* 
    strmid(VehicleInfo[PlayerInfo[player1][vowned]][owner], tmp2, 0, strlen(tmp2), 255);
    strmid(VehicleInfo[PlayerInfo[player1][vowned2]][owner], tmp2, 0, strlen(tmp2), 255);
    strmid(VehicleInfo[PlayerInfo[player1][vowned3]][owner], tmp2, 0, strlen(tmp2), 255);
    strmid(VehicleInfo[PlayerInfo[player1][vowned4]][owner], tmp2, 0, strlen(tmp2), 255);
    strmid(VehicleInfo[PlayerInfo[player1][vowned5]][owner], tmp2, 0, strlen(tmp2), 255);
    strmid(VehicleInfo[PlayerInfo[player1][vowned6]][owner], tmp2, 0, strlen(tmp2), 255);
    strmid(VehicleInfo[PlayerInfo[player1][vowned7]][owner], tmp2, 0, strlen(tmp2), 255);
    strmid(VehicleInfo[PlayerInfo[player1][vowned8]][owner], tmp2, 0, strlen(tmp2), 255);
    new str1[256];
    new housenumber = dini_Int(str1, "Houseid");
    format(str1, sizeof(str1), "SATDM/Houses/houseid%d", housenumber);
    dini_Set(str1, "Name",tmp2);
    strmid(HouseInfo[housenumber][Name],tmp2,sizeof(tmp2),255);
    new hnowner[30];
    format(hnowner,128,"%s",HouseInfo[housenumber][Name]);
    if(strcmp(HouseInfo[housenumber][Name],DEFAULT_OWNER,false) == 0) {
        format(hnowner,128,"Not Owned");
    }
    UpdateDynamic3DTextLabelText(HouseTextInfo[housenumber],0xFF0000FF,hnowner);
    new BizID = PlayerInfo[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));
    */
    
    
if(playerid == targetid)
        
format(stringsizeof(string), "You have changed your name to %s"newname);
    else
        
format(stringsizeof(string), "Administrator %s has set your Name to %s"pName(playerid), newname);
    
SendClientMessage(targetidredstring);
    return 
1;

Reply


Messages In This Thread
/rename not working - by Filbert - 20.05.2018, 08:32
Re: /rename not working - by Filbert - 20.05.2018, 09:24
Re: /rename not working - by Shadow0707 - 20.05.2018, 10:53
Re: /rename not working - by kovac - 20.05.2018, 12:49
Re: /rename not working - by Filbert - 20.05.2018, 13:34
Re: /rename not working - by Filbert - 20.05.2018, 14:16
Re: /rename not working - by CodeStyle175 - 20.05.2018, 15:14
Re: /rename not working - by nbx2000 - 20.05.2018, 16:15
Re: /rename not working - by Filbert - 21.05.2018, 04:00

Forum Jump:


Users browsing this thread: 2 Guest(s)