Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2013-10-09, 23:50


awfesa







Wiek: 29
Na forum: 4705 dni
Posty: 563

Piwa: 223

Respekt: 280
Respekt: 280Respekt: 280Respekt: 280

Witam mam taki problem zrobi?em laser do broni w GUI ale gdy w sampie wpisze komend? laser to pokazuje si? okno z opcjami ale jak klikn? na oboj?tnie w jak? opcje to dodaje tylko laser o kolorze czerwonym. Jak zrobi? aby kolory by?y r??ne nie tylko red. Za pomoc :piwo:



Oto ten skrypt.


Kod:

COMMAND:laser(playerid, params[])
{
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "laser","Niebieski\nCzerwony\nRozowy\nPomaranczowy\nZielony\nZ??ty\nUsu?", "TAK", "NIE");
return 1;
}

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

if(dialogid == 0)
{
if(response)
{
switch(listitem)
{
case 0:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "blue", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? niebieski laser.");

}
case 1:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "red", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? czerwony laser.");
}
case 2:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "pink", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? r??owy laser.");
}
case 3:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "orange", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? pomaranczowy laser.");
}
case 4:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "green", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? zielony laser.");
}
case 5:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "yellow", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? ?? ?ty laser.");
}
case 6:
{
SetPVarInt(playerid, "laser", 0);
RemovePlayerAttachedObject(playerid, 0);
}
}
}
}
return 1;
}


Podpis

Cokolwiek robicie w swoim życiu, nie będzie to legendarne,
jeżeli wasi przyjaciele nie będą mogli tego zobaczyć.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-10-10, 17:16


Sillence







Wiek: 26
Na forum: 5157 dni
Posty: 1514
Nick w MP: Sillence

Piwa: 1517

Respekt: 416,3
Respekt: 416,3

awfesa, Spr?buj to wykona? z u?yciem return :)
Kod:

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

if(dialogid == 0)
{
if(response)
{
switch(listitem)
{
case 0:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "blue", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? niebieski laser.");
return 1;
}
case 1:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "red", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? czerwony laser.");
return 1;
}
case 2:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "pink", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? r??owy laser.");
return 1;
}
case 3:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "orange", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? pomaranczowy laser.");
return 1;
}
case 4:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "green", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? zielony laser.");
return 1;
}
case 5:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "yellow", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? ?? ?ty laser.");
return 1;
}
case 6:
{
SetPVarInt(playerid, "laser", 0);
RemovePlayerAttachedObject(playerid, 0);
return 1;
}
}
}
}
return 1;
}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-10-11, 10:58


KatieM







Wiek: 32
Na forum: 4868 dni
Posty: 82
Nick w MP: _DMCy

Piwa: 293

Respekt: 85

Ostrzeżeń: 20%
Powinno si? stosowa? return w osobnych dialogach ale nie konieczne. W przysz?o?ci r?b co? takiego, kod jest czytelniejszy:

Kod:

CMD:laser(playerid)
return howPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "laser","Niebieski\nCzerwony\nRozowy\nPomaranczowy\nZielony\nZ??ty\nUsu?", "TAK", "NIE");

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

if (dialogid == 0) {
if (!response) return 1;

switch (listitem)
{
case 0:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "blue", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? niebieski laser.");
}

case 1:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "red", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? czerwony laser.");
}

case 2:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "pink", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? r??owy laser.");
}

case 3:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "orange", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? pomaranczowy laser.");
}

case 4:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "green", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? zielony laser.");
}

case 5:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "yellow", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? ?? ?ty laser.");
}

case 6:
{
SetPVarInt(playerid, "laser", 0);
RemovePlayerAttachedObject(playerid, 0);
}
}
return 1;
}
return 1;
}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-10-11, 14:29


IgrexolonO







Wiek: 34
Na forum: 6809 dni
Posty: 1386

Piwa: 1062

Respekt: 651,8
Respekt: 651,8Respekt: 651,8

Kod:

CMD:laser(playerid, p[]) return ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "laser","Niebieski\nCzerwony\nRozowy\nPomaranczowy\nZielony\nZ??ty\nUsu?", "TAK", "NIE"), true;

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 0)
{
if(response)
{
switch(listitem)
{
case 0:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "blue", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? niebieski laser.");
}
case 1:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "red", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? czerwony laser.");
}
case 2:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "pink", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? r??owy laser.");
}
case 3:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "orange", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? pomaranczowy laser.");
}
case 4:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "green", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? zielony laser.");
}
case 5:
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "yellow", GetPVarInt(playerid, "color"));
SendClientMessage(playerid, 0xFFFFFFAA, "Doda?e? ?? ?ty laser.");
}
case 6:
{
SetPVarInt(playerid, "laser", 0);
RemovePlayerAttachedObject(playerid, 0);
}
}
return true;
}
return true;
}
return true;
}


A mo?e pokaza?by? to podczepianie laseru? =_= Ten kod ustawia tylko wynik zmiennej, a co z samym podczepianiem?

Postaw piwo autorowi tego posta
 

 
Tagi: laser :: gui
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » PAWN » [INNE] Laser w GUI Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku