[Help] Some switch() problems.
#1

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

Reply
#2

//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";
}
Reply
#3

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
Reply
#4

%d is for numbers , %s is for letters
Reply
#5

Quote:
Originally Posted by [ST
Ivex ]
%d is for numbers , %s is for letters
Sorry - My bad.

I did not see that.

Thanks

/close
Reply
#6

But simply i think is
Код:
if(!check) windows = "Up";
else windows = "Down";
and replace %d to %s like [ST]Ivex says
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)