/setname crashes the server
#2

try this
Код:
CMD:setname(playerid, params[])
{
    if(aDuty[playerid] == 1)
    if(PlayerInfo[playerid][pAdmin] >= 4)
    {
            new name[MAX_PLAYER_NAME],string1[128],query[128],q[128];
            new targetid, inputtext[25];
            if(sscanf(params, "is[25]", targetid, inputtext)) return SendClientMessage(playerid, C_GREY, "USAGE: /setname [playerid] [new name]");
            {
			if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, C_GREY, "Player not connected");
            format(q,sizeof(q),"SELECT * FROM `accounts` WHERE user = '%s'",inputtext);
            mysql_query(q);
            mysql_store_result();
            if(mysql_num_rows()>0)
            {
            SendClientMessage(playerid, C_RED,"SERVER: That name is already taken. Please choose another name.");
            }
            else
            {
            GetPlayerName(targetid, name, sizeof(name));
            format(query, sizeof(query), "UPDATE `accounts` SET user ='%s' WHERE user ='%s'",inputtext,name);
            mysql_query(query);
            format(string1, sizeof(string1), "ADMIN: %s have changed your name to %s [Use this username while logging in next time].",Name(playerid), inputtext);
            SendClientMessage(targetid, C_CYAN, string1);
            SendClientMessage(playerid, C_YELLOW, "You have successfully changed the name!");
            SetPlayerName(targetid, inputtext);
            mysql_free_result();
            }
            }
    } else return SendClientMessage(playerid, C_RED, "You are not authorized to use this command!");
    return 1;
}
Reply


Messages In This Thread
/setname crashes the server - by DetoNater - 10.06.2013, 13:10
Re: /setname crashes the server - by Sascha - 10.06.2013, 13:58
Re: /setname crashes the server - by DetoNater - 10.06.2013, 16:03
Re: /setname crashes the server - by moadi - 10.06.2013, 18:23
Re: /setname crashes the server - by Sascha - 10.06.2013, 18:51

Forum Jump:


Users browsing this thread: 2 Guest(s)