Help with login before spawn ?
#1

pawn Код:
OnPlayerRequestSpawn(...)
{
  if(IsPlayerLoggedIn[playerid] == 0)
  {
    return 0;
  }
  return 1;
}
and some sort of timer @ OnPlayerConnect..
[/quote]

I put this in my game mode and i get these errors

Код:
C:\Documents and Settings\sanandreas\Desktop\samp server\gamemodes\SF5GDM.pwn(490) : error 028: invalid subscript (not an array or too many subscripts): "IsPlayerLoggedIn"
C:\Documents and Settings\sanandreas\Desktop\samp server\gamemodes\SF5GDM.pwn(490) : warning 215: expression has no effect
C:\Documents and Settings\sanandreas\Desktop\samp server\gamemodes\SF5GDM.pwn(490) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\sanandreas\Desktop\samp server\gamemodes\SF5GDM.pwn(490) : error 029: invalid expression, assumed zero
C:\Documents and Settings\sanandreas\Desktop\samp server\gamemodes\SF5GDM.pwn(490) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Код:
if(IsPlayerLoggedIn[playerid] == 0)
This being line 490
Reply
#2

pawn Код:
OnPlayerRequestSpawn(...)
{

  {
  if(IsPlayerLoggedIn[playerid] == 0);
 
   
     }
    return 0;
  }
  return 1;
}
and some sort of timer @ OnPlayerConnect..
Reply
#3

i get same errors?
Код:
OnPlayerRequestSpawn(...)
also why (...) when its always (playerid)
Reply
#4

Quote:
Originally Posted by Mr_FinnigaN
i get same errors?
Код:
OnPlayerRequestSpawn(...)
also why (...) when its always (playerid)

i dunno u made it :P
Reply
#5

I did not make,i searched and found it and tried to put it in my gamemode.


Does anyone know how to make it so you cannot spawn unless you login?
Reply
#6

You can't make them NOT spawn, BUT you can do a check to see if they have logged in before spawning and deny them...
This code isn't tested/nor expected to work, just an example
Код:
new PlayerState[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
  if (PlayerState[playerid] == 0) // not logged in?
  {
   SendClientMessage(playerid, 0xFFFFFFFF, "You must login before spawning!");
   Kick(playerid);
  }
}
Reply
#7

or change the kick into setting their health to 0
Reply
#8

Oh, why don't you kick ban rangeban him because of not-being-logged-in-before-spawning?


Код:
new PlayerState[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
  if (PlayerState[playerid] == 0) // not logged in?
  {
   SendClientMessage(playerid, 0xFFFFFFFF, "You must login before spawning!");
   ForceClassSelection(playerid);
   SetPlayerHealth(playerid,0);
  }
}
Reply
#9

Thanx for the help guys,i got it to work,i found a admin filterscript with it built in.

Check the server in my sig to see it working great.

Thanx again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)