NPC not bypassing register system
#1

Trying to make my NPC bypass the register system, but I'm getting two error codes when compiling and no amount of ****** has helped with this issue.
The error codes:
Код:
(96) : error 036: empty statement
(109) : error 029: invalid expression, assumed zero
The script with lines 96 and 106 highlighted:
Код:
public OnPlayerConnect(playerid)
{
	new query[126];
	
	format(query, sizeof(query), "SELECT * FROM users WHERE name = '%s'", GetName(playerid));
	mysql_query(query);
	mysql_store_result();
	if(!IsPlayerNPC(playerid));
	{
		if(mysql_num_rows() == 1)
		{
	    	SendClientMessage(playerid, -1, "That username is registered!");
			ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Please log in with your password.", "Login", "Close");
		}
		else
		{
	    	SendClientMessage(playerid, -1, "That username is not registered. You may register it!");
	    	ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", "Register with your desired password.", "Register", "Close");
		}
	}
        else(IsPlayerNPC(playerid));
  	{
    	if(!strcmp(GetName(playerid), "[NPC]Dave", true))
    	{
    	    SetPlayerSkin(playerid, 101);
			SetPlayerInterior(playerid, 0);
			SetPlayerPos(playerid, -4669.8477,-7981.3027,4.4002);
			SetPlayerFacingAngle(playerid, 45);
    	}
	}
	return 1;
}
Reply
#2

1 Conditions are not followed by semi colons

PHP код:
if(!IsPlayerNPC(playerid)); 
2 you forgot to declare this as a condition
PHP код:
else(IsPlayerNPC(playerid)); 
Reply
#3

How would I go about declaring it as a condition?
Reply
#4

Put a space and the conditional 'if' in between the else and the start of the brackets here:

PHP код:
else(IsPlayerNPC(playerid)); 
For more information, refer to the following link

https://sampwiki.blast.hk/wiki/Control_S...s#Conditionals
Reply
#5

@CrystalMethod

Just remove ";" from line end.

Код:
Wrong: if(!IsPlayerNPC(playerid));  
Correct: if(!IsPlayerNPC(playerid))
Reply
#6

Done that, code finally compiles with no errors, but my NPC is still just standing at the spawn with no tag above it's head.
Reply
#7

NPCs have no nametags if i remember correctly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)