NPC not bypassing register system -
CrystalMethod - 27.03.2017
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;
}
Re: NPC not bypassing register system -
Toroi - 27.03.2017
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));
Re: NPC not bypassing register system -
CrystalMethod - 27.03.2017
How would I go about declaring it as a condition?
Re: NPC not bypassing register system -
Toroi - 27.03.2017
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
Re: NPC not bypassing register system -
raydx - 27.03.2017
@CrystalMethod
Just remove ";" from line end.
Код:
Wrong: if(!IsPlayerNPC(playerid));
Correct: if(!IsPlayerNPC(playerid))
Re: NPC not bypassing register system -
CrystalMethod - 27.03.2017
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.
Re: NPC not bypassing register system -
raydx - 27.03.2017
NPCs have no nametags if i remember correctly.