Oko pawna


Započeo Pipajer, April 23, 2022, 08:53:09 PRE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

kada stisnem da se compilea izbaci mi error 002 " Only a single statement (or expression) can follow each case"
evo vam skripta pa recite sta je u redu a sta nije

link: https://pastebin.com/x5uc71jR
Poslednja Izmena: Maj 01, 2022, 22:55:46 POSLE PODNE od Deleted User

OnDialogResponse pocinje velikim slovom, takodje odredjene stvari nisi otvorio, odredjene nisi zatvorio. Nauci osnove i pogledaj kako se pise kod, topla preporuka da pogledas malo osnove C programskog jezika zbog iste sintakse.

Sredjen kod :

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{ //Otvaramo callback
	switch(dialogid)
	{ //Otvaramo switch
	    case DIALOG_REGISTER:
	    { //Otvaramo prvi case
		    if(!response) return Kick(playerid);
		    if(response)
		    { //Otvaramo response
		        if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Unesite vasu lozinku:", "Registruj se", "Odustani");
		        new INI:File = INI_Open(UserPath(playerid));
		        INI_SetTag(File, "data");
		        INI_WriteInt(File, "Lozinka", udb_hash(inputtext));
		        INI_WriteInt(File, "Novac", 25000);
		        INI_WriteInt(File, "Level", 2);
		        INI_WriteInt(File, "Respekti", 0);
		        INI_WriteInt(File, "Admin", 0);
		        INI_WriteInt(File, "NeededRep", 8);
		        INI_WriteInt(File, "Droga", 0);
		        INI_Close(File);
		        SpawnPlayer(playerid);
		        GivePlayerMoney(playerid, 25000);
		        SetCameraBehindPlayer(playerid);
		        PlayerInfo[playerid][pLevel] = 2;
		    } //Zatvaramo response
	    } //Zatvaramo case
	    case DIALOG_LOGIN:
	    { //Otvaramo case
	        if(!response) return Kick(playerid);
		    if(response)
		    { //Otvaramo response
		        if(udb_hash(inputtext) == PlayerInfo[playerid][pLozinka])
		        {
		            INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra=true, .extra=playerid);
		            GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]);
		        }
		        else
		        {
		            ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Unesite vasu lozinku:", "Prijavi se", "Odustani");
		        }
 
      		} //Zatvaramo response
      	} //Zatvaramo case
	} //Zatvaramo switch
	return 1;
} //Zatvaramo OnDialogResponse

Citat: V01D poslato April 23, 2022, 09:31:22 PRE PODNE
OnDialogResponse pocinje velikim slovom, takodje odredjene stvari nisi otvorio, odredjene nisi zatvorio. Nauci osnove i pogledaj kako se pise kod, topla preporuka da pogledas malo osnove C programskog jezika zbog iste sintakse.

Sredjen kod :

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{ //Otvaramo callback
	switch(dialogid)
	{ //Otvaramo switch
	    case DIALOG_REGISTER:
	    { //Otvaramo prvi case
		    if(!response) return Kick(playerid);
		    if(response)
		    { //Otvaramo response
		        if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Unesite vasu lozinku:", "Registruj se", "Odustani");
		        new INI:File = INI_Open(UserPath(playerid));
		        INI_SetTag(File, "data");
		        INI_WriteInt(File, "Lozinka", udb_hash(inputtext));
		        INI_WriteInt(File, "Novac", 25000);
		        INI_WriteInt(File, "Level", 2);
		        INI_WriteInt(File, "Respekti", 0);
		        INI_WriteInt(File, "Admin", 0);
		        INI_WriteInt(File, "NeededRep", 8);
		        INI_WriteInt(File, "Droga", 0);
		        INI_Close(File);
		        SpawnPlayer(playerid);
		        GivePlayerMoney(playerid, 25000);
		        SetCameraBehindPlayer(playerid);
		        PlayerInfo[playerid][pLevel] = 2;
		    } //Zatvaramo response
	    } //Zatvaramo case
	    case DIALOG_LOGIN:
	    { //Otvaramo case
	        if(!response) return Kick(playerid);
		    if(response)
		    { //Otvaramo response
		        if(udb_hash(inputtext) == PlayerInfo[playerid][pLozinka])
		        {
		            INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra=true, .extra=playerid);
		            GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]);
		        }
		        else
		        {
		            ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Unesite vasu lozinku:", "Prijavi se", "Odustani");
		        }
 
      		} //Zatvaramo response
      	} //Zatvaramo case
	} //Zatvaramo switch
	return 1;
} //Zatvaramo OnDialogResponse

if(!response) return Kick(playerid);
		    if(response)

xD

Citat: Pipajer poslato April 23, 2022, 08:53:09 PRE PODNE
kada stisnem da se compilea izbaci mi error 002 " Only a single statement (or expression) can follow each case"
evo vam skripta pa recite sta je u redu a sta nije

link: https://pastebin.com/x5uc71jR
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])	{
	switch(dialogid)	{
		case DIALOG_REGISTER:	{
			if(!response) return Kick(playerid);
			if(response)	{
				if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Unesite vasu lozinku:", "Registruj se", "Odustani");
				new INI:File = INI_Open(UserPath(playerid));
				INI_SetTag(File, "data");
				INI_WriteInt(File, "Lozinka", udb_hash(inputtext));
				INI_WriteInt(File, "Novac", 25000);
				INI_WriteInt(File, "Level", 2);
				INI_WriteInt(File, "Respekti", 0);
				INI_WriteInt(File, "Admin", 0);
				INI_WriteInt(File, "NeededRep", 8);
				INI_WriteInt(File, "Droga", 0);
				INI_Close(File);
				SpawnPlayer(playerid);
				GivePlayerMoney(playerid, 25000);
				SetCameraBehindPlayer(playerid);
				PlayerInfo[playerid][pLevel] = 2;
			}
		}
		case DIALOG_LOGIN:	{
			if(!response) return Kick(playerid);
			if(response)	{
				if(udb_hash(inputtext) == PlayerInfo[playerid][pLozinka])	{
				INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra=true, .extra=playerid);
				GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]);
			}
			else	{
				ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Unesite vasu lozinku:", "Prijavi se", "Odustani");
			}	        
		}
	}
	return 1;
}

Evo ti sredjena komanda, par viticasti zagrada nisi zatvorio. Probaj sad pa javi radil
Alen Hadzimustafic