Jump to content

Styl Boje přes Prikaz + Dialog


Kavi

Recommended Posts

Zdravim all lidi z pawno ;) Dávám sem taký Mini TUT

nebo už asi 4lamka se mě na to ptala :d a hlavne.. pro amatéry PWN.

 

-Spočívá to ve STYLU_BOJE

 

takže nejdříve nadefinujeme ID Dialogu nikam nahoru do modu

 

#define DIALOG_BOJ   1 // 1 = ID xD  mužete zmenit 

 

Pak

Do public OnPlayerCommandText(playerid, cmdtext[])

 
dcmd(boj,3,cmdtext);

dcmd_boj(playerid,params[]) //např /boj 
{

#pragma unused params
ShowPlayerDialog(playerid,DIALOG_BOJ,DIALOG_STYLE_LIST,"Vyber boj","Normalní\nBox\nKungfu\nHlavu a Koleno\nGrap Kop\nLoket","Vybrat","Pryč");
return 1;
}

 

Po té

Do publicOnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

 

 

 if(dialogid == DIALOG_BOJ) 
  {
     if(response == 1) 
     {
  switch(listitem)
     {
     case 0:
     {
  SetPlayerFightingStyle(playerid, FIGHT_STYLE_NORMAL);
  SendClientMessage(playerid, RED,"Nastavil sis styl boje Normalní");
 	   }
      case 1:
       {
     SetPlayerFightingStyle(playerid, FIGHT_STYLE_BOXING);
     SendClientMessage(playerid, RED,"Nastavil sis styl boje Box");
      }
      case 2:
      {
   SetPlayerFightingStyle(playerid, FIGHT_STYLE_KUNGFU);
   SendClientMessage(playerid, RED,"Nastavil sis styl boje Kungfu");
    }
      case 3:
      {
   SetPlayerFightingStyle(playerid, FIGHT_STYLE_KNEEHEAD);
   SendClientMessage(playerid, RED,"Nastavil sis styl boje Hlavu + Koleno");
    }
      case 4:
      {
   SetPlayerFightingStyle(playerid, FIGHT_STYLE_GRABKICK);
    SendClientMessage(playerid, RED,"Nastavil sis styl boje Grap Kop");
     }
      case 5:
      {
   SetPlayerFightingStyle(playerid, FIGHT_STYLE_ELBOW);
    SendClientMessage(playerid, RED,"Nastavil sis styl boje Loket");
                          }
                   }
                    }
                     }
     return 1;
}

 

a To je všeco...

DOBA KODOVÁNÍ = 5MIN

ERORRY = Nwm :d Netestoval sem ale melo by to jít bez problemů kdeby neco pište... erorry

Link to comment
Share on other sites

Hele nedelej zesebe chytrýho asi sem psal že to je skrs lamky!!!!! a nekoukal sem či to tu je... a jestli jo tak ne takhle přehledně pres dialog bych rek ..

Link to comment
Share on other sites

l*ma by se ptala proc ma error u dmcd (nemas definici) jinak fakt to je pro lamy(1/10 za snahu)

 

xD ajo diky :d uplně sem zapomel xD = Opraveno xD

Link to comment
Share on other sites

podle mě to máš moc zdlouhavé

hodnoty bojovych umeni jsou definované myslím od 0 do 5

a tak by vpoho stacilo

 

if(dialogid == DIALOG_BOJ) {
if(response == 1) {
SetPlayerFightingStyle(playerid, listitem);
}}

Link to comment
Share on other sites

  • 3 weeks later...

prominte ze pisu do stareho topicu, ale pise mi to jeden a ten samej error a to:

error 010: invalid function or declaration

a tohle je presne napr radek: if(dialogid == DIALOG_STYLBOJE)

tento...

Link to comment
Share on other sites

 

if(dialogid == DIALOG_STYLBOJE)

{

if(response == 1)

{

switch(listitem)

{

case 0:

{

SetPlayerFightingStyle(playerid, FIGHT_STYLE_NORMAL);

SendClientMessage(playerid, COLOR_LIME,"[ ! ] Nastavil sis styl boje Normalní !");

SetPlayerColor(playerid,COLOR_AQUA);

}

case 1:

{

SetPlayerFightingStyle(playerid, FIGHT_STYLE_BOXING);

SendClientMessage(playerid, COLOR_LIME,"[ ! ] Nastavil sis styl boje Box !");

SetPlayerColor(playerid,COLOR_RED);

}

case 2:

{

SetPlayerFightingStyle(playerid, FIGHT_STYLE_KUNGFU);

SendClientMessage(playerid, COLOR_LIME,"[ ! ] Nastavil sis styl boje Kungfu !");

SetPlayerColor(playerid,COLOR_LIME);

}

case 3:

{

SetPlayerFightingStyle(playerid, FIGHT_STYLE_KNEEHEAD);

SendClientMessage(playerid, COLOR_LIME,"[ ! ] Nastavil sis styl boje Hlavu + Koleno !");

SetPlayerColor(playerid,COLOR_GREEN);

}

case 4:

{

SetPlayerFightingStyle(playerid, FIGHT_STYLE_GRABKICK);

SendClientMessage(playerid, COLOR_LIME,"[ ! ] Nastavil sis styl boje Grap Kick !");

SetPlayerColor(playerid,COLOR_YELLOW);

}

case 5:

{

SetPlayerFightingStyle(playerid, FIGHT_STYLE_ELBOW);

SendClientMessage(playerid, COLOR_LIME,"[ ! ] Nastavil sis styl boje Loket !");

SetPlayerColor(playerid,COLOR_CRIMSON);

}

}

}

}

return 1;

}

 

Link to comment
Share on other sites

if(dialogid == DIALOG_STYLBOJE)

{

if(response == 1)

{

switch(listitem)

{

case 0:

{

SetPlayerFightingStyle(playerid, FIGHT_STYLE_NORMAL);

SendClientMessage(playerid, COLOR_LIME,"[ ! ] Nastavil sis styl boje Normalní !");

SetPlayerColor(playerid,COLOR_AQUA);

}

case 1:

{

SetPlayerFightingStyle(playerid, FIGHT_STYLE_BOXING);

SendClientMessage(playerid, COLOR_LIME,"[ ! ] Nastavil sis styl boje Box !");

SetPlayerColor(playerid,COLOR_RED);

}

case 2:

{

SetPlayerFightingStyle(playerid, FIGHT_STYLE_KUNGFU);

SendClientMessage(playerid, COLOR_LIME,"[ ! ] Nastavil sis styl boje Kungfu !");

SetPlayerColor(playerid,COLOR_LIME);

}

case 3:

{

SetPlayerFightingStyle(playerid, FIGHT_STYLE_KNEEHEAD);

SendClientMessage(playerid, COLOR_LIME,"[ ! ] Nastavil sis styl boje Hlavu + Koleno !");

SetPlayerColor(playerid,COLOR_GREEN);

}

case 4:

{

SetPlayerFightingStyle(playerid, FIGHT_STYLE_GRABKICK);

SendClientMessage(playerid, COLOR_LIME,"[ ! ] Nastavil sis styl boje Grap Kick !");

SetPlayerColor(playerid,COLOR_YELLOW);

}

case 5:

{

SetPlayerFightingStyle(playerid, FIGHT_STYLE_ELBOW);

SendClientMessage(playerid, COLOR_LIME,"[ ! ] Nastavil sis styl boje Loket !");

SetPlayerColor(playerid,COLOR_CRIMSON);

}

}

}

}

return 1;

}

 

to je jediné co je v publicu OnDialog?

Link to comment
Share on other sites

podle mě to máš moc zdlouhavé

hodnoty bojovych umeni jsou definované myslím od 0 do 5

a tak by vpoho stacilo

 

if(dialogid == DIALOG_BOJ) {
if(response == 1) {
SetPlayerFightingStyle(playerid, listitem);
}}

 

aj ja som to chcel postnuť

ale toto som zistil

 

 

#define FIGHT_STYLE_NORMAL 4

#define FIGHT_STYLE_BOXING 5

#define FIGHT_STYLE_KUNGFU 6

#define FIGHT_STYLE_KNEEHEAD 7

#define FIGHT_STYLE_GRABKICK 15

#define FIGHT_STYLE_ELBOW 16

Link to comment
Share on other sites

 

if(dialogid == DIALOGID)

{

if(response)

{

if(listitem == 0)

{

ShowPlayerDialog(playerid, DIALOGID+1, DIALOG_STYLE_LIST, "Bojove Styly", "Elbow\nBoxing\nGrabkick\nKneehead\nKungfu\nNormal", "Select", "Cancel");

}

}

return 1;

}

if(dialogid == DIALOGID+1)

{

if(response)

{

if(listitem == 0)

{

SetPlayerFightingStyle (playerid, FIGHT_STYLE_ELBOW);

}

if(listitem == 1)

{

SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);

}

if(listitem == 2)

{

SetPlayerFightingStyle (playerid, FIGHT_STYLE_GRABKICK);

}

if(listitem == 3)

{

SetPlayerFightingStyle (playerid, FIGHT_STYLE_KNEEHEAD);

}

if(listitem == 4)

{

SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);

}

if(listitem == 5)

{

SetPlayerFightingStyle (playerid, FIGHT_STYLE_NORMAL);

}

}

return 1;

}

return 0;

}

 

je to co si chtel?

 

-- sob 19. bře 2011 22:37:00 --

 

jinak od zacatku OnDialog... po prvni public je to tak:

 

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

{

if (response && dialogid == DIALOGID_PM)

{

if (!IsPlayerConnected(PlayerPMTarget[playerid])) return SendClientMessage(playerid, 0xE10000AA, "[ ! ] Hráč neni připojen!");

 

new msg[128];

new msg2[128];

format(msg, 128, "[PM] Od %s : %s", Jmeno(playerid), inputtext);

SendClientMessage(PlayerPMTarget[playerid], 0xFFFF00AA, msg);

format(msg2, 128, "[PM] Odeslana hraci %s : %s", Jmeno(PlayerPMTarget[playerid]), inputtext);

SendClientMessage(playerid, 0xFFFF00AA, msg2);

PlayerPMTarget[playerid] = INVALID_PLAYER_ID;

}

return 1;

}

//----------------------------------------------------------------------------//

if(dialogid == DIALOGID)

{

if(response)

{

if(listitem == 0)

{

ShowPlayerDialog(playerid, DIALOGID+1, DIALOG_STYLE_LIST, "Bojove Styly", "Elbow\nBoxing\nGrabkick\nKneehead\nKungfu\nNormal", "Select", "Cancel");

}

}

return 1;

}

if(dialogid == DIALOGID+1)

{

if(response)

{

if(listitem == 0)

{

SetPlayerFightingStyle (playerid, FIGHT_STYLE_ELBOW);

}

if(listitem == 1)

{

SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);

}

if(listitem == 2)

{

SetPlayerFightingStyle (playerid, FIGHT_STYLE_GRABKICK);

}

if(listitem == 3)

{

SetPlayerFightingStyle (playerid, FIGHT_STYLE_KNEEHEAD);

}

if(listitem == 4)

{

SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);

}

if(listitem == 5)

{

SetPlayerFightingStyle (playerid, FIGHT_STYLE_NORMAL);

}

}

return 1;

}

return 0;

}

 

Link to comment
Share on other sites

Tu chybu jsem už našel, ale potrápím tě a řeknu ti jen to, že si přepočítej a logicky uprav { a }

 

Pokud na to nepříjdeš, tak pisni PM, ale fakt to zkus najít sám, pomůže ti to. :d

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