help please
#1

Hey guys.

Why doesn't this work?

pawn Код:
switch(dialogid)
    {
        case 1226:
        {
            if(!response)
            {
                SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
                return 1;
            }
            switch(listitem)
            {
                case 0:
                {
                new tuners = 562||565||559||560||558||561;
                if(GetVehicleModel(vehicleid) == tuners)
                {
                ShowPlayerDialog(playerid,1240,DIALOG_STYLE_LIST,"Spoilers","Spoiler Pro\nSpoiler Win\nSpoiler Drag\nSpoiler Alpha\nSpoiler Race\nSpoiler Worx","Ok", "Cancel");
                }
                else
                {
                SendClientMessage(playerid,COLOR_DARKORANGE,"You have to be in a Tuner");
                }
                }
The line that doesn't have effect is this:
pawn Код:
if(GetVehicleModel(vehicleid) == 562||565||559||560||558||561)
I'm feeling a bit ill at the moment so my brains aren't at 100%

Please help
Reply
#2

I've know posted the full code
Reply
#3

This should work better.
pawn Код:
switch(dialogid)
{
    case 1226:
    {
        if(!response)
        {
            SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
            return 1;
         }
         switch(listitem)
         {
            case 0:
            {
                if(IsTuner(GetVehicleModel(vehicleid)))
                {
                    ShowPlayerDialog(playerid,1240,DIALOG_STYLE_LIST,"Spoilers","Spoiler Pro\nSpoiler Win\nSpoiler Drag\nSpoiler Alpha\nSpoiler Race\nSpoiler Worx","Ok", "Cancel");
                    return 1;
                }
                else SendClientMessage(playerid,COLOR_DARKORANGE,"You have to be in a Tuner");
            }
        }
    }
}

stock IsTuner(modelid)
{
    switch(modelid)
    {
        case 562, 565, 559
        560, 558, 561:return true;
    }
    return false;
}
"new tuners = 562||565||559||560||558||561;" won't work you must give that variable one value. You cant say it is 562 or 568 ...
Reply
#4

is tehre another way then using a stock?
Reply
#5

An array and a loop is the only other way i can think of w/o a function...
Reply
#6

OK ty
Reply
#7

Actually this would probably work too lol
pawn Код:
if(GetVehicleModel(vehicleid) == 562||565||559||560||558||561)
Reply
#8

Well. Now I have this:

pawn Код:
if(GetVehicleModel(vehicleid) == 562||565||559||560||558||561)
                {
                    ShowPlayerDialog(playerid,1240,DIALOG_STYLE_LIST,"Spoilers","Spoiler Pro\nSpoiler Win\nSpoiler Drag\nSpoiler Alpha\nSpoiler Race\nSpoiler Worx","Ok", "Cancel");
                    return 1;
                }
It still doesn't work xP
Reply
#9

Ok I'm using this line
pawn Код:
if(IsTuner(GetVehicleModel(vehicleid)))
pawn Код:
stock IsTuner(playerid)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 562
|| GetVehicleModel(GetPlayerVehicleID(playerid)) == 565
|| GetVehicleModel(GetPlayerVehicleID(playerid)) == 559
|| GetVehicleModel(GetPlayerVehicleID(playerid)) == 558
|| GetVehicleModel(GetPlayerVehicleID(playerid)) == 561

{    <----Error line
return true;
}
return false;
}
Error code:
Код:
error 029: invalid expression, assumed zero
Reply
#10

pawn Код:
stock IsTuner(modelid)
{
    switch(modelid)
    {
        case 562, 565, 559
        560, 558, 561:return true;
    }
    return false;
}
Much more efficient.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)