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");
}
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.