OnPlayerConnect|Strfind not working..
#1

Why if a player joins with [GTA] tag and hasn't been accepted. It's not being kicked??

PHP код:
public OnPlayerConnect(playerid)

   new 
nname[MAX_PLAYER_NAME];
   
GetPlayerName(playeridnname24);
    if(
strfind(nname"[GTA]"true) != -1)
    {
        if(
PlayerInfo[playerid][Accepted] == 1)
        {
            
SendClientMessage(playerid0x00A1A9FF"Congratulations! You are part of our Community [GTA]. Be proud to use our tag!");
        }
        else
        {
            
SendClientMessage(playerid0xFF0000FF"ERROR: You cannot use our [GTA] tag. You're not a member. Apply on forums to get this tag");
            
Kick(playerid);
        }
    }
     return 
1;

Reply
#2

Where/When and how do you set the value of Accepted?
Reply
#3

Well... The value is set when the player registers in server.

I thought if I don't set a value for "Accepted" automatically will be 0.

Is there any way to check if player is not "Accepted" when he connects?

Or Is there any way to check if Is the first time the player joins in the server?
Reply
#4

Quote:
Originally Posted by Magic_Time
Посмотреть сообщение
Well... The value is set when the player registers in server.

I thought if I don't set a value for "Accepted" automatically will be 0.
In that case, this code should actually work, unless I'm missing something.

Quote:
Originally Posted by Magic_Time
Посмотреть сообщение
Is there any way to check if player is not "Accepted" when he connects?

Or Is there any way to check if Is the first time the player joins in the server?
Well yes, you can just set the accepted value to 1 at the end of OnPlayerConnect and then write it to the player's file, but I guess that's what you've already done.
Reply
#5

That's what I have under OnPlayerConnect.

PHP код:
public OnPlayerConnect(playerid)
{
    new 
string[256];
    if(
fexist(Path(playerid)))
    {
        
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra true, .extra playerid);
        
format(string256"Welcome back {1580EA}%s. {D4D4D4}This account is registered. \nInsert your password to login to your account"Name(playerid));
           
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login",string,"Login","Quit");
    }
    else
    {
        
PlayerInfo[playerid][Accepted] = 0;
        
format(stringsizeof(string), "Welcome! {1580EA}%s. {D4D4D4}This account is not registered.\nEnter your own password to create a new account."Name(playerid));
        
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register",string,"Register","Quit");
        return 
1;
    }
    new 
nname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnname24);
    if(
strfind(nname"[GTA]"true) != -1)
    {
        if(
PlayerInfo[playerid][Accepted] == 1)
        {
            
SendClientMessage(playerid0x00A1A9FF"Congratulations! You are part of our Community [GTA]. Be proud to use our tag!");
        }
        if(
PlayerInfo[playerid][Accepted] == 0)
        {
            
SendClientMessage(playerid0xFF0000FF"ERROR: You cannot use our [GTA] tag. You're not a member. Apply on forums to get this tag");
            
Kick(playerid);
        }
    }
     return 
1;

When a player registers:

PHP код:
 if(dialogid == DIALOG_REGISTER)
    {
        if(!
response) return Kick(playerid);
        if(
response)
        {
            if(!
strlen(inputtext))
            {
                
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
                return 
1;
            }
            new 
hashpass[129];
            
WP_Hash(hashpass,sizeof(hashpass),inputtext);
            new 
INI:file INI_Open(Path(playerid));
            
INI_SetTag(file,"Player's Data");
            
INI_WriteString(file,"Password",hashpass);
            
INI_WriteInt(file,"MemberAccepted",0);//here it's writing the value to 0.
            
INI_Close(file);
            
SendClientMessage(playerid,-1,"You are now registered on this server");
            return 
1;
        }
    } 
Reply
#6

USe OnPlayerRequestClass Callback
Reply
#7

But I want the player to be kicked when he joins,
Reply
#8

Show your, loadaccount function... you're probably not loading your stats properly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)