I need help with my function - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: I need help with my function (
/showthread.php?tid=399656)
I need help with my function -
ZackBoolaro - 15.12.2012
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...
Re: I need help with my function -
[HK]Ryder[AN] - 15.12.2012
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.");
}
Re: I need help with my function -
Konstantinos - 15.12.2012
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.
Re: I need help with my function -
ZackBoolaro - 15.12.2012
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..