warning 225: unreachable code +rep -
genesis87 - 31.01.2012
hey all,
im making a gm but im having a problem.
im trying to make a register and login system which saves to file and also mysql but i get warnings
Код:
C:\Users\Asus\Desktop\samp03dsvr_R2_win32\pawno\include\dini.inc(45) : warning 219: local variable "line" shadows a variable at a preceding level
C:\Users\Asus\Desktop\samp03dsvr_R2_win32\pawno\include\dini.inc(53) : warning 219: local variable "line" shadows a variable at a preceding level
C:\Users\Asus\Desktop\samp03dsvr_R2_win32\gamemodes\CNR - Copy.pwn(2492) : warning 225: unreachable code
C:\Users\Asus\Desktop\samp03dsvr_R2_win32\gamemodes\CNR - Copy.pwn(2580) : warning 225: unreachable code
C:\Users\Asus\Desktop\samp03dsvr_R2_win32\gamemodes\CNR - Copy.pwn(2739) : warning 225: unreachable code
C:\Users\Asus\Desktop\samp03dsvr_R2_win32\gamemodes\CNR - Copy.pwn(3361) : warning 217: loose indentation
C:\Users\Asus\Desktop\samp03dsvr_R2_win32\gamemodes\CNR - Copy.pwn(3535) : warning 217: loose indentation
C:\Users\Asus\Desktop\samp03dsvr_R2_win32\gamemodes\CNR - Copy.pwn(3771) : warning 217: loose indentation
C:\Users\Asus\Desktop\samp03dsvr_R2_win32\gamemodes\CNR - Copy.pwn(6899) : warning 225: unreachable code
C:\Users\Asus\Desktop\samp03dsvr_R2_win32\gamemodes\CNR - Copy.pwn(9562) : warning 225: unreachable code
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
10 Warnings.
Line 2492 ---- 2580
Код:
public OnPlayerConnect(playerid)
{
new string[256], playername[MAX_PLAYER_NAME], file[255];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "%s has joined RuNix's Cops And Robbers!", playername);
Announce(string);
SetTimerEx("AntiTK", 3000, 1, "d", playerid);
IsPlayerLogged[playerid] = 0;
RecentlyRobbed[playerid] = 0;
//Text Draws
TextDrawShowForPlayer(playerid, BOX);
TextDrawShowForPlayer(playerid, Welcome);
TextDrawShowForPlayer(playerid, text1);
TextDrawShowForPlayer(playerid, text2);
TextDrawShowForPlayer(playerid, text3);
HaveTicket[playerid] = false;
new Registre[250];
format(file, sizeof(file), "%s.runix", playername);
if(fexist(file))
{
GetPlayerName(playerid,playername,MAX_PLAYER_NAME);
format(Registre,sizeof(Registre),"Welcome back %s!\n\nPlease Login to continue!",playername);
ShowPlayerDialog(playerid,LoginName,DIALOG_STYLE_INPUT,"Login",Registre,"Login","Ban");
}
else
if(!fexist(file))
{
GetPlayerName(playerid,playername,MAX_PLAYER_NAME);
format(Registre,sizeof(Registre),"Welcome %s!\n\nPlease register to continue!",playername);
ShowPlayerDialog(playerid,RegisterName,DIALOG_STYLE_INPUT,"Register",Registre,"Register","Ban");
}
SetTimerEx("WantedLevelMinus", 100, 1, "i", playerid);
return true;
bancheck(playerid);
GetPlayerIp(playerid, PIP, 18);
format(Query, sizeof(Query), "SELECT * FROM `playerinfo` WHERE `user` = '%s' LIMIT 1", escpname(playerid), PIP);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
new PIP2[18];
mysql_fetch_field_row(PIP2, "IP");
if(!strcmp(PIP, PIP2, true) && strlen(PIP2) != 0)
{
SetPVarInt(playerid, "Logged", 1);
SendClientMessage(playerid, 0x009600AA, "Auto Logged in!");
if(mysql_fetch_row(line))
{
new data[3][55];
new data2[5];
sscanf(line, "p<|>s[50]s[300]dddds[50]ds[100]", data[0], largestring, data2[0], data2[1], data2[2], data2[3], data[2], data2[4], estring);
stringempty(estring);
stringempty(largestring);
SetPVarInt(playerid, "Kills", data2[0]);
SetPVarInt(playerid, "Logged", 1);
SetPVarInt(playerid, "Deaths", data2[1]);
SetPlayerScore(playerid, data2[2]);
GivePlayerMoney(playerid, data2[3]);
SetPVarInt(playerid, "AdminLevel", data2[4]);
mysql_free_result();
}
}
else
{
SendClientMessage(playerid, 0x009600AA, "This account is registered, please login");
ShowPlayerDialog(playerid, 15000, DIALOG_STYLE_INPUT , "Login", "This account is registered, please login", "OK", "Cancel");
}
}
else
{
ShowPlayerDialog(playerid, 14600, DIALOG_STYLE_INPUT , "Register", "This account is not registered, please register!", "OK", "Cancel");
SendClientMessage(playerid, 0x009600AA, "This account is not registered, please register!");
}
mysql_free_result();
return 1;
}
Line 2739
Код:
public OnPlayerSpawn(playerid)
{
HideDraw(playerid);
SetPlayerInterior(playerid, 0);
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
if(gTeam[playerid] == CIVILIAN)
{
SetPlayerColor(playerid, WHITE);
new file[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "%s.runix", name);
new position = random(sizeof(CivilianSpawn));
SetPlayerPos(playerid, CivilianSpawn[position][0], CivilianSpawn[position][1], CivilianSpawn[position][2]);
SetPlayerFacingAngle(playerid, CivilianSpawn[position][3]);
SetCameraBehindPlayer(playerid);
TextDrawShowForPlayer(playerid, CIVBOX);
TextDrawShowForPlayer(playerid, text6);
TextDrawShowForPlayer(playerid, text7);
TextDrawShowForPlayer(playerid, text8);
TextDrawShowForPlayer(playerid, text10);
TogglePlayerControllable(playerid, true);
GivePlayerWeapon(playerid,5,1);
if(PlayerSkin[playerid] >= 0)
{
SetPlayerSkin(playerid,dini_Int(file, "Skin"));
}
}
else if(gTeam[playerid] == Medic)
{
SetPlayerColor(playerid, PINK);
new position = random(sizeof(MedicSpawn));
SetPlayerPos(playerid, MedicSpawn[position][0], MedicSpawn[position][1], MedicSpawn[position][2]);
SetPlayerFacingAngle(playerid, MedicSpawn[position][3]);
SetCameraBehindPlayer(playerid);
TextDrawShowForPlayer(playerid, MDCBOX);
TextDrawShowForPlayer(playerid, text15);
TextDrawShowForPlayer(playerid, text16);
TextDrawShowForPlayer(playerid, text17);
TextDrawShowForPlayer(playerid, text18);
GivePlayerWeapon(playerid,41,1000);
}
else if(gTeam[playerid] == COP)
{
new position = random(sizeof(CopSpawn));
SetPlayerColor(playerid, LIGHT_BLUE);
SetPlayerPos(playerid, CopSpawn[position][0], CopSpawn[position][1], CopSpawn[position][2]);
SetPlayerFacingAngle(playerid, CopSpawn[position][3]);
SetCameraBehindPlayer(playerid);
TextDrawShowForPlayer(playerid, COPBOX);
TextDrawShowForPlayer(playerid, text11);
TextDrawShowForPlayer(playerid, text12);
TextDrawShowForPlayer(playerid, text13);
TextDrawShowForPlayer(playerid, text14);
GivePlayerWeapon(playerid,25,100);
GivePlayerWeapon(playerid,22,100);
}
else if(gTeam[playerid] == SWAT || gTeam[playerid] == FBI)
{
SetPlayerColor(playerid, BLUE);
new position = random(sizeof(SFSpawn));
SetPlayerPos(playerid, SFSpawn[position][0], SFSpawn[position][1], SFSpawn[position][2]);
SetPlayerFacingAngle(playerid, SFSpawn[position][3]);
SetCameraBehindPlayer(playerid);
TextDrawShowForPlayer(playerid, COPBOX);
TextDrawShowForPlayer(playerid, text11);
TextDrawShowForPlayer(playerid, text12);
TextDrawShowForPlayer(playerid, text13);
TextDrawShowForPlayer(playerid, text14);
GivePlayerWeapon(playerid,29,400);
GivePlayerWeapon(playerid,22,100);
GivePlayerWeapon(playerid,31,300);
}
else if(gTeam[playerid] == ARMY)
{
SetPlayerColor(playerid, GREEN);
new position = random(sizeof(ARMYSpawn));
SetPlayerPos(playerid, ARMYSpawn[position][0], ARMYSpawn[position][1], ARMYSpawn[position][2]);
SetPlayerFacingAngle(playerid, ARMYSpawn[position][3]);
SetCameraBehindPlayer(playerid);
TextDrawShowForPlayer(playerid, COPBOX);
TextDrawShowForPlayer(playerid, text11);
TextDrawShowForPlayer(playerid, text12);
TextDrawShowForPlayer(playerid, text13);
TextDrawShowForPlayer(playerid, text14);
GivePlayerWeapon(playerid,29,400);
GivePlayerWeapon(playerid,22,100);
GivePlayerWeapon(playerid,31,300);
}
Spawned[playerid] = 1;
return true;
if(GetPVarInt(playerid, "Logged") == 1 && GetPVarInt(playerid, "MoneyGiven") > 0)
{
GivePlayerMoney(playerid, GetPVarInt(playerid, "MoneyGiven"));
SetPVarInt(playerid, "MoneyGiven", 0);
}
return 1;
}
Line 6899
Код:
public OnPlayerRequestSpawn(playerid)
{
if(IsPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, ERROR, "You need to login before the spawn. Type /login [password]!");
return false;
}
else if(IsPlayerLogged[playerid] == 1)
{
if(GetPlayerSkin(playerid) >= 280 && GetPlayerSkin(playerid) <= 288 || GetPlayerSkin(playerid) >= 274 && GetPlayerSkin(playerid) <= 276)
{
if(GetPlayerWantedLevel(playerid) > 0)
{
SendClientMessage(playerid, ERROR, "The Police are looking for you. Login as a Civilian and hand yourself.");
return false;
}
else if(GetPlayerWantedLevel(playerid) == 0) return true;
}
else return true;
}
return true;
if(GetPVarInt(playerid, "Logged") == 0)
{
format(Query, sizeof(Query), "SELECT `user` FROM `playerinfo` WHERE `user` = '%s' LIMIT 1" , escpname(playerid));
mysql_query(Query);
mysql_store_result();
if(!mysql_num_rows()) ShowPlayerDialog(playerid, 14600, DIALOG_STYLE_INPUT , "Register", "This account is not registered, please register!", "OK", "Cancel");
else ShowPlayerDialog(playerid, 15000, DIALOG_STYLE_INPUT , "Login", "This account is registered, please login", "OK", "Cancel");
return 0;
}
return 1;
}
Line 9562
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new file[256];
new name[MAX_PLAYER_NAME];
new Registre[250];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
if(dialogid == RegisterName)
{
if(!response) Kick(playerid);
{
if(strlen(inputtext) == 0) return ShowPlayerDialog(playerid,RegisterName,DIALOG_STYLE_INPUT,"Register","Invalid Password\nPlease enter an password!","Register","Ban");
format(file,sizeof(file),"%s.runix", name);
if(!fexist(file))
{
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(inputtext));
dini_IntSet(file, "Money", 2500);
dini_IntSet(file, "Score", 1);
dini_IntSet(file, "Bank", 1000);
format(Registre,sizeof(Registre),"Thanks for registering!\nYou may now login.",name);
ShowPlayerDialog(playerid,LoginName,DIALOG_STYLE_INPUT,"Login",Registre,"Login","Ban");
GameTextForPlayer(playerid, "~r~Registered!", 3000, 1);
}
}
}
if(dialogid == LoginName)
{
if(!response) Kick(playerid);
{
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
if(strlen(inputtext) == 0) return ShowPlayerDialog(playerid,LoginName,DIALOG_STYLE_INPUT,"Login","Invalit Password!\nPlease enter an password","Login","Ban");
format(file,sizeof(file),"%s.runix", name);
if(udb_hash(inputtext) != dini_Int(file, "Password")) return ShowPlayerDialog(playerid,LoginName,DIALOG_STYLE_INPUT,"Login","Wrong Password!\nPlease enter an password","Login","Ban");
else
{
IsPlayerLogged[playerid] = 1;
SetPlayerMoney(playerid, dini_Int(file, "Money"));
SetPlayerScore(playerid, dini_Int(file, "Score"));
AccountInfo[playerid][aLevel] = dini_Int(file, "Admin");
PlayerSkin[playerid] = dini_Int(file,"Skin");
SetPlayerWantedLevel(playerid, dini_Int(file, "WantedLevel"));
SendClientMessage(playerid, GREY, "You are now logged in. Your status will be saved on your logout.");
GameTextForPlayer(playerid, "~r~Logged In!", 3000, 1);
}
}
}
return 0;
if(dialogid == 14600)
{
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid, 14600, DIALOG_STYLE_INPUT , "Register", "This account is not registered, please register!", "OK", "Cancel");
SendClientMessage(playerid, 0xF60000AA, "Please enter a password");
}
else
{
mysql_real_escape_string(inputtext, escpass);
WP_Hash(largestring, sizeof(largestring), escpass);
GetPlayerIp(playerid, PIP, 50);
format(Query, sizeof(Query), "INSERT INTO `playerinfo` (`user`, `password`, `kills`, `deaths`, `score`, `money`, `IP`, `adminlvl`) VALUES ('%s', '%s', 0, 0, 0, 0, '%s', 0)", escpname(playerid), largestring, PIP);
mysql_query(Query);
GameTextForPlayer(playerid, "~g~Registered", 2000, 3);
SendClientMessage(playerid, 0x0000D9AA, "Registered and Logged into your account!");
SetPVarInt(playerid, "Logged", 1);
}
}
}
if(dialogid == 15000)
{
if(response)
{
WP_Hash(largestring, sizeof(largestring), inputtext);
format(Query, sizeof(Query), "SELECT * FROM `playerinfo` WHERE `user` = '%s' AND `password` = '%s' LIMIT 1", escpname(playerid), largestring);
mysql_query(Query);
mysql_store_result();
new rows = mysql_num_rows();
if(!rows)
{
SendClientMessage(playerid, 0xF60000AA, "Invalid password!");
SetPVarInt(playerid, "WrongPass", GetPVarInt(playerid, "WrongPass") + 1);
ShowPlayerDialog(playerid, 15000, DIALOG_STYLE_INPUT , "Login", "This account is registered, please login", "OK", "Cancel");
if(GetPVarInt(playerid, "WrongPass") == 3)
{
SendClientMessage(playerid, 0xF60000AA, "Max password tries exceeded!!");
Kick(playerid);
}
mysql_free_result();
}
else if(rows > 0)
{
if(mysql_fetch_row(line))
{
new data[3][55];
new data2[5];
sscanf(line, "p<|>s[50]s[300]dddds[50]ds[100]", data[0], largestring, data2[0], data2[1], data2[2], data2[3], data[2], data2[4], estring);
stringempty(estring);
stringempty(largestring);
SetPVarInt(playerid, "Kills", data2[0]);
SetPVarInt(playerid, "Logged", 1);
SetPVarInt(playerid, "Deaths", data2[1]);
SetPlayerScore(playerid, data2[2]);
GivePlayerMoney(playerid, data2[3]);
SetPVarInt(playerid, "AdminLevel", data2[4]);
SendClientMessage(playerid, 0x0000D9AA, "Logged in!");
mysql_free_result();
GetPlayerIp(playerid, PIP, 18);
format(Query, sizeof(Query), "UPDATE `playerinfo` SET IP = '%s' WHERE user='%s'", PIP, escpname(playerid));
mysql_query(Query);
}
}
}
}
return 1;
}
Re: warning 225: unreachable code +rep - T0pAz - 31.01.2012
Please see
this thread.
Re: warning 225: unreachable code +rep -
genesis87 - 31.01.2012
cheerios matey