SA-MP Forums Archive
Help me with /changename - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help me with /changename (/showthread.php?tid=180666)



Help me with /changename - Rudyy - 02.10.2010

pawn Код:
if(strcmp("/changename", cmd, true) == 0)
        {
    if(Spawned[playerid] == 0) return SendClientMessage(playerid,COLOR_ORED,"Please Spawn First!");
    if(isLogged[playerid] == 0) return SendClientMessage(playerid,COLOR_ORED,"Please Login First!");
    new tmp[256], cmdid;
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /changename [new name]");
    new file[128];
    new name[256];
    new file2[256];
        GetPlayerName(playerid,name,sizeof(name));
    format(file,sizeof(file),SERVER_USER_FILE,name);
    format(file2,sizeof(file2),SERVER_USER_FILE,tmp);
    if(fexist(file2)) return SendClientMessage(playerid,COLOR_ORED,"The name is already in use!");
    new str[256];
    format(str,sizeof(str),"* %s has changed his/her name to %s.",name,tmp);
    SetPlayerName(playerid,tmp);
    dini_Create(file2);
    dini_Remove(file);
    SendClientMessageToAll(COLOR_LIGHTGREEN,str);
             return 1;
        }
Well, it didnt remove the previous name .ini . The new name.ini is created but the old name wasnt removed. Help pls. Reply ASAP.


Re: Help me with /changename - Rudyy - 02.10.2010

Anyone knows how to fix? I need it fast.