SA-MP Forums Archive
OnPlayerSpawn check - 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: OnPlayerSpawn check (/showthread.php?tid=391380)



OnPlayerSpawn check - nickbouwhuis - 10.11.2012

Hey guys!

I am busy with a login system but it won't work for me and I can't figure out what I'm doing wrong.

Here is my code:
Код:
public OnPlayerSpawn(playerid) {
	if(!Variables[playerid][LoggedIn] = true)) {
	GameTextForPlayer(playerid,"JE VERGAT IN TE1 LOGGEN!",5000,5);
	Kick(playerid);
	}
	return 1;
}
It gives these errors on the "if" line:

Код:
login.pwn(144) : warning 211: possibly unintended assignment
login.pwn(144) : error 022: must be lvalue (non-constant)
login.pwn(144) : warning 215: expression has no effect
login.pwn(144) : error 001: expected token: ";", but found ")"
login.pwn(144) : error 029: invalid expression, assumed zero
login.pwn(144) : fatal error 107: too many error messages on one line
Thanks in advance!


Re: OnPlayerSpawn check - Skillet` - 10.11.2012

You have double closing ' ) ' at the end.
Quote:

if(!Variables[playerid][LoggedIn] = true)) {




Re: OnPlayerSpawn check - Plovix - 10.11.2012

Replace:

PHP код:
if(!Variables[playerid][LoggedIn] = true)) 
With:

PHP код:
if(!Variables[playerid][LoggedIn] == true



Re: OnPlayerSpawn check - nickbouwhuis - 10.11.2012

Quote:
Originally Posted by Plovix
Посмотреть сообщение
Replace:

PHP код:
if(!Variables[playerid][LoggedIn] = true)) 
With:

PHP код:
if(!Variables[playerid][LoggedIn] == true
Welp, that didn't fixed it
My code now:
PHP код:
public OnPlayerSpawn(playerid) {
    if(!
Variables[playerid][LoggedIn] = true) {
    
GameTextForPlayer(playerid,"JE VERGAT IN TE LOGGEN!",5000,5);
    
Kick(playerid);
    }
    return 
1;

Errors:
Код:
login.pwn(144) : warning 211: possibly unintended assignment
login.pwn(144) : error 022: must be lvalue (non-constant)
login.pwn(144) : warning 215: expression has no effect
login.pwn(144) : error 001: expected token: ";", but found ")"
login.pwn(144) : error 029: invalid expression, assumed zero
login.pwn(144) : fatal error 107: too many error messages on one line



Re: OnPlayerSpawn check - Konstantinos - 10.11.2012

Do you use boolean or just 0/1.
In the first case, ! and true = false
So,
pawn Код:
if(Variables[playerid][LoggedIn] == false)
In the second case,
pawn Код:
if(Variables[playerid][LoggedIn] == 0)



Re: OnPlayerSpawn check - Plovix - 10.11.2012

This has to work:

PHP код:
public OnPlayerSpawn(playerid
{
    if(
Variables[playerid][LoggedIn] != true
    {
    
GameTextForPlayer(playerid,"JE VERGAT IN TE LOGGEN!",5000,5);
    
Kick(playerid);
    }
    return 
1;




Re: OnPlayerSpawn check - nickbouwhuis - 10.11.2012

Quote:
Originally Posted by Plovix
Посмотреть сообщение
This has to work:

PHP код:
public OnPlayerSpawn(playerid
{
    if(
Variables[playerid][LoggedIn] != true
    {
    
GameTextForPlayer(playerid,"JE VERGAT IN TE LOGGEN!",5000,5);
    
Kick(playerid);
    }
    return 
1;

Worked perfectly! Thanks a million! Repped!


Re: OnPlayerSpawn check - Plovix - 10.11.2012

Np,thank you for +rep,if you want,rep to Dwane,because he/she try to help too