Help with this - 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)
+--- Thread: Help with this (
/showthread.php?tid=361358)
Help with this -
Face9000 - 20.07.2012
So guys...how i can make this code:
pawn Код:
if(classid == 0)
{
GameTextForPlayer(playerid, "~w~Bather", 5000, 5);
}
else if(classid == 1)
{
GameTextForPlayer(playerid, "~w~Bather", 5000, 5);
}
else if(classid == 2)
{
GameTextForPlayer(playerid, "~w~Bather", 5000, 5);
}
else if(classid == 3)
{
GameTextForPlayer(playerid, "~w~Bather", 5000, 5);
}
else if(classid == 4)
{
GameTextForPlayer(playerid, "~w~Bather", 5000, 5);
}
else if(classid == 5)
{
GameTextForPlayer(playerid, "~w~Bather", 5000, 5);
}
else if(classid == 6)
{
GameTextForPlayer(playerid, "~r~Beach Guard", 5000, 5);
}
else if(classid == 7)
{
GameTextForPlayer(playerid, "~r~Beach Guard", 5000, 5);
}
else if(classid == 8)
{
GameTextForPlayer(playerid, "~r~Beach Guard", 5000, 5);
}
With less lines?I remember something with case but i forgot it.
Thanks.
Re: Help with this -
ViniBorn - 20.07.2012
Use switch
pawn Код:
switch(classid )
{
case 0..5: GameTextForPlayer(playerid, "~w~Bather", 5000, 5);
case 6..8: GameTextForPlayer(playerid, "~r~Beach Guard", 5000, 5);
}
Re: Help with this -
namespace - 20.07.2012
if(classid == 1||classid==2...
or use switch like...
switch(classid){
case 0..8:
GameTextForPlayer(playerid, "~r~Beach Guard", 5000, 5);
}
Re: Help with this -
Face9000 - 20.07.2012
Yeah got it,thanks !
Re: Help with this -
EV007 - 20.07.2012
new string[24] = "~r~Bather";
new string2[24] = "~r~Beach guard";
GameTextForPlayer(playerid,(classid > 0 && classid < 6) ? string : string2, 5000, 5);
might work