What is wrong with my command?
#1

Hi all, i make an command /rename into french, but if the name already exist name change or i put condition id exist we don't change name.




pawn Код:
if(strcmp(cmd, "/changernom", true) == 0)
    {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        new tmpp[256];
        tmpp = strtok(cmdtext, idx);
        if(!strlen(tmpp))
        {
            SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /changernom [playerid] [nouveau nom (Prenom_Nom)]");
            return 1;
        }
        giveplayerid = strval(tmpp);
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /changernom [playerid] [nouveau nom (Prenom_Nom)]");
            return 1;
        }
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        format(string, sizeof(string), "users/%s.ini", tmp);
        if(fexist(string))
        {
            SendClientMessage(playerid, COLOR_YELLOW, "Ce pseudo existe dйjа.");
            return 1;
        }
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] >= 1337)
            {
                if(IsPlayerConnected(giveplayerid))
                {
                    new namestring = strfind(tmp, "_", true);
                    if(namestring == -1)
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /changernom [playerid] [nouveau nom (Prenom_Nom)]");
                        return 1;
                    }
                    else
                    {
                        SetPlayerName(giveplayerid, tmp);
                        format(string,sizeof(string),"users/%s.ini",giveplayer);
                        fremove(string);
                        format(string, sizeof(string), "AdmCMD: %s(%i) a changй votre nom en %s", sendername, playerid, tmp);
                        SendClientMessage(giveplayerid, COLOR_DBLUE, string);
                        format(string, sizeof(string), "AdmCMD: Vous avez changer le nom de l'id %i en %s", giveplayerid, tmp);
                        SendClientMessage(playerid, COLOR_DBLUE, string);
                        format(string, 256, "AdmWarning: %s а changй le nom de %s en %s.", sendername,giveplayer, tmp);
                        ABroadCast(COLOR_YELLOW,string,1);
                        SauvegardeCompte(playerid);
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "Ce joueur n'est pas connectй!");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "Vous n'кtes pas autorisй a utiliser cette commande!");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "Vous devez йtre connectй!");
        }
        return 1;
    }



Please help me
Reply
#2

Man use [ pawn] for PAWN codes, we can't see a shit.
And explain more please, I didn't understand anything. :/
Reply
#3

Ok, so i made this command to change player names.

I want when the name is already used it doesn't change name,

so i did this

pawn Код:
tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /changernom [playerid] [nouveau nom (Prenom_Nom)]");
            return 1;
        }
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        format(string, sizeof(string), "users/%s.ini", tmp);
        if(fexist(string))
        {
            SendClientMessage(playerid, COLOR_YELLOW, "Ce pseudo existe dйjа.");
            return 1;
        }
but when the account already exist i don't said me already exist, it change name, but normaly with the code he don't have to because account already exist
Reply
#4

Hrmmm has your GameMode got a function to check if a player account exists under a certain name?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)