24.11.2010, 17:39
(
Последний раз редактировалось BigAl; 24.11.2010 в 18:06.
Причина: Making it clearer!
)
Hello i have this code but then when i type /vbuy then a dialog pops up with the correct stuff but then when i click, Cars and then Elegy, it doesnt do anything, the dialog doesnt even close, anyone know whay? Heres the code...
Can anyone please help me. :/ im sorry for asking for help so much, but how else am i going to learn this. Before you say, i have looked at tutorials and other posts to see if there is a solution but could not find anything :/ im sorry.
For example. I type "/vbuy" a dialog pops up with Cars etc then i click "Cars" then another dialog pops up with Elegy but then i click "Elegy" and then it spawns an elegy for X ammount of money! Thanks for trying though!
No errors but the dialog did BLINK at me so went on and off so quick literally, and that is the problem!
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/vbuy", true) == 0)
{
ShowPlayerDialog(playerid, 1,DIALOG_STYLE_LIST,"Vehicles.","1. Cars\r\n2. Bikes\r\n3. Choppers\r\n4. Planes\r\n5. Cheap.","Continue", "Cancel");
return 1;
}
return SendClientMessage(playerid, COLOR_RED, "Unknown command: Type /help or /cmds for the right commands!");
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 1:
{
if(!response)
{
SendClientMessage(playerid, COLOR_RED, "You cancelled");
return 1;
}
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Cars","1. Elegy","Continue", "Cancel");
}
}
}
case 2:
{
if(!response)
{
SendClientMessage(playerid, COLOR_RED, "You cancelled!");
return 1;
}
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, COLOR_RED, "You dont have enough money for the elegy!");
GivePlayerMoney(playerid, -5000);
new Float:X,Float:Y,Float:Z,Float:ROT;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle (playerid,ROT);
SpawnedVehicles[playerid] = CreateVehicle(562, X+4,Y,Z,ROT,-1,-1,60);
}
}
}
}
return 1;
}
For example. I type "/vbuy" a dialog pops up with Cars etc then i click "Cars" then another dialog pops up with Elegy but then i click "Elegy" and then it spawns an elegy for X ammount of money! Thanks for trying though!
No errors but the dialog did BLINK at me so went on and off so quick literally, and that is the problem!