Dialog Response
#1

Код:
error 002: only a single statement (or expression) can follow each "case"
error 028: invalid subscript (not an array or too many subscripts): "response"
error 001: expected token: "}", but found "case"
fatal error 107: too many error messages on one line
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid 70)
    {
        if(
response)
        {
            case 
1:
            {
            
SendClientMessage(playeridGrey"You are now In Deagle Arena!");
            
SendClientMessage(playeridYellow"You can change your arena Type: /switcha or (/switcharena)!");
            
GivePlayerWeapon(playerid2410000);
            
SetPlayerHealth(playerid100);
            
SetPlayerPos(playerid288.745971,169.350997,1007.171875);
            
SetPlayerInterior(playerid3);
            }
            case 
2:
            {
               
SendClientMessage(playeridGrey"You are now in Sawnoff + Deagle Arena!");
            
SendClientMessage(playeridYellow"You can change your arena Type: /switcha or (/switcharena)!");
            
GivePlayerWeapon(playerid2410000);
            
GivePlayerWeapon(playerid2610000);
            
SetPlayerHealth(playerid100);
            
SetPlayerPos(playerid,1710.433715,-1669.379272,20.225049);
            
SetPlayerInterior(playerid18);
            }
            case 
2:
            {
               
SendClientMessage(playeridGrey"You are now in Freeroam arena!");
            
SendClientMessage(playeridYellow"You can change your arena Type: /switcha or (/switcharena)!");
            
ResetPlayerWeapons(playerid);
            
SetPlayerHealth(playerid99999999);
            
SetPlayerPos(playerid, -1465.268676,1557.868286,1052.531250);
            
SetPlayerInterior(playerid14);
            }
            case 
3:
            {
               
SendClientMessage(playeridGrey"You are now in Minigun Arena! Your health is now 250%.");
            
SendClientMessage(playeridYellow"You can change your arena Type: /switcha or (/switcharena)!");
            
GivePlayerWeapon(playerid38100000);
            
SetPlayerHealth(playerid250);
            
SetPlayerPos(playerid, -975.975708,1060.983032,1345.671875);
            
SetPlayerInterior(playerid10);
            }
        }
    }
    return 
1;

Reply
#2

this:
PHP код:
switch(dialogid 70
makes no sense, change 'switch' to 'if' you can only use case statements after 'switch' and also its 2x == not just one =
PHP код:
if(dialogid == 70
Reply
#3

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
           case 
1:
            {
            
SendClientMessage(playeridGrey"You are now In Deagle Arena!");
            
SendClientMessage(playeridYellow"You can change your arena Type: /switcha or (/switcharena)!");
            
GivePlayerWeapon(playerid2410000);
            
SetPlayerHealth(playerid100);
            
SetPlayerPos(playerid288.745971,169.350997,1007.171875);
            
SetPlayerInterior(playerid3);
            }
            case 
2:
            {
               
SendClientMessage(playeridGrey"You are now in Sawnoff + Deagle Arena!");
            
SendClientMessage(playeridYellow"You can change your arena Type: /switcha or (/switcharena)!");
            
GivePlayerWeapon(playerid2410000);
            
GivePlayerWeapon(playerid2610000);
            
SetPlayerHealth(playerid100);
            
SetPlayerPos(playerid,1710.433715,-1669.379272,20.225049);
            
SetPlayerInterior(playerid18);
            }
            case 
2:
            {
               
SendClientMessage(playeridGrey"You are now in Freeroam arena!");
            
SendClientMessage(playeridYellow"You can change your arena Type: /switcha or (/switcharena)!");
            
ResetPlayerWeapons(playerid);
            
SetPlayerHealth(playerid99999999);
            
SetPlayerPos(playerid, -1465.268676,1557.868286,1052.531250);
            
SetPlayerInterior(playerid14);
            }
            case 
3:
            {
               
SendClientMessage(playeridGrey"You are now in Minigun Arena! Your health is now 250%.");
            
SendClientMessage(playeridYellow"You can change your arena Type: /switcha or (/switcharena)!");
            
GivePlayerWeapon(playerid38100000);
            
SetPlayerHealth(playerid250);
            
SetPlayerPos(playerid, -975.975708,1060.983032,1345.671875);
            
SetPlayerInterior(playerid10);
            }
        }
    return 
1;

This has been said so many times so please do searches.

Correct usage of switch
PHP код:
switch(switchid)
{
     case 
1//code
     
case 2//code
     
default: //code

Reply
#4

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[]) 

    switch(
dialogid
    { 
        case 
70// Dialog ID 70
        
{
            if(
response
            { 
                switch(
listitem)
                {
                    case 
1
                    { 
                        
SendClientMessage(playeridGrey"You are now In Deagle Arena!"); 
                        
SendClientMessage(playeridYellow"You can change your arena Type: /switcha or (/switcharena)!"); 
                        
GivePlayerWeapon(playerid2410000); 
                        
SetPlayerHealth(playerid100); 
                        
SetPlayerPos(playerid288.745971,169.350997,1007.171875); 
                        
SetPlayerInterior(playerid3); 
                    } 
                    case 
2
                    { 
                        
SendClientMessage(playeridGrey"You are now in Sawnoff + Deagle Arena!"); 
                        
SendClientMessage(playeridYellow"You can change your arena Type: /switcha or (/switcharena)!"); 
                        
GivePlayerWeapon(playerid2410000); 
                        
GivePlayerWeapon(playerid2610000); 
                        
SetPlayerHealth(playerid100); 
                        
SetPlayerPos(playerid,1710.433715,-1669.379272,20.225049); 
                        
SetPlayerInterior(playerid18); 
                    } 
                    case 
2
                    { 
                        
SendClientMessage(playeridGrey"You are now in Freeroam arena!"); 
                        
SendClientMessage(playeridYellow"You can change your arena Type: /switcha or (/switcharena)!"); 
                        
ResetPlayerWeapons(playerid); 
                        
SetPlayerHealth(playerid99999999); 
                        
SetPlayerPos(playerid, -1465.268676,1557.868286,1052.531250); 
                        
SetPlayerInterior(playerid14); 
                    } 
                    case 
3
                    { 
                        
SendClientMessage(playeridGrey"You are now in Minigun Arena! Your health is now 250%."); 
                        
SendClientMessage(playeridYellow"You can change your arena Type: /switcha or (/switcharena)!"); 
                        
GivePlayerWeapon(playerid38100000); 
                        
SetPlayerHealth(playerid250); 
                        
SetPlayerPos(playerid, -975.975708,1060.983032,1345.671875); 
                        
SetPlayerInterior(playerid10); 
                    } 
                }
            } 
        }
    } 
    return 
1

Reply
#5

Thank you all. @Jake, I try you code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)