PDA

View Full Version : NPC not bypassing register system


CrystalMethod
27/03/2017, 04:20 AM
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;
}

Toroi
27/03/2017, 04:33 AM
1 Conditions are not followed by semi colons

if(!IsPlayerNPC(playerid));

2 you forgot to declare this as a condition
else(IsPlayerNPC(playerid));

CrystalMethod
27/03/2017, 04:36 AM
How would I go about declaring it as a condition?

Toroi
27/03/2017, 04:57 AM
Put a space and the conditional 'if' in between the else and the start of the brackets here:

else(IsPlayerNPC(playerid));

For more information, refer to the following link

http://wiki.sa-mp.com/wiki/Control_Structures#Conditionals

raydx
27/03/2017, 09:18 AM
@CrystalMethod

Just remove ";" from line end.

Wrong: if(!IsPlayerNPC(playerid));
Correct: if(!IsPlayerNPC(playerid))

CrystalMethod
27/03/2017, 09:21 AM
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.

raydx
27/03/2017, 09:24 AM
NPCs have no nametags if i remember correctly.