Why am I getting kicked?
#1

PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    new 
name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
    
GetPlayerName(playeridnamesizeof(name));
    
    if(
PlayerInfo[playerid][pAdmin] == && strfind(name,"_",true)== -1)
    {
        
SendClientMessage(playeridCOLOR_LIGHTRED"SERVER: {FFFFFF}This is a roleplay server. Please reconnect using a Firstname_Lastname format (E.G John_Smith).");
          
format(stringsizeof(string), "%s was kicked: Non-RP name"name);
           
SendClientMessageToAll(0xC4C4C4FFstring);
        
SetTimerEx("KickTimer",1000,false,"i"playerid);
        return 
1;
    }
    if(
IsPlayerNPC(playerid))
    {
        
printf("NPC: OnPlayerRequestClass: %d"playerid);
        return 
1;
    }
    if(
gPlayerLogged[playerid] == 0)
    {
        switch(
gPlayerAccount[playerid])
        {
            case 
0DisplayDialogForPlayer(playerid2); //register
            
case 1DisplayDialogForPlayer(playerid1); //login
        
}
    }
    
SetupPlayerForClassSelection(playerid);
    if(
gPlayerSpawned[playerid] == 1)
    {
        if(
PlayerInfo[playerid][pMember] > || PlayerInfo[playerid][pLeader] > || PlayerInfo[playerid][pFMember] != 255)
        {
            
SetPlayerSkin(playeridPlayerInfo[playerid][pModel]);
        }
        else
        {
            
PlayerInfo[playerid][pModel] = PedSkins[classid][0];
        }
    }
    else
    {
        
SetPlayerSkin(playeridPlayerInfo[playerid][pModel]);
    }
    return 
1;

I'm logging in as an administrator (999999), but I'm still being kicked for having a non-rp name.
I want players without an underscore to be kicked, but not admins..

How can I make this work? Thank you!
Reply
#2

Код:
if(PlayerInfo[playerid][pAdmin] == 0 && strfind(name,"_",true)== -1)
also why'd you make a new thread for this,could of waited...
Reply
#3

Thanks heaps man

Not too sure. It was related to the other post, but was having a different problem and thought it would be easier to discuss here. Probably was the wrong idea.

Anyways

Why would
PHP код:
if(PlayerInfo[playerid][pAdmin] == && strfind(name,"_",true)== -1
be kicking me if my name is "Baker" and I'm a level 999999 admin? haha, I'm not a level 0 admin so I don't know why the command is still being executed.

Does this also mean if you do have a roleplay name and the top code doesn't execute... It won't return the code underneath, right?
Reply
#4

Because you haven't logged-in yet, -_-. Nor are you loading the player's data.

Returning a value exists the function and returns a specific value, meaning the code below any return's won't be executed.
Reply
#5

Shit, thank man!

So how would I make the script below run as well?

Edit: Seems dumb the question I'm asking.. But I've just confused the crap out of myself and can't figure it out now haha
Reply
#6

You have to check if the player is admin (loading the field), the array will always be 0 otherwise.

To make the code below it run too, remove the return. Return exists the function.
Reply
#7

Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)