15.09.2015, 11:38
HI!
I have a quick question on restricting tags like [NGA] etc to only certain members and if people add them the server kicks them unless they are a real tag holder. As well as preventing people from adding it into:
But if they are a holder of any the assigned tags, they need to contact an admin for a change.
I have a quick question on restricting tags like [NGA] etc to only certain members and if people add them the server kicks them unless they are a real tag holder. As well as preventing people from adding it into:
PHP код:
CMD:changename(playerid, params[])
{
if(GetPVarType(playerid, "GAdmin_Loggedin") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not registered or logged in.");
new name[MAX_PLAYER_NAME];
if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, COLOR_THISTLE, "USAGE: /changename [newname]");
if(strlen(name) < 4 || strlen(name) > MAX_PLAYER_NAME) return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid user name length, must be b/w 4-24.");
if(GetPlayerMoney(playerid) < 300000) return SendClientMessage(playerid, COLOR_RED, "ERROR: You need atleast $300,000 to use this command.");
new key = DB::RetrieveKey(gGlobal[s_usertable], "username", name);
if(key != DB_INVALID_KEY) return SendClientMessage(playerid, COLOR_RED, "ERROR: That username is already registered, try another one!");
key = DB::RetrieveKey(gGlobal[s_usertable], "username", ReturnPlayerName(playerid));
DB::SetStringEntry(gGlobal[s_usertable], key, "username", name);
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
new string[144];
format(string, sizeof(string), "ACCOUNT: You have changed your username from %s to %s.", ReturnPlayerName(playerid), name);
SendClientMessage(playerid, COLOR_GREEN, string);
SetPlayerName(playerid, name);
GameTextForPlayer(playerid, "~g~NAME CHANGED ~r~$-300,000!", 5000, 3);
GivePlayerMoney(playerid, -300000);
return 1;
}