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
#2

PHP код:
public OnPlayerConnect(playerid)
{
    if(
strfind(GetName(playerid), "[NGA]") != -1)
    {
     
// your msg and the thing u want to do for example kick(playerid);
    
}
    return 
1;
}
GetName(playerid)
{
 new 
pnameid[24];
 
GetPlayerName(playerid,pnameid,24);
 return 
pnameid;

Reply
#3

Use the example above with a Boolean to determinate if they're allowed to use it or not, if not kick them with a message that they have to contact an admin.
and of-course when you change their name set that Boolean to true;
Reply
#4

Ok thanks
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)