lil help here
#1

If he changes the name thats registered in the database, i want it to send a message saying that name is already registered!, but it wont it just says name successfuly changed. Why?
pawn Код:
if(dialogid == 4383)
    {
        new newname[MAX_PLAYER_NAME],oldname[MAX_PLAYER_NAME];
        if(!response) return 0;
        if(sscanf(inputtext,"s",newname)) return SendClientMessage(playerid,red,"Please put in a username");
        GetPlayerName(playerid,oldname,sizeof(oldname));
        format(Query,sizeof(Query),"SELECT FROM `Accounts` WHERE `Username` = '%s'",newname);
        mysql_query(Query);
        mysql_store_result();
        if(mysql_num_rows() >= 1)
        {
            SendClientMessage(playerid,red,"ERROR: "lgrey"This username is already registered!");
            return 0;
        }
        else
        {
            format(Query,sizeof(Query),"UPDATE `Accounts` SET `Username` = '%s' WHERE `Username` = '%s'",newname,oldname);
            SetPlayerName(playerid,newname);
            SendFMessage(playerid,red,"[SERVER]"lgrey"Your name has been changed to "lgreen"%s"lgrey"!",newname);
            format(string,sizeof(string),""lred"||- "lwhite"Announcement: "lgreen"%s "lred"has change his name to "lyellow"%s "lred"-||",oldname,newname);
            SendAdminMessage(red,string);
            SaveIn("Adminlog",string);
        }
    }
Reply
#2

Код:
	if(PlayerInfo[playerid][pReg] == 0)
		{
		    PlayerInfo[playerid][pLevel] = 1;
			PlayerInfo[playerid][pAccount] = 20000;
			PlayerInfo[playerid][pReg] = 1;
		}
		strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 128);
		format(tmp2, sizeof(tmp2), "SERVER: Welcome %s.", PlayerName(playerid));
		SendClientMessage(playerid, COLOR_WHITE, tmp2);
		format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~y~   %s", PlayerName(playerid));
		GameTextForPlayer(playerid, tmp2, 5000, 1);
		SendClientMessage(playerid, COLOR_YELLOW, motd);
		if(PlayerInfo[playerid][pAdmin] > 0)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)