SA-MP Forums Archive
OnPlayerConnect Problem ( 0.3a ) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerConnect Problem ( 0.3a ) (/showthread.php?tid=124155)



OnPlayerConnect Problem ( 0.3a ) - Micko9 - 29.01.2010

when i did make a script ( succesfully ) 1 of my releases ( the only 1 lolz ) i thought first to use the OnPlayerConnect function...but it didnt work
i had this at the top of the script :
pawn Код:
enum SERVER_LOCKED {
    Locked
}

new ServerCfg[SERVER_LOCKED];
however it succesfully compiled and everything but this i did:

pawn Код:
OnPlayerConnect(playerid)
{
  if (ServerCfg[SERVER_LOCKED] = 1)
{
  SendClientMessage(playerid,red,"Sorry. Server is locked. Try later.");
  kick(playerid);
}
  return 1;
}
i didnt have any errors but when i tested it i locked the server reconnected it sayed : "Sorry. Server is locked. Try Later."
but it didnt kick me
should i use return 0;
?
becouse it might say the script not to execute or what?


Re: OnPlayerConnect Problem ( 0.3a ) - cmg4life - 29.01.2010

it didn't have any errors ? ROFL... fuxed complier then.

1st: The Script: Do new ServerCfg[Locked]; then when you want to lock it ServerCfg[Locked] = 1; then OnPlayerConnect(playerid) do if( ServerCfg[playerid][Locked] == 1 ) { //do thingie kick } and if you kick, no need for return 0; because he will get kicked, for a check you need to do if( bla == 1) not if( bla = 1)

2nd: Reinstall your PawnO (download a sa-mp server and copy "Pawno" folder over the pawno you are using atm )


Re: OnPlayerConnect Problem ( 0.3a ) - ғαιιοцт - 29.01.2010

Use

Код:
enum SERVER_LOCKED {
  new bool:locked,
}
and use '==' instead of '='

so:
Код:
if(ServerCfg[Locked] == true)
you should also SET the value Locked to true somewhere (or to false if you want to unlock the server)


Edit:
I'm also amazed you didn't get any error ><


Re: OnPlayerConnect Problem ( 0.3a ) - Micko9 - 29.01.2010

Quote:
Originally Posted by °ғαιιοцт°
Use

Код:
enum SERVER_LOCKED {
  new bool:locked,
}
and use '==' instead of '='

so:
Код:
if(ServerCfg[Locked] == true)
you should also SET the value Locked to true somewhere (or to false if you want to unlock the server)


Edit:
I'm also amazed you didn't get any error ><
i didnt tell the complete script
but i used OnPlayerRequestClass and it worked...i think i lost actually my script and have to redownload it O.O


Re: OnPlayerConnect Problem ( 0.3a ) - cmg4life - 29.01.2010

you're welcome -_-'