OnPlayerConnect Problem ( 0.3a )
#1

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?
Reply
#2

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 )
Reply
#3

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 ><
Reply
#4

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
Reply
#5

you're welcome -_-'
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)