help please - 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: help please (
/showthread.php?tid=207582)
help please -
bartje01 - 06.01.2011
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
Re: help please -
bartje01 - 06.01.2011
I've know posted the full code
Re: help please -
iggy1 - 06.01.2011
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 ...
Re: help please -
bartje01 - 06.01.2011
is tehre another way then using a stock?
Re: help please -
iggy1 - 06.01.2011
An array and a loop is the only other way i can think of w/o a function...
Re: help please -
bartje01 - 06.01.2011
OK ty
Re: help please -
iggy1 - 06.01.2011
Actually this would probably work too lol
pawn Код:
if(GetVehicleModel(vehicleid) == 562||565||559||560||558||561)
Re: help please -
bartje01 - 06.01.2011
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
Re: help please -
bartje01 - 06.01.2011
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
Re: help please -
iggy1 - 06.01.2011
pawn Код:
stock IsTuner(modelid)
{
switch(modelid)
{
case 562, 565, 559
560, 558, 561:return true;
}
return false;
}
Much more efficient.