Jump to content
  • 0

pomoc [Help]Dialog u banky.


_NitroUs

Dotaz

Dobrý den,

 

mám takový problém. V módu mám banku přes dialog, ale když vstoupím na ikonu banky ukáže se mi: "Vložit peníze, Vybrat...." A když dám třeba "Vložit peníze", tak se mi sice ukáže dialog, ale během ani ne 2 vteřin zmizne a objeví se zase dialog s "Vložit peníze, Vybrat....."

Nevíte, jak to mám opravit?

 

Děkuji.

 

if(dialogid == 150)
{
if(response == 1)
{
if(listitem == 0)
{
ShowPlayerDialog(playerid,151,DIALOG_STYLE_INPUT,"Banka","Vložit peníze na účet.\nNapiš částku.","Vložit","Konec");
}
else if(listitem == 1)
{
ShowPlayerDialog(playerid,152,DIALOG_STYLE_INPUT,"Banka","Vybrat peníze z účtu.\nNapiš částku.","Vybrat","Konec");
}
else if(listitem == 2)
{
new string[256];
format(string, sizeof(string), "Na účtu máš nyní\n\n%d$", Banka[playerid]);
ShowPlayerDialog(playerid,150,DIALOG_STYLE_MSGBOX,"Banka",string,"Ok","Konec");
}
}
}

//==============================================================================

if(dialogid == 151)
{
if(response == 1)
{
if(IsPlayerInSphere(playerid, 2316.0383,-8.1519,26.7422,5) == 1)
{
new castka = strval(inputtext[0]);
if(!inputtext[0])
{
ShowPlayerDialog(playerid,151,DIALOG_STYLE_INPUT,"Banka","Musíš napsat nějakou částku !\nNapiš částku.","Vložit","Konec");
return 1;
}
new string[256];
new string2[256];
if(IsPlayerConnected(playerid))
{
new sendermoney = GetPlayerMoney(playerid);
if(castka <= sendermoney)
{
if(castka > 0)
{
Banka[playerid] +=castka;
GivePlayerMoney(playerid,-castka);
format(string, sizeof(string), "[ ! ] {FFFFFF}Uložil jsi na tvé konto: %d$", castka);
SendClientMessage(playerid, BARVA_RED, string);
format(string2, sizeof(string), "[ ! ] {FFFFFF}Stav tvého konta: %d$", Banka[playerid]);
SendClientMessage(playerid, BARVA_RED, string2);
}else{
ShowPlayerDialog(playerid,151,DIALOG_STYLE_INPUT,"Banka","Musíte zadat číslo !\nNapiš částku.","Vložit","Konec");
}
}else{
ShowPlayerDialog(playerid,151,DIALOG_STYLE_INPUT,"Banka","Nemáte u sebe tolik peněz !\nNapiš částku.","Vložit","Konec");
}
}
}
}
}
//==============================================================================
if(dialogid == 152)
{
if(response == 1)
{
if(IsPlayerInSphere(playerid,2316.0383,-8.1519,26.7422,5) == 1)
{
new castka = strval(inputtext[0]);
if(!inputtext[0])
{
ShowPlayerDialog(playerid,152,DIALOG_STYLE_INPUT,"Banka","Musíš napsat částku !\nNapiš částku.","Vybrat","Konec");
return 1;
}
new string[256];
new string2[256];
if(IsPlayerConnected(playerid))
{
if(castka <= Banka[playerid])
{
if(castka > 0)
{
Banka[playerid] -=castka;
GivePlayerMoney(playerid,castka);
format(string, sizeof(string), "[ ! ] {FFFFFF}Bylo vybráno %d$ z tvého konta", castka);
SendClientMessage(playerid, BARVA_RED, string);
format(string2, sizeof(string), "[ ! ] {FFFFFF}Stav tvého konta: %d$", Banka[playerid]);
SendClientMessage(playerid, BARVA_RED, string2);
}else{
ShowPlayerDialog(playerid,152,DIALOG_STYLE_INPUT,"Banka","Musíte zadat číslo !\nNapiš částku.","Vybrat","Konec");
}
}else{
ShowPlayerDialog(playerid,152,DIALOG_STYLE_INPUT,"Banka","V bance nemáš tolik peněz !\nNapiš částku.","Vybrat","Konec");
}
}
}
}
}

 

Link to comment
Share on other sites

6 odpovědí na tuto otázku

Recommended Posts

  • 0

Ale mám další chybu :(

 

Když uložím do banky třeba 500$ a potom dalších třeba 100$, tak místo toho abych tam měl 600$ (500+100), tak tam mám 100$. Prostě se mi ty peníze co uložím nesčítají. Nevíte čím to je? :) Děkuji

Link to comment
Share on other sites

  • 0

ukazu ti to takhle :

new castka = strval(inputtext);//inputtext je to co vypises do dialogu kdybys nevedel

if(castka > GetPlayerMoney(playerid)) return SendClientMessage(playerid, COLOR_RED, "Špatná částka!");//pokud zada vetsi castku nez ma u sebe penez

if(castka < 0) return SendClientMessage(playerid, COLOR_RED, "Špatná částka!"); aby nevydelaval penize tak ze pujde v bance do minusu

banka[playerid] += castka;//pricte hodnotu k bance

GivePlayerMoney(playerid, -castka);//odebere penize ktere vlozil do banky

Link to comment
Share on other sites

  • 0

GivePlayerMoney ti peníze nastavuje a ne přidává. Takže musíš počítat i s tím, co už u sebe máš.

 

new P = GetPlayerMoney(playerid);
GivePlayerMoney(playerid, P+1000);

Tento script ti přidá 1000$.

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...