The online racing simulator
Help About Buttons
Hello. I created a drag system for demo users from scratch. But there is still a lot to be completed. I encountered a problem and I need help from you.

My drag system starts by typing !drag and the buttons appear for everyone. I created a closebutton in moving vehicles so that the buttons do not take up space and I have no problem with this. The buttons turn off in moving vehicles. This is the issue I want to get help from you. I couldn't find anything about viewers on Lapper. (shift p is not what I want) When !drag is started while someone is in the viewer, the buttons always appear in the viewer. What can I do to delete these buttons in the viewers? I tried many things but unfortunately I couldn't find a solution. (I wrote 2 different scenarios when we write !drag on the track. The buttons are deleted when we move, and the buttons are deleted when we enter the pit. I have no problem with this)
I plan to make the drag system available to everyone when I finish it, but it is currently in the testing phase and there is a lot to add. (Please do not exclude demo players. They are not playing the illegal version of LFS. These people are playing the official version. Maybe when they have money they will buy it. The reason for writing is this: There will definitely be people who criticize me. That's why I wrote these.)
Why not just put buttons on a timer so they disappear themselves?

And if you search, you should find a couple of lapper drag systems on this forum already. I did one about 10 years ago that could be used on Blackwood.
Hey, even found I did a video about the lights. Nod

Yes, actually my first project was timed buttons. But I don't know why I changed it, it stayed like this. Thank you. So, does the lapper have the feature I asked you about?

I know your drag system, it's successful, thank you, but now I'm trying to do something myself. I'm trying to learn. I can't learn anything because of ready-made codes.
I will try to do something by examining your system and the bass driver's system. Smile
Quote from RealistAdam :... So, does the lapper have the feature I asked you about?

Don't know.

Make a video - that way I can see the problems you're having and what you're trying to do.
So from i understand is, that you do not want to display the buttons for the spectators.

First, you need to get a list of player that are currently online on the server.
You can do this with:

$ListOfPlayers = GetListOfPlayers("U");

Then create a loop, to go through the list of players
Within that loop you'll check if the player is on track or not.


$ListOfPlayers = GetListOfPlayers("U");
FOREACH( $Var IN $ListOfPlayers ) #Go Through each player in the arraylist $ListOfPlayers
$UserName = $Var["value"];
IF(GetPlayerVar($UserName,"OnTrack") == 1) THEN
#Player On Track
#Open Buttons
ELSE
#Player Spectating or in pit
#Close Buttons
ENDIF
ENDFOREACH

-
(RealistAdam) DELETED by RealistAdam : no reason
-
(RealistAdam) DELETED by RealistAdam : no reason
not going to fix your code. I see so many errors.
Its better for you to understand how a FOREACH Loop works, and then implement it in your code.

search for FOREACH / ENDFOREACH examples at the LFSLapper development forum.

Also search examples for FOR/ENDFOR and WHILE/ENDWHILE loops aswell
Quote from Bass-Driver :not going to fix your code. I see so many errors.
Its better for you to understand how a FOREACH Loop works, and then implement it in your code.

search for FOREACH / ENDFOREACH examples at the LFSLapper development forum.

Also search examples for FOR/ENDFOR and WHILE/ENDWHILE loops aswell

Yes, my friend said that what you said was something different. I am researching. Thanks.
CASE "!kontrol":
$ListOfPlayers = GetListOfPlayers("U");
FOREACH( $Var IN $ListOfPlayers ) #Go Through each player in the arraylist $ListOfPlayers
$UserName = $Var["value"];
IF(GetPlayerVar($UserName,"OnTrack") == 1) THEN
IF ( GetCurrentPlayerVar( "InstantSpeed" ) < 1 )
THEN

#my code is not finished
globalMsg("".GetCurrentPlayerVar("NickName")." ^7drag başlattı. ^1Drag bölgesindekiler hazır olun!");

ELSE

PrivMsg("Hızın yüksek");
ENDIF
ELSE
#Player Spectating or in pit
#Close Buttons
PrivMsg("İzleyicidesin");
ENDIF
ENDFOREACH
BREAK;

Thanks to ''androphp'' for your help. Even though we learned something new, this was not actually the answer to the question I asked you. Actually, I wanted to ask if it is possible to prevent the players in the audience from seeing the global buttons. I would be happy if you answer this question.
** Best answer **
ASE "!drag":

IF(GetPlayerVar($userName,OnTrack) == 1)
THEN
IF ( GetCurrentPlayerVar( "IdZone") == "yaris" ) THEN
IF ( GetCurrentPlayerVar( "InstantSpeed" ) < 1 )
THEN
pace_control_command( 0,0 );
IF (GetCurrentPlayerVar( "control_commands_allowed" ) == "yes" )
THEN


globalMsg("".GetCurrentPlayerVar("NickName")." ^7drag başlattı. ^1Drag bölgesindekiler hazır olun!");

ELSE

PrivMsg("^1Çok hızlı komut kullanıyorsun. ^3(" . GetCurrentPlayerVar( "control_commands") . ")^1'a kadar komut kullanamazsın.");
ENDIF
ELSE
PrivMsg("^1Hareket halinde bu komutu kullanamazsın!");
ENDIF
ELSE

PrivMsg("^1Sadece drag bölgesinde kullanabilirsin!");
ENDIF
ELSE
PrivMsg("^1İzlemede bu komutu kullanamazsın!");
ENDIF

BREAK;

The last code I shared was wrong. This is the current one I shared.
This thread is closed

FGED GREDG RDFGDR GSFDG