Wysłany: 2013-10-09, 23:50
awfesa
Wiek: 29 Na forum: 4705 dni Posty: 563
Piwa : 223
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
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ć.
Wysłany: 2013-10-10, 17:16
Sillence
Wiek: 26 Na forum: 5157 dni Posty: 1514
Nick w MP: Sillence
Piwa : 1517
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;
}
Wysłany: 2013-10-11, 10:58
KatieM
Wiek: 32 Na forum: 4868 dni Posty: 82
Nick w MP: _DMCy
Piwa : 293
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;
}
Wysłany: 2013-10-11, 14:29
IgrexolonO
Wiek: 34 Na forum: 6809 dni Posty: 1386
Piwa : 1062
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?
Tagi: laser :: gui
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: