CMD:changename(playerid,params[])
{
if(IsSpawned[playerid] == 0) return SendClientMessage(playerid, -1, "ERROR : You must be logged in to use this command, nigga");
if(pInfo[playerid][pRDonator] == 1)
{
new newname[24];
new string[250];
new pName[MAX_PLAYER_NAME];
if(sscanf(params,"s[128]", newname)) return SendClientMessage(playerid, -1, "Correct Usage: /changename [newname]");
if((newname < 3) || (newname > 24)) return SendClientMessage(playerid, -1, "ERROR: Your new name cannot be smaller than 3 or longer than 24 Characters"); //Line - Here
{
new filePath[128];
GetPlayerName(playerid, pName, sizeof(pName));
format(filePath, sizeof(filePath), "System-x32/Users/%s.ini", newname);
if(fexist(filePath)) return SendClientMessage(playerid, -1, "ERROR: name was taken, please enter a different name.");
else
format(string, sizeof(string), "You just successfully rename your account %s to %s.", pName, newname);
SendClientMessage(playerid, -1, string);
frename(UserPath(playerid), filePath);
SetPlayerName(playerid, newname);
}
}
else return SendClientMessage(playerid, -1, "You aren't authorized.");
return 1;
}
if(strlen(newname) < 3 ...)
if(newname < 3 ...
Use
pawn Код:
pawn Код:
|
CMD:changename(playerid,params[])
{
if (!IsSpawned[playerid]) return SendClientMessage(playerid, -1, "ERROR : You must be logged in to use this command, nigga");
if (!pInfo[playerid][pRDonator]) return SendClientMessage(playerid, -1, "You aren't authorized.");
if (isnull(params)) return SendClientMessage(playerid, -1, "Correct Usage: /changename [newname]");
if (!(3 <= strlen(params) <= 24)) return SendClientMessage(playerid, -1, "ERROR: Your new name cannot be smaller than 3 or longer than 24 Characters"); //Line - Here
//if (!IsValidUsername(params)) return SendClientMessage(playerid, -1, "ERROR: Invalid character(s).");
new filePath[98], pName[MAX_PLAYER_NAME + 1];
GetPlayerName(playerid, pName, sizeof(pName));
format(filePath, 47, "System-x32/Users/%s.ini", params);
if (fexist(filePath)) return SendClientMessage(playerid, -1, "ERROR: name was taken, please enter a different name.");
frename(UserPath(playerid), filePath);
SetPlayerName(playerid, params);
format(filePath, sizeof(filePath), "You just successfully rename your account %s to %s.", pName, params);
SendClientMessage(playerid, -1, filePath);
return 1;
}