Error on the command /changename
#1

I experienced a failure while using the command /changename that the name is not changed with the new name and appeared error " try another command" when using the command.

Код:
CMD:changename(playerid,params[])
{
	if(PlayerInfo[playerid][LoggedIn] == 1)
 	{
	    new tmp[256],tmp2[256],Index;  tmp  = strtok(params,Index);
	    if(isnull(tmp)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /changename [New Name]");
		GetPlayerName(playerid,tmp2,sizeof(tmp2));
		new length = strlen(tmp);
		new string[128];
		if(udb_Exists(tmp)) return SendClientMessage(playerid, COLOR_RED, "That Name is already in use!");
		if(length < 3 || length > MAX_PLAYER_NAME) return SendClientMessage(playerid,red,"ERROR: Incorrect Name Length");

		strmid(VehicleInfo[PlayerInfo[playerid][vowned]][owner], tmp, 0, strlen(tmp), 255);
		strmid(VehicleInfo[PlayerInfo[playerid][vowned2]][owner], tmp, 0, strlen(tmp), 255);
		strmid(VehicleInfo[PlayerInfo[playerid][vowned3]][owner], tmp, 0, strlen(tmp), 255);
		strmid(VehicleInfo[PlayerInfo[playerid][vowned4]][owner], tmp, 0, strlen(tmp), 255);
		strmid(VehicleInfo[PlayerInfo[playerid][vowned5]][owner], tmp, 0, strlen(tmp), 255);
		strmid(VehicleInfo[PlayerInfo[playerid][vowned6]][owner], tmp, 0, strlen(tmp), 255);
		strmid(VehicleInfo[PlayerInfo[playerid][vowned7]][owner], tmp, 0, strlen(tmp), 255);
		strmid(VehicleInfo[PlayerInfo[playerid][vowned8]][owner], tmp, 0, strlen(tmp), 255);
		strmid(VehicleInfo[PlayerInfo[playerid][vowned9]][owner], tmp, 0, strlen(tmp), 255);
		strmid(VehicleInfo[PlayerInfo[playerid][vowned10]][owner], tmp, 0, strlen(tmp), 255);

		new str1[256];
		new housenumber = GetHouseID(playerid);
		format(str1, sizeof(str1), "SATDM/Houses/houseid%d", housenumber);
  		dini_Set(str1, "Name",tmp);
 	   	strmid(hInfo[housenumber][Name],tmp,sizeof(tmp),255);

		new hnowner[30];
		format(hnowner,128,"%s",hInfo[housenumber][Name]);
		if(strcmp(hInfo[housenumber][Name],DEFAULT_OWNER,false) == 0)
		{
			format(hnowner,128,"Not Owned");
		}
		UpdateDynamic3DTextLabelText(hTextInfo[housenumber],0xFF0000FF,hnowner);

		new BizID = PlayerInfo[playerid][bowner];
		strmid(BizInfo[BizID][owner], tmp, 0, strlen(tmp), 255);
		new bizowner[30];
		format(bizowner,128,"%s",BizInfo[BizID][owner]);
		if(strcmp(BizInfo[BizID][owner],DEFAULT_OWNER,false) == 0)
		{
			format(bizowner,128,"Not Owned");
		}
		UpdateDynamic3DTextLabelText(bizTextInfo[BizID],0xFF0000FF,bizowner);

		frename(tmp2, tmp);
		SetPlayerName(playerid, tmp);
		format(string, sizeof(string), "|- You have Change Nickname from %s to %s -|",tmp2, tmp);
		SendClientMessage(playerid,yellow,string);
		return OnPlayerConnect(playerid);
       } else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}
whether there are errors in the script? thanks
Reply
#2

Sorry bump, because I was confused to be able to fix this problem
Reply
#3

Why you dont try put return 1; ?
Reply
#4

Quote:
Originally Posted by Bradley7
Посмотреть сообщение
Why you dont try put return 1; ?
not successful, still not change name and appear error
Reply
#5

You may not be running the streamer plugin, verify that it is running properly. I'd also like to point out that storing things such as the owner of a house by name is (atleast in my view) a bad idea. You should consider storing this by their ID's.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)