SetName Command Help
#1

Код:
dcmd_setname(playerid,params[])
{
	if(AccInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
	{
	    new Index;
	    new tmp[256];  tmp  = strtok(params,Index);
	    new tmp2[256]; tmp2 = strtok(params,Index);
	    if(!strlen(tmp) || !strlen(tmp2)) return
		SendClientMessage(playerid, red, "Usage: /setname [PlayerID] [NewName]") &&
		SendClientMessage(playerid, red, "[Function]:{FFFFFF} Will set {94ED40}Name {FFFFFF}of specified player!");
		new player1 = strval(tmp);
		new length = strlen(tmp2);
		new string[128];
		if(length < 3 || length > MAX_PLAYER_NAME) return
		SendClientMessage(playerid,red,"[ERROR]: {FFFFFF}Incorrect Name Length");
		if(AccInfo[player1][Level] == ServerInfo[MaxAdminLevel] && AccInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
		return SendClientMessage(playerid,red,"[ERROR]: {FFFFFF}You cannot use this {94ED40}command {FFFFFF}on this {94ED40}admin {FFFFFF}!");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
		{
			SendCommandToAdmins(playerid,"SetName");
			format(string, sizeof(string), "You have set {94ED40}\"%s's\" {FFFFFF}Name to {94ED40}\"%s\"", pName(player1), tmp2);
			SendClientMessage(playerid,COLOR_WHITE,string);
			if(player1 != playerid)
			{
			format(string,sizeof(string),"Administrator {94ED40}\"%s\" {FFFFFF}has set your Name to {94ED40}\"%s\"", pName(playerid), tmp2);
			SendClientMessage(player1,COLOR_WHITE,string);
			}
			SetPlayerName(player1, tmp2);
   			return OnPlayerConnect(player1);
	    }
		else return ErrorMessages(playerid, 2);
	}
	else return ErrorMessages(playerid, 1);
}
If name 'Sa-mp.com' is registered on my server and i set name to 'x' for example, it says to x that:
'Name sa-mp.com is registered please login to acces your account stats'
I want to make that command to say him, if that name is already taken, that this name can't be used, already exists, btw i don't know how, can you help me ?

PS: I use LuxAdmin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)