Dialog
#1

im kinda new to dialogs so eh, yeah;
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)
{
switch(dialogid)
{
case 1:
{
switch(listitem)
{
case 0:
{
SetPlayerFightingStyle (playerid, FIGHT_STYLE_NORMAL);
PlayerInfo[playerid][pFight] = 1;
}
case 1:
{
if(GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash!");
GivePlayerMoney(playerid, -3000);
SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
PlayerInfo[playerid][pFight] = 2;
BizzInfo[10][bTakings] += 3000;
}
case 2:
{
if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash!");
GivePlayerMoney(playerid, -5000);
SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
PlayerInfo[playerid][pFight] = 3;
BizzInfo[10][bTakings] += 5000;
}
case 3:
{
if(GetPlayerMoney(playerid) < 3500) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash!");
GivePlayerMoney(playerid, -3500);
SetPlayerFightingStyle (playerid, FIGHT_STYLE_ELBOW);
PlayerInfo[playerid][pFight] = 4;
BizzInfo[10][bTakings] += 3500;
}
// Job Menu
if(response)
{
switch(2)
{
case 1:
{
switch(listitem)
{
case 0:
{
GameTextForPlayer(playerid, "You are now a Taxi Driver!~N~Type ~R~/job ~W~for more information", 5000, 3);
PlayerInfo[playerid][pJob] = 1;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
}
case 1:
{
SendClientMessage(playerid, COLOR_RED, "Sorry, this job is no longer available, please select another");
ShowMenuForPlayer(Jobmenu, playerid);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_LIST,"Looking for a new job? Select one.","Taxi Driver\r\nCar Dealer\r\nTruck Driver\r\nGrave Digger\r\nPizza Boy","Get Job", "Cancel");
}
case 2:
{
GameTextForPlayer(playerid, "You are now a Truck Driver!~N~Type ~R~/job ~W~for more information", 5000, 3);
PlayerInfo[playerid][pJob] = 3;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
}
case 3:
{
GameTextForPlayer(playerid, "You are now a Grave Digger!~N~Type ~R~/job ~W~for more information", 5000, 3);
PlayerInfo[playerid][pJob] = 4;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
}
case 4:
{
GameTextForPlayer(playerid, "You are now a Pizza Boy!~N~Type ~R~/job ~W~for more information", 5000, 3);
PlayerInfo[playerid][pJob] = 5;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
}
}
}
}
return 1;
}
errors;
Код:
C:\Users\iLcke\Desktop\SA-MP2\gamemodes\Fart.pwn(23652) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\iLcke\Desktop\SA-MP2\gamemodes\Fart.pwn(23652 -- 23653) : error 028: invalid subscript (not an array or too many subscripts): "response"
C:\Users\iLcke\Desktop\SA-MP2\gamemodes\Fart.pwn(23652 -- 23654) : error 001: expected token: "}", but found "switch"
C:\Users\iLcke\Desktop\SA-MP2\gamemodes\Fart.pwn(23652 -- 23654) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Ideas..?
Reply
#2

with that i still get errors.

Код:
C:\Users\iLcke\Desktop\SA-MP2\gamemodes\Fart.pwn(23616) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\iLcke\Desktop\SA-MP2\gamemodes\Fart.pwn(23616 -- 23617) : error 028: invalid subscript (not an array or too many subscripts): "response"
C:\Users\iLcke\Desktop\SA-MP2\gamemodes\Fart.pwn(23616 -- 23618) : error 001: expected token: "}", but found "switch"
C:\Users\iLcke\Desktop\SA-MP2\gamemodes\Fart.pwn(23616 -- 23618) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Line; 23616
Код:
if(response)
Line; 23616 -- 23617
Код:
if(response)
{
Line; 23616 -- 23618
Код:
if(response)
{
switch(listitem)
same goes for the other error..
Line; 23616 -- 23618
Код:
if(response)
{
switch(listitem)
Reply
#3

I Still get 4 errors.
Reply
#4

*Bumped*
Reply
#5

Indent your code and I will help.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)