Why am I getting kicked? -
Josh_Main - 16.09.2016
PHP код:
public OnPlayerRequestClass(playerid, classid)
{
new name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
if(PlayerInfo[playerid][pAdmin] == 0 && strfind(name,"_",true)== -1)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}This is a roleplay server. Please reconnect using a Firstname_Lastname format (E.G John_Smith).");
format(string, sizeof(string), "%s was kicked: Non-RP name", name);
SendClientMessageToAll(0xC4C4C4FF, string);
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 0: DisplayDialogForPlayer(playerid, 2); //register
case 1: DisplayDialogForPlayer(playerid, 1); //login
}
}
SetupPlayerForClassSelection(playerid);
if(gPlayerSpawned[playerid] == 1)
{
if(PlayerInfo[playerid][pMember] > 0 || PlayerInfo[playerid][pLeader] > 0 || PlayerInfo[playerid][pFMember] != 255)
{
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
}
else
{
PlayerInfo[playerid][pModel] = PedSkins[classid][0];
}
}
else
{
SetPlayerSkin(playerid, PlayerInfo[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!
Re: Why am I getting kicked? -
ISmokezU - 16.09.2016
Код:
if(PlayerInfo[playerid][pAdmin] == 0 && strfind(name,"_",true)== -1)
also why'd you make a new thread for this,could of waited...
Re: Why am I getting kicked? -
Josh_Main - 16.09.2016
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] == 0 && 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?
Re: Why am I getting kicked? -
SickAttack - 16.09.2016
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.
Re: Why am I getting kicked? -
Josh_Main - 16.09.2016
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
Re: Why am I getting kicked? -
SickAttack - 16.09.2016
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.
Re: Why am I getting kicked? -
Josh_Main - 17.09.2016
Thank you