/changename
#1

Can you please help me make a command /changename?

Here is the sample for changepass maybe you can get something on it. Thanks alot. I really need!

Код:
COMMAND:changepass(playerid,params[]) //level0
{
	new pass[128];
	if(sscanf(params, "s[128]", pass))
	{
		GameTextForPlayer(playerid, "~g~/changepass ~w~<New password>", 3000, 3);
	    return 1;
	}
	if(strlen(pass) < MIN_PASS_LEN || strlen(pass) > MAX_PASS_LEN)
	{
		GameTextForPlayer(playerid, "~r~Incorrect password length", 3000, 3);
		return 1;
	}
	new string[128];
    UpdatePlayerPass(playerid, pass);
	PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
    format(string, sizeof(string),">> You have successfully changed your password to | {FFFFFF}%s",pass);
	SendClientMessage(playerid, GREEN,string);
	return 1;
}
Reply
#2

Hey man, i suggest not adding this cmd to ur server because it will end as getting abused,

And here is the command

Код:
CMD:changename(playerid, params[])
{
        if(PlayerInfo[playerid][LoggedIn] == 1)	{
		if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /changename [new Name]");
		if(strlen(params) < 4) return SendClientMessage(playerid,red,"ACCOUNT: Incorrect password length");
		if (udb_Exists(params)) return SendClientMessage(playerid,red,"This User Name Is Taken!");
		if(GetPlayerMoney(playerid) < 50000) return SendClientMessage(playerid, red,"You need to have $50000 to change name");
		new nameee[24];  GetPlayerName(playerid, nameee, 16);
		new OldName[24],str[128];
		GetPlayerName(playerid,OldName,sizeof(OldName));
		format(str,sizeof(str),"ladmin/users/%s.sav",OldName);
		udb_RenameUser(OldName,params);
		format(str,sizeof(str),"ladmin/users/%s.sav",params);
		SetPlayerName(playerid,params);
		PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
		new string[128];
		GivePlayerMoney(playerid, -50000);
        format(string, sizeof(string),"ACCOUNT: You have successfully changed your Name to \%s\"",params);
		return SendClientMessage(playerid,yellow,string);
	} else return SendClientMessage(playerid,red, "ERROR: You must register your account first to use this command");
}*/
Good luck
Reply
#3

This is copied from ladmin fs?
Reply
#4

Quote:
Originally Posted by gotwarzone
Посмотреть сообщение
This is copied from ladmin fs?
True, thats the one i use, so maybe itll help him
Reply
#5

Here's Changename:

pawn Код:
CMD:changename(playerid, params[])
{
if(PInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR, "You have to be an admin to use this command!"); // restrict command to Admin use only!
new newname[MAX_PLAYER_NAME], oldname[MAX_PLAYER_NAME], targetid; // Variables to save names
if(sscanf(playerid, "us", targetid, newname)) return SendClientMessage(playerid, COLOR, "Usage: /changename [playerid] [new Name]"); // Check parameters use
new message[144]; // Variable which will be formated
GetPlayerName(targetid, oldname, sizeof(oldname)); // Get the person who will have his name changed and save it in oldname
SetPlayerName(targetid, newname); // Set His name to newname
format(message,sizeof(message), "You have changed %s 's name to %s!", oldname, newname); // Format message accordingly
SendClientMessage(playerid, COLOR, message); // Actually send the message
new adminname[MAX_PLAYER_NAME];
GetPlayerName(playerid, adminname, sizeof(adminname));
format(message, sizeof(message), "Admin %s has changed your name to %s!", adminname, newname);
SendClientMessage(targetid, COLOR, message);
return 1;
} // By: Elie1996
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)