[Help] Some switch() problems. - 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] Some switch() problems. (
/showthread.php?tid=136033)
[Help] Some switch() problems. -
Wulffe - 22.03.2010
Hey.
Im gonna make a info bar at the side, and then i want to make a switch() for the windows.
Код:
new windows = CarWindowStatus[GetPlayerVehicleID(i)];
Код:
switch(What do i write here?)
{
case 0: windows = "Up";
case 1: windows = "Down";
}
Код:
format(tmp, sizeof(tmp), "Windows: %d"",windows);
I need some help with the switch - The script is working fine, but it just shows: Windows: 1/0
Im gonna make the same with the doors, locks and GPS system.
But if someone just wanna help me a little with the windows, then i can learn something and make the rest myself
Re: [Help] Some switch() problems. -
Jefff - 22.03.2010
//Up
Код:
CarWindowStatus[GetPlayerVehicleID(playerid)]=0;
//Down
Код:
CarWindowStatus[GetPlayerVehicleID(playerid)]=1;
Код:
new windows[5];
new check = CarWindowStatus[GetPlayerVehicleID(i)];
switch(check)
{
case 0: windows = "Up";
case 1: windows = "Down";
}
Re: [Help] Some switch() problems. -
Wulffe - 22.03.2010
Thanks for the help
But i dont think its working :S
When i make:
Код:
format(tmp, sizeof(tmp), "Windows: %d"",windows);
I get: Windows: 65
__________________________________________________ ____
If i make:
Код:
format(tmp, sizeof(tmp), "Windows: %d"",check);
I get: Windows: 1
Re: [Help] Some switch() problems. -
ivex - 22.03.2010
%d is for numbers ,
%s is for letters
Re: [Help] Some switch() problems. -
Wulffe - 22.03.2010
Quote:
Originally Posted by [ST
Ivex ]
%d is for numbers , %s is for letters
|
Sorry - My bad.
I did not see that.
Thanks
/close
Re: [Help] Some switch() problems. -
Jefff - 22.03.2010
But simply i think is
Код:
if(!check) windows = "Up";
else windows = "Down";
and replace %d to %s like [ST]Ivex says