Quick Question
#1

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:

PHP код:
CMD:changename(playeridparams[])
{
    if(
GetPVarType(playerid"GAdmin_Loggedin") == PLAYER_VARTYPE_NONE) return SendClientMessage(playeridCOLOR_RED"ERROR: You are not registered or logged in.");
    new 
name[MAX_PLAYER_NAME];
    if(
sscanf(params"s[24]"name)) return SendClientMessage(playeridCOLOR_THISTLE"USAGE: /changename [newname]");
    if(
strlen(name) < || strlen(name) > MAX_PLAYER_NAME) return SendClientMessage(playeridCOLOR_RED"ERROR: Invalid user name length, must be b/w 4-24.");
    
    if(
GetPlayerMoney(playerid) < 300000) return SendClientMessage(playeridCOLOR_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(playeridCOLOR_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(playerid10570.00.00.0);
    new 
string[144];
    
format(stringsizeof(string), "ACCOUNT: You have changed your username from %s to %s."ReturnPlayerName(playerid), name);
    
SendClientMessage(playeridCOLOR_GREENstring);
    
SetPlayerName(playeridname);
    
GameTextForPlayer(playerid"~g~NAME CHANGED ~r~$-300,000!"50003);
    
GivePlayerMoney(playerid, -300000);
    return 
1;

But if they are a holder of any the assigned tags, they need to contact an admin for a change.
Reply


Messages In This Thread
Quick Question - by Thoma - 15.09.2015, 11:38
Re: Quick Question - by HydraHumza - 15.09.2015, 11:49
Re: Quick Question - by xVIP3Rx - 15.09.2015, 11:57
Re: Quick Question - by Thoma - 15.09.2015, 11:59

Forum Jump:


Users browsing this thread: 1 Guest(s)