SA-MP Forums Archive
Dialogs error - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Dialogs error (/showthread.php?tid=235795)



Dialogs error - 01 - 06.03.2011

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid == 1) // Lookup the dialogid
    {
        case 1:
        {
            if(!response)
            {
                SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
                return 1; // We processed it
            }

            switch(listitem) // This is far more efficient than using an if-elseif-else structure
            {
                case 0: // Listitems start with 0, not 1
                {
                    new vid = GetPlayerVehicleID(playerid);
                    if(vid != INVALID_VEHICLE_ID) {
                    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                }
                case 1:
                {
                    new vid = GetPlayerVehicleID(playerid);
                    if(vid != INVALID_VEHICLE_ID) {
                    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
                }
                case 2:
                {
                    new vid = GetPlayerVehicleID(playerid);
                    if(vid != INVALID_VEHICLE_ID) {
                    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
                }
                case 3:// Add the rest of your listitems for dialog 1 here
                {
                    new vid = GetPlayerVehicleID(playerid);
                    if(vid != INVALID_VEHICLE_ID) {
                    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective);
                }
                case 4:// Add the rest of your listitems for dialog 1 here
                {
                    new vid = GetPlayerVehicleID(playerid);
                    if(vid != INVALID_VEHICLE_ID) {
                    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vid,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
                }

            }

        }
        // Add the rest of your dialogs here

    }
    return 0; // If you put return 1 here the callback will not continue to be called in other scripts (filterscripts, etc.).
Код:
C:\Documents and Settings\user\Desktop\Raven's Roleplay 0.3c\filterscripts\Datascript.Weapons.pwn(212) : warning 217: loose indentation
C:\Documents and Settings\user\Desktop\Raven's Roleplay 0.3c\filterscripts\Datascript.Weapons.pwn(212) : error 014: invalid statement; not in switch
C:\Documents and Settings\user\Desktop\Raven's Roleplay 0.3c\filterscripts\Datascript.Weapons.pwn(212) : warning 215: expression has no effect
C:\Documents and Settings\user\Desktop\Raven's Roleplay 0.3c\filterscripts\Datascript.Weapons.pwn(212) : error 001: expected token: ";", but found ":"
C:\Documents and Settings\user\Desktop\Raven's Roleplay 0.3c\filterscripts\Datascript.Weapons.pwn(212) : error 029: invalid expression, assumed zero
C:\Documents and Settings\user\Desktop\Raven's Roleplay 0.3c\filterscripts\Datascript.Weapons.pwn(212) : fatal error 107: too many error messages on one line



Re: Dialogs error - Calgon - 06.03.2011

You need to include brackets after terminating your if statement.

http://pastebin.com/NCU7Zskr


Re: Dialogs error - omer5198 - 06.03.2011

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1) // Lookup the dialogid
    {
            if(!response)
            {
                SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
                return 1; // We processed it
            }
            switch(listitem) // This is far more efficient than using an if-elseif-else structure
            {
                case 0: // Listitems start with 0, not 1
                {
                    new vid = GetPlayerVehicleID(playerid);
                    if(vid != INVALID_VEHICLE_ID) {
                    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                }
                case 1:
                {
                    new vid = GetPlayerVehicleID(playerid);
                    if(vid != INVALID_VEHICLE_ID) {
                    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
                }
                case 2:
                {
                    new vid = GetPlayerVehicleID(playerid);
                    if(vid != INVALID_VEHICLE_ID) {
                    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
                }
                case 3:// Add the rest of your listitems for dialog 1 here
                {
                    new vid = GetPlayerVehicleID(playerid);
                    if(vid != INVALID_VEHICLE_ID) {
                    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective);
                }
                case 4:// Add the rest of your listitems for dialog 1 here
                {
                    new vid = GetPlayerVehicleID(playerid);
                    if(vid != INVALID_VEHICLE_ID) {
                    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vid,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
                }

            }

        }
        // Add the rest of your dialogs here

   
    return 0; // If you put return 1 here the callback will not continue to be called in other scripts (filterscripts, etc.).
}
it should work...


Re: Dialogs error - Bumbis - 06.03.2011

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1) // Lookup the dialogid
    {
            if(!response)
            {
                SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
                return 1; // We processed it
            }
            switch(listitem) // This is far more efficient than using an if-elseif-else structure
            {
                case 0: // Listitems start with 0, not 1
                {
                    new vid = GetPlayerVehicleID(playerid);
                    if(vid != INVALID_VEHICLE_ID) {
                    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);}
                }
                case 1:
                {
                    new vid = GetPlayerVehicleID(playerid);
                    if(vid != INVALID_VEHICLE_ID) {
                    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);}
                }
                case 2:
                {
                    new vid = GetPlayerVehicleID(playerid);
                    if(vid != INVALID_VEHICLE_ID) {
                    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);}
                }
                case 3:// Add the rest of your listitems for dialog 1 here
                {
                    new vid = GetPlayerVehicleID(playerid);
                    if(vid != INVALID_VEHICLE_ID) {
                    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective);}
                }
                case 4:// Add the rest of your listitems for dialog 1 here
                {
                    new vid = GetPlayerVehicleID(playerid);
                    if(vid != INVALID_VEHICLE_ID) {
                    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vid,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);}
                }

            }

        }
        // Add the rest of your dialogs here

    }
    return 0; // If you put return 1 here the callback will not continue to be called in other scripts (filterscripts, etc.).
Is see that you didnt close the brackets.


Re: Dialogs error - Calgon - 06.03.2011

There's no need for 2 other people to post the same solution.


Re: Dialogs error - omer5198 - 06.03.2011

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
There's no need for 2 other people to post the same solution.
i posted it first so...


Re: Dialogs error - Calgon - 06.03.2011

No, you didn't.