SA-MP Forums Archive
Should return value - 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: Should return value (/showthread.php?tid=648736)



Should return value - Longover - 27.01.2018

Код:
C:\Users\Sorin\Desktop\Gamemode De La 0\gamemodes\Kernel.pwn(504) : warning 209: function "OnDialogResponse" should return a value
The public:
Код:
public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_REGISTER)
	    {
            new rPassword[24], liYear, liMonth, liDay, rQuery[4096], sStr[500], sStr2[500];
            //------------------------------------------------------------------
	        if(!response)
			{
				Kick(playerid);
			}
	        if(sscanf(inputtext, "s[24]", rPassword)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "EROARE", "{00FF00}Scrie parola pe care ti-o doresti,\n{FFFF00}Aceasta parola trebuie sa fie intre {FF0000}6-24{FFFF00} caractere!", "Inregistrare", "Iesire");
			if(strlen(rPassword) < 6 || strlen(rPassword) > 24) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "EROARE", "{00FF00}Scrie parola pe care ti-o doresti,\n{FFFF00}Aceasta parola trebuie sa fie intre {FF0000}6-24{FFFF00} caractere!", "Inregistrare", "");
            //------------------------------------------------------------------
			if(strfind(rPassword, "'", true) != -1) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "EROARE", "{00FF00}Aceasta parola nu poate contine simboluri: {FF0000}('){FFFF00}!", "Inregistrare", "");
			//------------------------------------------------------------------
			getdate(liYear, liMonth, liDay); ResetPlayerMoney(playerid), GivePlayerMoney(playerid, 25000), SetPlayerScore(playerid, 100);
            //------------------------------------------------------------------
            //MySQL INSERT
            new stringip[30];
            GetPlayerIp(playerid, stringip, 30);
            //------------------------------------------------------------------
			format(rQuery, 4096, "INSERT INTO `Conturi` (`ID`, `Name`, `Password`, `IP`, `RegisterDate`, `Level`, `Exp`, `Cash`, `Score`, `Weapon1`, `Weapon2`, `Weapon3`, `Weapon4`, `Weapon5`, `Weapon6`, `Weapon7`, `Weapon8`, `Weapon9`, `Weapon10`, `Weapon11`, `Weapon12`, \
											  `Kills`, `Deaths`, `Hours`, `Minutes`, `KillingSpree`, `Skin`, `House`, `Biz`, `Admin`, `HP`, `Armour`, `Wanted`");
			//------------------------------------------------------------------
			format(rQuery, 4096, "%s `Warns`, `TeamID`, `TeamKills`, `TeamDeaths`, `TeamRank`, `Wanted`, `Car`,\
											  `Team`)", rQuery);
			//------------------------------------------------------------------
			format(rQuery, 4096, "%s VALUES (0, '%s', '%s', '%s', '1', '%02d/%02d/%02d', '%02d/%02d/%02d', \
											'0', '0', '25000', '100', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '217', '1', '0', '0', \
											' ', ' ', ' ', '0', '0', '0', '0', '0', '0', '0', \
											'0', '0', '0', '0', '0', '0', '0', '0', '0', '00:00', '0', '00:00', '0', '00:00', \
											'0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', \
											'0/0/0/0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0')", rQuery, GetName(playerid), rPassword, stringip, liDay, liMonth, liYear, liDay, liMonth, liYear);
			//------------------------------------------------------------------
			mysql_tquery(DB_Connect, rQuery, "OnAccountCreated", "i", playerid);
			//------------------------------------------------------------------
   			format(sStr2, sizeof(sStr2), "{00FF00}Salut {FF0000}%s{00FF00}!\n", GetName(playerid));
			strcat(sStr, sStr2, sizeof(sStr));
			strcat(sStr, "{00FF00}Ai Fost Inregistrat la TeamBattleRomania\n", sizeof(sStr));
			format(sStr2, sizeof(sStr2), "{00FF00}Tine minte! Cand te loghezi te poti inregistra co parola: {FF0000}%s{00FF00}!\n\n", rPassword);
			strcat(sStr, sStr2, sizeof(sStr));
			strcat(sStr, "{FFFF00}Pentru mai multe informatii apasa pe butonul: {FF0000}Ajutor{FFFF00}.\n", sizeof(sStr));
			//----------------------------------------------------------
			return ShowPlayerDialog(playerid, DIALOG_AREGISTER, DIALOG_STYLE_MSGBOX, "Inregistrare Reusita!", sStr, "Inchide", "Ajutor");
	}
	if(dialogid == DIALOG_LOGIN)
	{
	     if(!response) return;
			new lPassword[25], Query[512]; eString[0] = EOS;
			//------------------------------------------------------------------
			if(sscanf(inputtext, "s[25]", lPassword))
			{
            	format(eString, sizeof(eString), "{00FF00}Bun venit inapoi: {FF0000}%s{00FF00}!\n\
												  \n\
											      {FFFF00}Te rog inregistreaza-te pentru a continua!",GetName(playerid));
				//--------------------------------------------------------------
	      		ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Logare", eString, "Logare", "Iesire");
			}
			if(strlen(inputtext) < 3 || strlen(inputtext) > 24) return
			ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Logare", "{00FF00}Te rog,scrie-ti parola", "Logare", "Iesire");
            //------------------------------------------------------------------
			if(strfind(inputtext, "'", true) != -1) return
			ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Logare", "{00FF00}Trebuie sa-ti scrii parola pentru a continua!\n{FFFF00}Nu poti scrie vre-o parola cu vre-un simbol!", "Logare", "Iesire");
            //------------------------------------------------------------------
			else
			{
			    mysql_real_escape_string(inputtext, lPassword, DB_Connect);
				//--------------------------------------------------------------
				format(Query, sizeof(Query), "SELECT * FROM `Conturi` WHERE `Name` = '%s' AND `Password` = '%s'", GetName(playerid), lPassword);
				mysql_tquery(DB_Connect, Query, "LoadPlayerData", "is", playerid, GetName(playerid));
				//--------------------------------------------------------------
			}
	return 1;
	}
	return 0;
}
HELP!


Re: Should return value - RogueDrifter - 27.01.2018

not sure since you managed to make the code look hideous with that weird indentation but try removing the return from
Код:
return ShowPlayerDialog(playerid, DIALOG_AREGISTER, DIALOG_STYLE_MSGBOX, "Inregistrare Reusita!", sStr, "Inchide", "Ajutor");



Re: Should return value - edyun - 28.01.2018

The main reason is what Rouge said aswell, the return is mainly not registered over there, try removing it from where Rouge said, and come with an update, hope we helped you my fellow friend.