Help with Dialogid's -
Karol56 - 12.09.2012
Hello,
I'm a scripting beginner who tries to script his first test server for DMing with friends etc but I have a problem that I tried to fix for few weeks now and I can't do it..
The problem with Dialogid's, when I type in /tp -> LS Airport it TPs me there fine if I have money..
Then I type in /createvehicle -> Choose any vehicle from the list and it TPs me to LS Airport, then same happens with any dialog I open and use.
I can't sort it out so please help.
Код:
#define DIALOG_TP 1
#define DIALOG_CREATEVEHICLE 2
Код:
if (strcmp("/tp", cmdtext, true) == 0)
{
ShowPlayerDialog(playerid, DIALOG_TP, DIALOG_STYLE_LIST, "Where would you like to TP?", "LV $100\nLS $100\nSF $100\nSpawn $1\nLV - Abandon Airport $100\nLV - Area 51 $100", "Select", "Cancel");
return 1;
}
Код:
if (strcmp("/createvehicle", cmdtext, true) == 0)
{
ShowPlayerDialog(playerid, DIALOG_CREATEVEHICLE, DIALOG_STYLE_LIST, "What vehicle would you like?", "Turismo\nMaverick\nAndromeda\nHydra\nNRG-500\nAT-400(Boeing)", "Spawn", "Cancel");
return 1;
}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == 1)
{
switch( 1 )
{
case 1:
{
switch(DIALOG_TP)
{
case 0:
{
if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_RED, "You don't have enough money!");
GivePlayerMoney(playerid, -100);
SetPlayerPos(playerid, 1079.3356,2293.0444,10.6877);
SendClientMessage(playerid, COLOR_YELLOW, "You have been successfully TPed to LV");
return 1;
}
case 1:
{
if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_RED, "You don't have enough money!");
SetPlayerPos(playerid, 1950.9690,-2300.9600,13.5469);
GivePlayerMoney(playerid, -100);
SendClientMessage(playerid, COLOR_YELLOW, "You have been successfully TPed to LS airport");
return 1;
}
case 2:
{
if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_RED, "You don't have enough money!");
SetPlayerPos(playerid, -2373.0525,-32.3702,35.1641);
GivePlayerMoney(playerid, -100);
SendClientMessage(playerid, COLOR_YELLOW, "You have been successfully TPed to SF");
return 1;
}
case 3:
{
if(GetPlayerMoney(playerid) < 0) return SendClientMessage(playerid, COLOR_RED, "You have less then $1");
GivePlayerMoney(playerid, -1);
SetPlayerPos(playerid, 1976.3329,1410.6355,9.2578);
SendClientMessage(playerid, COLOR_RED, "You have been TPed back to Spawn.");
return 1;
}
case 4:
{
if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_RED, "You have less then $100 and are not able to pay for the TP.");
GivePlayerMoney(playerid, -100);
SetPlayerPos(playerid, 117.8479,2505.7759,16.4844);
SendClientMessage(playerid, COLOR_RED, "You have been TPed sucessfully to LV - Abandon Airport.");
return 1;
}
case 5:
{
if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_RED, "You have less then $100");
GivePlayerMoney(playerid, -100);
SetPlayerPos(playerid, 134.0241,1951.2173,19.3976);
SendClientMessage(playerid, COLOR_RED, "You have been TPed successfully to LV - Area 51");
return 1;
}
}
}
}
}
return 1;
}
if (dialogid == 2)
{
switch( 2 )
{
case 2:
{
switch(DIALOG_CREATEVEHICLE)
{
case 0:
{ //turismo
new Float:x, Float:y, Float:z,Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
CreateVehicle(451, x, y, z, a, -1,-1, -1);
SendClientMessage(playerid, COLOR_GREEN, "Your chosen vehicle has spawned.");
return 1;
}
case 1: //maverick
{ new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
CreateVehicle(487, x, y, z, a, -1, -1, -1);
SendClientMessage(playerid, COLOR_GREEN, "Your chosen vehicle has spawned.");
return 1;
}
case 2: //andromeda
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
CreateVehicle(592, 2+x, 2+y, z, a, -1, -1, -1);
SendClientMessage(playerid, COLOR_GREEN, "Your chosen vehicle has spawned.");
return 1;
}
case 3://Hydra
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
CreateVehicle(520, 2+x, 2+y, z, a, -1, -1, -1);
SendClientMessage(playerid, COLOR_GREEN, "Your chosen vehicle has spawned.");
return 1;
}
case 4://NRG-500
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
CreateVehicle(522, 2+x, 2+y, z, a, -1, -1, -1);
SendClientMessage(playerid, COLOR_GREEN, "Your chosen vehicle has spawned.");
return 1;
}
case 5://AT-400(Boeing)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
CreateVehicle(577, 2+x, 2+y, z, a, -1, -1, -1);
SendClientMessage(playerid, COLOR_GREEN, "Your chosen vehicle has spawned.");
return 1;
}
}
}
}
return 0;
}
Re: Help with Dialogid's -
Karol56 - 14.09.2012
Can anyone help me?
Re: Help with Dialogid's - HuSs3n - 14.09.2012
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_RED, "You don't have enough money!");
GivePlayerMoney(playerid, -100);
SetPlayerPos(playerid, 1079.3356,2293.0444,10.6877);
SendClientMessage(playerid, COLOR_YELLOW, "You have been successfully TPed to LV");
return 1;
}
case 1:
{
if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_RED, "You don't have enough money!");
SetPlayerPos(playerid, 1950.9690,-2300.9600,13.5469);
GivePlayerMoney(playerid, -100);
SendClientMessage(playerid, COLOR_YELLOW, "You have been successfully TPed to LS airport");
return 1;
}
case 2:
{
if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_RED, "You don't have enough money!");
SetPlayerPos(playerid, -2373.0525,-32.3702,35.1641);
GivePlayerMoney(playerid, -100);
SendClientMessage(playerid, COLOR_YELLOW, "You have been successfully TPed to SF");
return 1;
}
case 3:
{
if(GetPlayerMoney(playerid) < 0) return SendClientMessage(playerid, COLOR_RED, "You have less then $1");
GivePlayerMoney(playerid, -1);
SetPlayerPos(playerid, 1976.3329,1410.6355,9.2578);
SendClientMessage(playerid, COLOR_RED, "You have been TPed back to Spawn.");
return 1;
}
case 4:
{
if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_RED, "You have less then $100 and are not able to pay for the TP.");
GivePlayerMoney(playerid, -100);
SetPlayerPos(playerid, 117.8479,2505.7759,16.4844);
SendClientMessage(playerid, COLOR_RED, "You have been TPed sucessfully to LV - Abandon Airport.");
return 1;
}
case 5:
{
if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_RED, "You have less then $100");
GivePlayerMoney(playerid, -100);
SetPlayerPos(playerid, 134.0241,1951.2173,19.3976);
SendClientMessage(playerid, COLOR_RED, "You have been TPed successfully to LV - Area 51");
return 1;
}
}
}
else if(dialogid == 2)
{
switch(listitem)
{
case 0:
{ //turismo
new Float:x, Float:y, Float:z,Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
CreateVehicle(451, x, y, z, a, -1,-1, -1);
SendClientMessage(playerid, COLOR_GREEN, "Your chosen vehicle has spawned.");
return 1;
}
case 1: //maverick
{ new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
CreateVehicle(487, x, y, z, a, -1, -1, -1);
SendClientMessage(playerid, COLOR_GREEN, "Your chosen vehicle has spawned.");
return 1;
}
case 2: //andromeda
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
CreateVehicle(592, 2+x, 2+y, z, a, -1, -1, -1);
SendClientMessage(playerid, COLOR_GREEN, "Your chosen vehicle has spawned.");
return 1;
}
case 3://Hydra
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
CreateVehicle(520, 2+x, 2+y, z, a, -1, -1, -1);
SendClientMessage(playerid, COLOR_GREEN, "Your chosen vehicle has spawned.");
return 1;
}
case 4://NRG-500
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
CreateVehicle(522, 2+x, 2+y, z, a, -1, -1, -1);
SendClientMessage(playerid, COLOR_GREEN, "Your chosen vehicle has spawned.");
return 1;
}
case 5://AT-400(Boeing)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
CreateVehicle(577, 2+x, 2+y, z, a, -1, -1, -1);
SendClientMessage(playerid, COLOR_GREEN, "Your chosen vehicle has spawned.");
return 1;
}
}
}
return 0;
}
Re: Help with Dialogid's -
Karol56 - 15.09.2012
Thank you so much! I appreciate it very much