30.01.2013, 02:58
Ola Galera, sou novo com programaзгo e estou com duvidas em relaзгo ao menu. Estou criando esse meu primeiro codigo, ele apresenta um problema, o menu aparece mas quando eu clico em alguma opзгo ele apenas fecha e nгo faz nada!
PHP код:
#define DIALOG_TYPE_MAINMENU 200
#define DIALOG_TYPE_BICICLETAS 201
#define DIALOG_TYPE_MOTOS 202
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_TYPE_MAINMENU)
{
if(!response)
{
SetCameraBehindPlayer(playerid);
}
if(response)
{
switch(listitem)
{
case 0: ShowPlayerDialog(playerid, DIALOG_TYPE_BICICLETAS, DIALOG_STYLE_LIST, "Bicicletas", "Bike\nBMX\nMountain Bike\n\nBack", "Pegar", "Fechar");
case 1: ShowPlayerDialog(playerid, DIALOG_TYPE_MOTOS, DIALOG_STYLE_LIST, "Motos", "NRG-500\nFaggio\nFCR-900\nPCJ-600\nFreeway\nBF-400\nPizzaboy\nWayfarer\nCop Bike\nSanchez\nQuad\n\nBack", "Pegar", "Fechar");
}
}
}
if(dialogid == DIALOG_TYPE_BICICLETAS)
{
if(!response)
{
SetCameraBehindPlayer(playerid);
}
if(response)
{
switch(listitem)
{
case 0: aCreateThing(playerid, 509, 1);
case 1: aCreateThing(playerid, 481, 2);
case 2: aCreateThing(playerid, 510, 3);
case 3: ShowPlayerDialog(playerid, DIALOG_TYPE_MAINMENU, DIALOG_STYLE_LIST, "Car Spawn", "Bicicletas\nMotos", "Ir", "Fechar");
}
}
}
if(dialogid == DIALOG_TYPE_MOTOS)
{
if(!response)
{
SetCameraBehindPlayer(playerid);
}
if(response)
{
switch(listitem)
{
case 0: aCreateThing(playerid, 522, 4);
case 1: aCreateThing(playerid, 462, 5);
case 2: aCreateThing(playerid, 521, 6);
case 3: aCreateThing(playerid, 461, 7);
case 4: aCreateThing(playerid, 463, 8);
case 5: aCreateThing(playerid, 581, 9);
case 6: aCreateThing(playerid, 448, 10);
case 7: aCreateThing(playerid, 586, 11);
case 8: aCreateThing(playerid, 523, 12);
case 9: aCreateThing(playerid, 468, 13);
case 10: aCreateThing(playerid, 471, 14);
case 11:ShowPlayerDialog(playerid, DIALOG_TYPE_MAINMENU, DIALOG_STYLE_LIST, "Car Spawn", "Bicicletas\nMotos", "Ir", "Fechar");
}
}
}
return 1;
}
stock aCreateThing(playerid, thingid, orderid)
{
new Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Angle);
if(IsPlayerInAnyVehicle(playerid)) DestroyVehicle(GetPlayerVehicleID(playerid));
if(thingid != 597 || thingid != 596 || thingid != 598 || thingid != 599 || thingid != 497 || thingid != 427)
{
Vehicle[orderid] = CreateVehicle(thingid, X, Y, Z + 3, Angle, random(126), random(126), 30);
}
else
{
Vehicle[orderid] = CreateVehicle(thingid, X, Y, Z + 3, Angle, 0, 1, 30);
}
PutPlayerInVehicle(playerid, Vehicle[orderid], 0);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/v2", true))
{
{
ShowPlayerDialog(playerid, DIALOG_TYPE_MAINMENU, DIALOG_STYLE_LIST, "Car Spawn", "Bicicletas\nMotos", "Ir", "Fechar");
return 1;
}
}
return 0;
}