If PlayerName exist
#4

What is the bug now?

Secondly the above code will be like this:

pawn Код:
CMD:changename(playerid, params[])
{
    new string[128],
        newname[MAX_PLAYER_NAME],
        oldname[MAX_PLAYER_NAME],
        location[254],
        id;
    if(pData[playerid][Login] == 0) return SendClientMessage(playerid, COLOR_RED, "*** Please login first! ***");
    if(pData[playerid][Admin] < 3) return SendClientMessage(playerid, COLOR_RED, "*** You are not Junior Administrator ***");
    if(sscanf(params, "us[24]", id, newname)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /changename [playerid] [newname]");
    format(location, 254, pPath, newname);
    format(oldname,  24, "%s", dini_Get(DataPath(id), "Name"));
 if(newname, oldname, true, 34) return SendClientMessage(playerid, COLOR_RED, "*** You cannot change the old name to new name! ***");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "*** Player not connected ***");
    if(pData[playerid][Admin] < pData[id][Admin]) return SendClientMessage(playerid, COLOR_RED, "*** You cannot change name higher administrator! ***");
         if(dini_Exists(DataPath(playerid))) return SendClientMessage(playerid, COLOR_RED, "*** That player name exists! ***");

    if(!dini_Exists(DataPath(playerid)))
    {
        format(string, sizeof(string), "Administrator %s(%d) has change %s name to %s(%d)", GetpName(playerid), playerid, GetpName(id), newname, id);
        SendClientMessageToAll(COLOR_GREEN, string);
        format(string, sizeof(string), "*** You change %s name to %s(%d)", GetpName(id), newname, id);
        SendClientMessage(playerid, COLOR_GREEN, string);
        format(string, sizeof(string), "*** Administrator %s(%d) has change your name to %s", GetpName(playerid), playerid, newname);
        SendClientMessage(id, COLOR_GREEN, string);
        pData[id][Pass] = dini_Int(DataPath(id), "Password");
        pData[id][NoPM] = dini_Int(DataPath(id), "NoPM");
        pData[id][Banned] = dini_Int(DataPath(id), "Ban");
        new banreason[92];
        format(banreason, 92, "%s", dini_Get(DataPath(id), "Reason"));
        new banby[24];
        format(banby, 24, "%s", dini_Get(DataPath(id), "BanBy"));
        pData[id][Admin] = dini_Int(DataPath(id), "Admin");
        pData[id][VIP] = dini_Int(DataPath(id), "VIP");
        pData[id][Score] = dini_Int(DataPath(id), "Score");
        pData[id][Cash] = dini_Int(DataPath(id), "Cash");
        pData[id][Freeze] = dini_Int(DataPath(id), "Freeze");
        pData[id][Deaths] = dini_Int(DataPath(id), "Deaths");
        pData[id][Kills] = dini_Int(DataPath(id), "Kills");
        dini_Remove(DataPath(id));
        dini_Create(location);
        dini_Set(location, "Name", newname);
        dini_Set(location, "IP", IP);
        dini_IntSet(location, "Password", pData[id][Pass]);
        dini_IntSet(location, "Ban", pData[id][Banned]);
        dini_Set(location, "Reason", banreason);
        dini_Set(location, "BanBy", banby);
        dini_IntSet(location, "Admin", pData[id][Admin]);
        dini_IntSet(location, "VIP", pData[id][VIP]);
        dini_IntSet(location, "Score", pData[id][Score]);
        dini_IntSet(location, "Cash", pData[id][Cash]);
        dini_IntSet(location, "Freeze", pData[id][Freeze]);
        dini_IntSet(location, "Deaths", pData[id][Deaths]);
        dini_IntSet(location, "Kills", pData[id][Kills]);
        SetPlayerName(id, newname);
    }
   
    return 1;
}
Reply


Messages In This Thread
If PlayerName exist - by JaKe Elite - 13.05.2012, 02:08
Re: If PlayerName exist - by Ballu Miaa - 13.05.2012, 03:39
Re: If PlayerName exist - by JaKe Elite - 13.05.2012, 03:58
Re: If PlayerName exist - by Ballu Miaa - 13.05.2012, 04:03
Re: If PlayerName exist - by JaKe Elite - 13.05.2012, 04:07
Re: If PlayerName exist - by Ballu Miaa - 13.05.2012, 04:08
Re: If PlayerName exist - by JaKe Elite - 13.05.2012, 04:15
Re: If PlayerName exist - by Ballu Miaa - 13.05.2012, 04:17
Re: If PlayerName exist - by JaKe Elite - 13.05.2012, 04:24
Re: If PlayerName exist - by Ballu Miaa - 13.05.2012, 04:31

Forum Jump:


Users browsing this thread: 1 Guest(s)