I need help with my function
#1

Hello there guys i'm developing a Roleplay GM from scratch for my server, but i have trouble with one of my functions i made rescently:
pawn Код:
//=================================DEVEOPING MODE==============================================
    /*
    Comment out the lines below if you want normal players to connect
    Normal players = not admins, not testers, not mods, just normal players xD
    */

    if(PlayerInfo[playerid][pTester] == 0 || PlayerInfo[playerid][pAdmin] < 1){
    SCM(playerid, COLOR_LIGHTRED, "Server is in Developing mode, only admins/testers can connect.");
    SCM(playerid, COLOR_LIGHTRED, "If you wanna become a tester contact the owner via skype:");
    SCM(playerid, COLOR_LIGHTRED, "cnk-midle");
    Kick(playerid);
    } else {
    SCM(playerid, COLOR_LIGHTRED, "You connected because you are a tester, the server is in test mode.");
    SCM(playerid, COLOR_LIGHTRED, "Players that don't have the tester or admin rank are gonna be kicked.");
    }
When i place it at: OnPlayerConnect i place it so it's the last so it can get the Tester/Admin rank from the user files and kick the player if it's not admin... but when i login without tester/admin rank it's just connecting me successfuly and than says: "The server is restarting" with no message.. i tryed putting it at OnPlayerSpawn but then i think it passes the whole function because i can do anything in-game...
Reply
#2

try this
pawn Код:
//=================================DEVEOPING MODE==============================================
    /*
    Comment out the lines below if you want normal players to connect
    Normal players = not admins, not testers, not mods, just normal players xD
    */

    if(PlayerInfo[playerid][pTester] == 0 && PlayerInfo[playerid][pAdmin] < 1){
    SCM(playerid, COLOR_LIGHTRED, "Server is in Developing mode, only admins/testers can connect.");
    SCM(playerid, COLOR_LIGHTRED, "If you wanna become a tester contact the owner via skype:");
    SCM(playerid, COLOR_LIGHTRED, "cnk-midle");
    Kick(playerid);
    } else {
    SCM(playerid, COLOR_LIGHTRED, "You connected because you are a tester, the server is in test mode.");
    SCM(playerid, COLOR_LIGHTRED, "Players that don't have the tester or admin rank are gonna be kicked.");
    }
Reply
#3

Read me!
It's a bug.
When you're kicking a player in OnPlayerConnect, the client autoreconnects for that player. Use a timer instead and kick player from the timer's callback.
Reply
#4

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
try this
pawn Код:
//=================================DEVEOPING MODE==============================================
    /*
    Comment out the lines below if you want normal players to connect
    Normal players = not admins, not testers, not mods, just normal players xD
    */

    if(PlayerInfo[playerid][pTester] == 0 && PlayerInfo[playerid][pAdmin] < 1){
    SCM(playerid, COLOR_LIGHTRED, "Server is in Developing mode, only admins/testers can connect.");
    SCM(playerid, COLOR_LIGHTRED, "If you wanna become a tester contact the owner via skype:");
    SCM(playerid, COLOR_LIGHTRED, "cnk-midle");
    Kick(playerid);
    } else {
    SCM(playerid, COLOR_LIGHTRED, "You connected because you are a tester, the server is in test mode.");
    SCM(playerid, COLOR_LIGHTRED, "Players that don't have the tester or admin rank are gonna be kicked.");
    }
Didn't helped at all, the function didn't have any errors. Infact you kinda fucked it up because it would now check for a tester rank and even if the player does have an admin rank it would not let him in the server.

Quote:
Originally Posted by Dwane
Посмотреть сообщение
Read me!
It's a bug.
When you're kicking a player in OnPlayerConnect, the client autoreconnects for that player. Use a timer instead and kick player from the timer's callback.
Yeah thanks, i scripted my timer. Now everything is working fine I didn't know about the bug..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)