PDA

View Full Version : OnDialogResponse doesn't work !


pumastar
13/06/2015, 12:19 PM
I'm a beginner in scripting.

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid==policeskin && GetPlayerTeam(playerid)==1)
{
TogglePlayerControllable(playerid,0);
ShowPlayerDialog(playerid, 778, 2, "Choose a skin",
"Los Santos Police officer\n\
San Fierro Police officer\n\
Las Venturas Police officer\n\
County Sheriff\n\
Motorbike cop\n\
S.W.A.T suit\n\
F.B.I agent\n\
Army soldier\n\
Desert Sheriff\n\
Los Santos Female Police officer\n\
San Fierro Female Police officer\n\
Las Venturas Female Police officer\n\
County Sheriff without hat\n\
Desert Sheriff without hat",
"Select", "Cancel");
}
else if(pickupid==civilianskin && (GetPlayerTeam(playerid)==3 || GetPlayerTeam(playerid)==4))
{
TogglePlayerControllable(playerid,0);
ShowPlayerDialog(playerid, DIALOG_779, DIALOG_STYLE_INPUT, "Skin choice", "Type your skin ID here.", "Ok", "No thanks");
}
else if(pickupid==medicskin && GetPlayerTeam(playerid)==2)
{
TogglePlayerControllable(playerid,0);
ShowPlayerDialog(playerid, DIALOG_780, 2, "Choose a skin",
"Black medic in white uniform\n\
Black medic in blue uniform\n\
White medic in green uniform\n\
Firefighter in green suit\n\
Firefighter in yellow suit\n\
Firefighter in black suit\n\
Girl blonde medic in green uniform",
"Select", "Cancel");
}
TogglePlayerControllable(playerid,1);
}



public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid==DIALOG_780)
{
if(response)
{
switch(listitem)
{
case 0: SetPlayerSkin(playerid, 274);
case 1: SetPlayerSkin(playerid, 275);
case 2: SetPlayerSkin(playerid, 276);
case 3: SetPlayerSkin(playerid, 277);
case 4: SetPlayerSkin(playerid, 278);
case 5: SetPlayerSkin(playerid, 279);
case 6: SetPlayerSkin(playerid, 308);
}
}
}
if(dialogid==DIALOG_778)
{
if(response)
{
switch(listitem)
{
case 0: SetPlayerSkin(playerid, 280);
case 1: SetPlayerSkin(playerid, 281);
case 2: SetPlayerSkin(playerid, 282);
case 3: SetPlayerSkin(playerid, 283);
case 4: SetPlayerSkin(playerid, 284);
case 5: SetPlayerSkin(playerid, 285);
case 6: SetPlayerSkin(playerid, 286);
case 7: SetPlayerSkin(playerid, 287);
case 8: SetPlayerSkin(playerid, 288);
case 9: SetPlayerSkin(playerid, 306);
case 10: SetPlayerSkin(playerid, 307);
case 11: SetPlayerSkin(playerid, 309);
case 12: SetPlayerSkin(playerid, 310);
case 13: SetPlayerSkin(playerid, 311);
}
}
}
if(dialogid == DIALOG_779)
{
if(response)
{
switch(listitem)
{
case 0: SetPlayerSkin(playerid, response);
}
}
return 1;
}
if(dialogid==DIALOG_SELECTION)
{
if(response)
{
switch(listitem)
{
case 0: SetPlayerColor(playerid, 0x5AE0E0FF), SetSpawnInfo(playerid, 1, 285, 2318.8945,-80.2897,26.2606,358.7490, 31, 1000, 22, 10000, 17, 100 ), SpawnPlayer(playerid);
case 1: SetPlayerColor(playerid, 0x9DE05AFF), SetSpawnInfo(playerid, 2, 308, 2434.3684,118.6439,26.4689,176.0180, 22, 200, 0, 0, 0, 0 ), SpawnPlayer(playerid);
case 2: SetPlayerColor(playerid, 0xE05A5AFF), SetSpawnInfo(playerid, 3, 272, 2262.3872,63.2617,26.4844,271.5654, 30, 1000, 28, 10000, 0, 0 ), SpawnPlayer(playerid);
case 3: SetPlayerColor(playerid, 0x9D5AE0FF), SetSpawnInfo(playerid, 4, 16, 2333.1660,30.8891,26.6752,272.2914, 22, 200, 0, 0, 0, 0 ), SpawnPlayer(playerid);
}
}
}
return 0;
}


The DIALOG_SELECTION works properly while the skin selection fails. The dialog appears when you walk on the pick-up but when you click an item your skin doesn't change. Why ?