Код:
CMD:setname(playerid, params[])
{
new string[128], giveplayerid, name[MAX_PLAYER_NAME];
new playername[MAX_PLAYER_NAME];
if(sscanf(params, "us[24]", giveplayerid, name)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /setname [playerid] [newname]");
if(IsPlayerConnected(giveplayerid))
{
if (PlayerInfo[playerid][pAdmin] >= 4)
{
if(!doesAccountExist(name))
{
new
newname[MAX_PLAYER_NAME + 10];
GetPlayerName(giveplayerid, playername, sizeof(playername));
format(newname, sizeof(newname), "users/%s.ini", name);
if(PlayerInfo[giveplayerid][pPhousekey] != INVALID_HOUSE_ID && strcmp(playername, HouseInfo[PlayerInfo[giveplayerid][pPhousekey]][hOwner], true) == 0)
{
strmid(HouseInfo[PlayerInfo[giveplayerid][pPhousekey]][hOwner], name, 0, strlen(name), 255);
format(string, sizeof(string), "This house is owned by\n %s\nLevel: %d\nID: %d",HouseInfo[PlayerInfo[giveplayerid][pPhousekey]][hOwner],HouseInfo[PlayerInfo[giveplayerid][pPhousekey]][hLevel],PlayerInfo[giveplayerid][pPhousekey]);
UpdateDynamic3DTextLabelText(HouseInfo[PlayerInfo[giveplayerid][pPhousekey]][hTextID], COLOR_GREEN, string);
}
if(PlayerInfo[giveplayerid][pPhousekey2] != INVALID_HOUSE_ID && strcmp(playername, HouseInfo[PlayerInfo[giveplayerid][pPhousekey2]][hOwner], true) == 0)
{
strmid(HouseInfo[PlayerInfo[giveplayerid][pPhousekey2]][hOwner], name, 0, strlen(name), 255);
format(string, sizeof(string), "This house is owned by\n %s\nLevel: %d\nID: %d",HouseInfo[PlayerInfo[giveplayerid][pPhousekey2]][hOwner],HouseInfo[PlayerInfo[giveplayerid][pPhousekey2]][hLevel],PlayerInfo[giveplayerid][pPhousekey2]);
UpdateDynamic3DTextLabelText(HouseInfo[PlayerInfo[giveplayerid][pPhousekey2]][hTextID], COLOR_GREEN, string);
}
if(PlayerInfo[giveplayerid][pDonateRank] >= 1)
{
new string2[128];
format(string2, sizeof(string2), "[VIP NAMECHANGES] %s has changed their name to %s.", GetPlayerNameEx(giveplayerid), name);
Log("logs/vipnamechanges.log", string2);
}
format(string, sizeof(string), " Your name has been changed from %s to %s.", GetPlayerNameEx(giveplayerid), name);
SendClientMessageEx(giveplayerid,COLOR_YELLOW,string);
format(string, sizeof(string), " You have changed %s's name to %s.", GetPlayerNameEx(giveplayerid), name);
SendClientMessageEx(playerid,COLOR_YELLOW,string);
format(string, sizeof(string), "%s changed \"%s\"s name to \"%s\"",GetPlayerNameEx(playerid),GetPlayerNameEx(giveplayerid),name);
Log("logs/stats.log", string);
SetPlayerName(giveplayerid, name);
OnPlayerStatsUpdate(giveplayerid);
format(newname, sizeof(newname), "users/%s.ini", playername);
fremove(newname);
if(doesAccountExist(playername)) // If it doesn't get removed, blank the file with write io and check its length when a player attempts to authenticate (it'll be 0)
{
new File: BlankTheFile = fopen(newname, io_write);
SendClientMessageEx(playerid, COLOR_GRAD2, "The old account couldn't be removed completely (it's been blanked for future use).");
fclose(BlankTheFile);
}
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "This name is already registered.");
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You aren't authorised to use this command.");
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD2, "No Such Player");
}
return 1;
}
Hm.. This is happen to me a month ago, when i typed that command, the samp-server.exe crash, but its not error of the command, just try to update your plugins