Jump to content
  • 0

pomoc Input text - Pomoc


PanRožokRohliik

Dotaz

13 odpovědí na tuto otázku

Recommended Posts

  • 0

Někam nahoru dej proměnnou:

new InputtextSave[50];

Do OnDialogResponse u dialogu 201 dej:

format(InputtextSave,sizeof(InputtextSave),inputtext);

A pak to použij takto:

format(str,128,"Prostě tady bude text - č1 %s č2. %s", InputtextSave, inputtext);
Link to comment
Share on other sites

  • 0

Původně jsem to chtěl zkusit ještě takto, ale to je asi blbost ?

ublic OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
   if (dialogid == 200)
    {
   	if(response == 1)
	{
	if(listitem == 0)
	{
	new nazev = strval(inputtext);
	SetPVarInt(playerid, "Nazev", nazev);
	ShowPlayerDialog(playerid,201,DIALOG_STYLE_INPUT,"Název Eventu","Text č.1","Pokračovat","");
	}
	}
	}
	if (dialogid == 201)
  	{
	if(response == 1)
	{
    ShowPlayerDialog(playerid,202,DIALOG_STYLE_INPUT,"Název Eventu","Text č.2","Pokračovat","");
	}
	}
 	if (dialogid == 202)
	{
	if(response == 1)
	{
    if(!response) return SendClientMessage(playerid,0xFFFFFFFF,"Nezadal si text"); 
    new nazev = SetPVarInt(playerid, "Nazev", nazev);
	new str[128], castka = strlen(inputtext);
	format(str,128,"Prostě tady bude text - První %s Druhý %s", nazev, castka);
	SendClientMessage(playerid,0xFFFFFFFF,str); 
	}
	}
	return 1;
	}



Link to comment
Share on other sites

  • 0

 

Původně jsem to chtěl zkusit ještě takto, ale to je asi blbost ?

ublic OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
   if (dialogid == 200)
    {
   	if(response == 1)
	{
	if(listitem == 0)
	{
	new nazev = strval(inputtext);
	SetPVarInt(playerid, "Nazev", nazev);
	ShowPlayerDialog(playerid,201,DIALOG_STYLE_INPUT,"Název Eventu","Text č.1","Pokračovat","");
	}
	}
	}
	if (dialogid == 201)
  	{
	if(response == 1)
	{
    ShowPlayerDialog(playerid,202,DIALOG_STYLE_INPUT,"Název Eventu","Text č.2","Pokračovat","");
	}
	}
 	if (dialogid == 202)
	{
	if(response == 1)
	{
    if(!response) return SendClientMessage(playerid,0xFFFFFFFF,"Nezadal si text"); 
    new nazev = SetPVarInt(playerid, "Nazev", nazev);
	new str[128], castka = strlen(inputtext);
	format(str,128,"Prostě tady bude text - První %s Druhý %s", nazev, castka);
	SendClientMessage(playerid,0xFFFFFFFF,str); 
	}
	}
	return 1;
	}



Není to blbost, akorát jsi použil špatnou funkci.

 

http://wiki.sa-mp.com/wiki/SetPVarString

http://wiki.sa-mp.com/wiki/GetPVarString

 

Pak když stim už nebudeš muset pracovat tak http://wiki.sa-mp.com/wiki/DeletePVar

Edited by Steam wallet
Link to comment
Share on other sites

  • 0

Zbytečně nechci zakládat nové téma, tak se chci zeptat, v čem je tady problém...Celkem si nevím rady (podmínky a já no :d)

new id;
if (neco1[id] == 0 || neco[id] == 0) return SendClientMessage(playerid, -1, "Tady patří text, že");
{
	SetPlayerPos(playerid, poziceX, poziceY, poziceZ);
}
else if(ks[id] == 1);
{
SetPlayerPos(playerid, -183.1087,1884.3951,115.7031);
}
}

Errory: (Řádek 76) - else if(ks[id] == 1);

 

error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found "if"
error 036: empty statement
fatal error 107: too many error messages on one line
Link to comment
Share on other sites

  • 0

 

Zbytečně nechci zakládat nové téma, tak se chci zeptat, v čem je tady problém...Celkem si nevím rady (podmínky a já no icon_e_biggrin.gif)

new id;
if (neco1[id] == 0 || neco[id] == 0) return SendClientMessage(playerid, -1, "Tady patří text, že");
{
	SetPlayerPos(playerid, poziceX, poziceY, poziceZ);
}
else if(ks[id] == 1);
{
SetPlayerPos(playerid, -183.1087,1884.3951,115.7031);
}
}

Errory: (Řádek 76) - else if(ks[id] == 1);

 

error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found "if"
error 036: empty statement
fatal error 107: too many error messages on one line

 

Nemôže použiť IF a hneď naň return ak chceš použiť {} :d

 

buď:

if (....) return haha1;

else (...)

{

 haha2;

}else haha3;

 

čo by som nedoporučoval nakoľko ak sa splní prvá podmienka, skončí celý public

 

lepšie je :

if(...)

{

 haha1;

}

else if(...)

{

 haha2;

}

else

{

 haha3;

}

else if se váže na if, který ti tam chybí, a nemůže tam být takto samostatně

 

https://pawno.cz/topic/53495-6-podmínky-a-větvení/

Nechýba, akurát ho má zle napísané...

Link to comment
Share on other sites

  • 0

Chybi mu tam if k else if.

 

Muze mit

if(...) return;
{
    ...
}
to je korektni. Problem nastava az v tom else if, kdy blok nad nim se nevztahuje k zadnemu if - chybi mu tam if. Edited by Lukasz
  • Líbí se mi to! (+1) 2
Link to comment
Share on other sites

  • 0

Chybi mu tam if k else if.

 

Muze mit

if(...) return;
{
    ...
}
to je korektni. Problem nastava az v tom else if, kdy blok nad nim se nevztahuje k zadnemu if - chybi mu tam if.

 

ano, v tom máš síce pravdu, systém ti chybu nevyhodí ale zápis je nezmyseľný

 

{} sú v tomto prípade úplne zbytočné a mätúce

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...