Balkan SA:MP

PAWN skriptanje, gamemodovi, filterskripte, include fajlovi, mape, pluginovi => Razgovor u vezi PAWN - skriptanja => Temu započeo: TONY x poslato Februar 15, 2018, 20:38:42 POSLE PODNE

Naslov: OnDialogResponse
Poruka od: TONY x poslato Februar 15, 2018, 20:38:42 POSLE PODNE
Detaljan opis problema:Pa uradio sam nesto za mod(port) i imam errore u dialogu na dnu kojie je najbitniji
Deo skripte: https://pastebin.com/hVCdwq15
Komentar:Pa na dnu je taj dialog ovo nebitno je sve pod   /* */  i nije ga bilo pre pravljena dialogu takodje nebrinite se sve ima sto treba(cmd,define...)
Naslov: Odg: OnDialogResponse
Poruka od: Balsa. poslato Februar 15, 2018, 20:41:52 POSLE PODNE
Koji su errori
Naslov: Odg: OnDialogResponse
Poruka od: xsar.p poslato Februar 15, 2018, 20:45:43 POSLE PODNE
A problem je?
Naslov: Odg: OnDialogResponse
Poruka od: TONY x poslato Februar 15, 2018, 21:00:13 POSLE PODNE
Ja zab... 8)

C:\Users\a\Desktop\Flint Hospital RP\gamemodes\FHRPgm.pwn(1757) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\a\Desktop\Flint Hospital RP\gamemodes\FHRPgm.pwn(1757 -- 1758) : error 028: invalid subscript (not an array or too many subscripts): "IsPlayerInAnyVehicle"
C:\Users\a\Desktop\Flint Hospital RP\gamemodes\FHRPgm.pwn(1757 -- 1759) : error 001: expected token: "}", but found "new"
C:\Users\a\Desktop\Flint Hospital RP\gamemodes\FHRPgm.pwn(1757 -- 1759) : fatal error 107: too many error messages on one line

1757 vam je ono gde je if(IsPlayerInAnyVeh...
Naslov: Odg: OnDialogResponse
Poruka od: Balsa. poslato Februar 15, 2018, 21:01:37 POSLE PODNE
Odje posalji samo te lijije i oznaci koja je koja
Naslov: Odg: OnDialogResponse
Poruka od: TONY x poslato Februar 15, 2018, 21:06:18 POSLE PODNE
https://pastebin.com/stJdf4a9
Naslov: Odg: OnDialogResponse
Poruka od: Ino42O poslato Februar 15, 2018, 21:17:21 POSLE PODNE
Ne koristis pravilno switch-case

[pawn]switch (var) {
    case condition:
    {
        // stuff
    }
    ...
}[/pawn]

npr

[pawn]new var = 3;
switch (var) {
    case 1: {
        print("First");
    }
    case 2: {
        print("Second");
    }
    case 3: {
        print("Third"); // Ovaj ide
    }
    default: {
        print("None");
    }
}[/pawn]
Naslov: Odg: OnDialogResponse
Poruka od: TONY x poslato Februar 15, 2018, 21:19:34 POSLE PODNE
Citat: Ino42O poslato Februar 15, 2018, 21:17:21 POSLE PODNE
Ne koristis pravilno switch-case

[pawn]switch (var) {
    case condition:
    {
        // stuff
    }
    ...
}[/pawn]

npr

[pawn]new var = 3;
switch (var) {
   case 1: {
      print("First");
   }
   case 2: {
      print("Second");
   }
   case 3: {
      print("Third"); // Ovaj ide
   }
   default: {
      print("None");
   }
}[/pawn]
‚
Mozes samo malo bolje da mi objasnis i sta bi trebalo da stavim pod default
Naslov: Odg: OnDialogResponse
Poruka od: xsar.p poslato Februar 15, 2018, 21:21:15 POSLE PODNE
Prvi problem koji sam ja primetio je ovde:
SCM(playerid, BELA,"Portao si se do Policije")
Zanima me, zasto koristis listitem, kada imas case?
Ja sam ti zapoceo, kako mislim da bi trebalo da bude, a ti nastavi.
Nisam bas siguran da je kod ispravan.
[pawn]
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)
{
   switch(dialogid)
      {
         case 1:// Our dialog!
         {
                 switch(listitem)// Checking which listitem was selected
              {
                  case 0:// The first item listed
                  {
                      new vozilo = GetPlayerVehicleID(playerid);
                  SetPlayerPos(playerid, 2276.7539,-85.2362,26.4977);
                  SendClientMessage(playerid, -1,"Portao si se do Policije");

                  SetVehiclePos(vozilo, 2276.7539,-85.2362,26.4977);
                  PutPlayerInVehicle(playerid, vozilo, 0);
                  }
              }
          }
      }
    }
return 1;
}
[/pawn]
Naslov: Odg: OnDialogResponse
Poruka od: T€BR€X poslato Februar 15, 2018, 21:31:19 POSLE PODNE
Ukratko, povedi racuna o pisanju/kopiranju kodova :)
Mnogo mozes da se ujebes ako radis nesto vise na modu i onda pokrenes kompajler a on zabode i onda sledi udaranje glave od zid sta si sve radio pa vracaj unazad pa ovo pa ono itd itd haha :D
Naslov: Odg: OnDialogResponse
Poruka od: xsar.p poslato Februar 15, 2018, 21:45:14 POSLE PODNE
Inc sredio sam ti ceo OnDialogResponse, takodje imas ispravnu proveru ako je igrac u vozilu.
[pawn]
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new vozilo = GetPlayerVehicleID(playerid);
if(response)
{
   switch(dialogid)
      {
         case DIALOG_PORT:
         {
                 switch(listitem)
              {
                  case 0:
                  {
                  SetPlayerPos(playerid, 2276.7539,-85.2362,26.4977);
                  SendClientMessage(playerid, -1,"Portao si se do Policije");

                  if(IsPlayerInAnyVehicle(playerid))
                  {
                     SetVehiclePos(vozilo, 2276.7539,-85.2362,26.4977);
                     PutPlayerInVehicle(playerid, vozilo, 0);                     
                  }
                  }
                  case 1:
                  {                 
                     SetPlayerPos(playerid, 2390.0713,92.7207,26.3359);
                     SendClientMessage(playerid, -1,"Portao si se do Banke");

                     if(IsPlayerInAnyVehicle(playerid))
                     {
                        SetVehiclePos(vozilo, 2390.0713,92.7207,26.3359);
                        PutPlayerInVehicle(playerid, vozilo, 0);                        
                     }
                  }
                  case 2:
                  {     
                        SetPlayerPos(playerid, 2338.6211,60.6317,26.4844);
                        SendClientMessage(playerid, -1,"Portao si se do Gun-Shopa");

                         if(IsPlayerInAnyVehicle(playerid))
                     {
                        SetVehiclePos(vozilo, 2338.6211,60.6317,26.4844);
                        PutPlayerInVehicle(playerid, vozilo, 0);                        
                     }
                 }
                 case 3:
                 {
                    SetPlayerPos(playerid, 1380.0525,202.4533,19.5547);
                    SendClientMessage(playerid, -1,"Portao si se do MontGomery-a");
                    
                         if(IsPlayerInAnyVehicle(playerid))
                     {
                        SetVehiclePos(vozilo, 1380.0525,202.4533,19.5547);
                        PutPlayerInVehicle(playerid, vozilo, 0);                        
                     }
                  }
              }
          }
      }
    }
return 1;
}
[/pawn]