Jump to content
  • 0

pomoc Help shop PROSÍM


Pingvin

Dotaz

Popis problému:

Ahoj mam takovi problem viz kod je to tam popsane tak jestli byste mi stim nepomohly

 

Chyby/varování kompilátoru a při běhu:

--

 

Kód:

 

#include 
#include 

new Bagety[MAX_PLAYERS];

CMD:obchod(playerid, params[])
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Obchod","Zadajte Kolik chces koupit baget","Potvrdit","Odejit"); //kdyz tady napise 5
return 1;
}
//==============================================================================
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
if(response == 1)
{
GivePlayerMoney(playerid,-20); //to je cena jedne bagety
Bagety[playerid]++; //tak tady aby mu to dalo 5 baget to prave nevim jak udelat dava mu to pouze 1 vzdy
//max baget co si bude moc koupit by belo byt 100
}
}
return 1;
}

CMD:ucet(playerid, params[])
{
new str[128];
format(str,128,"baget %d",Bagety[playerid]);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_MSGBOX,"Info",str,"Konec","");
return 1;
}

 

 

 

Dodatečné poznámky:

--

Link to comment
Share on other sites

6 odpovědí na tuto otázku

Recommended Posts

  • 0
  • Hlavní moderátor
#include

#include

b1d.jpg

 

Připoj include a_samp - #include . Vzhledem k tomu, že jsi ani pořádně nepopsal chybu, tuším, že to bude tohle. Pak se ozvi, co je dál za problém.

  • Líbí se mi to! (+1) 1
Link to comment
Share on other sites

  • 0
chci udelat ze kdyz hrac zada v tom dialogu 5 tak ze mu to da 5 baget a odecte 100 korun protoze 1 stoji 20 korun

 

a nevim jak to nastavit v ondialogresponse aby mu to pridalo 5 baget kdyz zada v dialogu 5 baget ze si chce koupit 

 

a max pocet co si jich muze koupit by mel byt 100ks

 

predem se omlouvam za vhozeni kodu takhle jak jsem to dal do spoileru tak se neukazal celi

 

 

 

 

 

 

 

#include <a_samp>

#include <zcmd>

 

new Bagety[MAX_PLAYERS];

new Text:himessage;

 

CMD:obchod(playerid, params[])

{

ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Obchod","Zadajte Kolik chces koupit baget","Potvrdit","Odejit"); //kdyz tady napise 5

return 1;

}

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

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

{

if(dialogid == 1)

{

if(response == 1)

{

GivePlayerMoney(playerid,-20); //to je cena jedne bagety

Bagety[playerid]++; //tak tady aby mu to dalo 5 baget to prave nevim jak udelat dava mu to pouze 1 vzdy

//max baget co si bude moc koupit by belo byt 100

}

}

return 1;

}

Link to comment
Share on other sites

  • 0

#define MAX_BAGETS 100

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
if(response)
{
new string[100];
new bageta = strval(inputtext);
if(bageta < 1 || bageta > MAX_BAGETS) return ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Obchod","Zadajte Kolik chces koupit baget\nMaximálně si můžete koupit "#MAX_BAGETS" baget","Potvrdit","Odejit");
if(Bagety[playerid] == MAX_BAGETS) return ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Obchod","Zadajte Kolik chces koupit baget\nJiž sis koupil maximum baget","Potvrdit","Odejit");
if(bageta + Bagety[playerid] > MAX_BAGETS) return ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Obchod","Zadajte Kolik chces koupit baget\nNemůžeš si koupit tolik baget","Potvrdit","Odejit");
format(string,sizeof(string),"[ ! ] Koupil sis %d baget za %d$.",bageta, bageta*20);
SendClientMessage(playerid,0xFF0000FF,string);
Bagety[playerid] += bageta;
GivePlayerMoney(playerid,bageta*-20);
}
return 1;
}
return 0;
}
  • Líbí se mi to! (+1) 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...