The online racing simulator
Searching in All forums
(921 results)
broken
S3 licensed
Quote from clark25275 :How can i put this to left side i', a new coder...please help

InSim.Send_BTN_CreateButton("" + TempCars1, Flags.ButtonStyles.ISB_DARK[B][COLOR="Red"] | Flags.ButtonStyles.ISB_LEFT[/COLOR][/B], 5, 60, 0, 137, 140, NCN.UCID, 2, false);
InSim.Send_BTN_CreateButton("" + TempCars2, Flags.ButtonStyles.ISB_DARK[B][COLOR="red"] | Flags.ButtonStyles.ISB_LEFT[/COLOR][/B], 5, 60, 6, 137, 141, NCN.UCID, 2, false);


Please wrap code in [CODE] tags. Quote tags can not be quoted.
Also, that's not exactly the place for such a question.

Anyway, hope that answers your question.

[Edit] Ah, sorry. Didn't notice there was no text.
In that case: Find the T and L parameters. They define the distance from the Top and Left sides of the LFS screen. They can be any number between 0-200. 200 would mean that you button can not be seen. I think it is more than obvious why. If not: Read the InSim.txt file in the docs folder in your LFS folder.
Last edited by broken, .
broken
S3 licensed
I think that you are likely to receive more support about Lapper in the LFSLapper Development section.
Not sure how right I am, but my guess is that most LFSLapper developers read that section more often.

Also, it is possible that someone has already posted such system in that section too. You can through a few pages if you like to.
Just suggesting.
broken
S3 licensed
Final, perfectly working solution:

Bulgarian to English:

$invalid = array
(
"/(?<=[^р-я])я[.^р-я]*/",
"/(?<=[^р-я])ф[.^р-я]*/",
"/(?<=[^р-я])мар[.^р-я]*/",
"/(?<=[^р-я])ап[.^р-я]*/",
"/(?<=[^р-я])май[.^р-я]*/",
"/(?<=[^р-я])юн[.^р-я]*/",
"/(?<=[^р-я])юл[.^р-я]*/",
"/(?<=[^р-я])ав[.^р-я]*/",
"/(?<=[^р-я])сеп[.^р-я]*/",
"/(?<=[^р-я])о[.^р-я]*/",
"/(?<=[^р-я])н[.^р-я]*/",
"/(?<=[^р-я])дек[.^р-я]*/",
"/(?<=[^р-я])сек[.^р-я]*/",
"/(?<=[^р-я])ми[.^р-я]*/",
"/(?<=[^р-я])ч[.^р-я]*/",
"/(?<=[^р-я])ден[.^р-я]*/",
"/(?<=[^р-я])дни[.^р-я]*/",
"/(?<=[^р-я])ме[.^р-я]*/",
"/(?<=[^р-я])г[.^р-я]*/"
);

$valid = array
(
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
"seconds",
"minutes",
"hours",
"day",
"days",
"months",
"years"
);

English to Bulgarian:

$invalid = array
(
"/(?<=[^a-z])ja[.^a-z]*/",
"/(?<=[^a-z])f[.^a-z]*/",
"/(?<=[^a-z])mar[.^a-z]*/",
"/(?<=[^a-z])ap[.^a-z]*/",
"/(?<=[^a-z])may[.^a-z]*/",
"/(?<=[^a-z])jun[.^a-z]*/",
"/(?<=[^a-z])jul[.^a-z]*/",
"/(?<=[^a-z])au[.^a-z]*/",
"/(?<=[^a-z])s[.^a-z]*/",
"/(?<=[^a-z])o[.^a-z]*/",
"/(?<=[^a-z])n[.^a-z]*/",
"/(?<=[^a-z])d[.^a-z]*/"
);

$valid = array
(
"Ян",
"Фев",
"Мар",
"Апр",
"Май",
"Юни",
"Юли",
"Авг",
"Септ",
"Окт",
"Ное",
"Дек"
);

Last edited by broken, .
broken
S3 licensed
[Edit] Actually, this isn't so true... Needs more tweaking...

Thanks everyone.

For anyone who cares about the final solution: The last code I posted worked fine, until I started testing it thoroughly. It failed here and there, so I started tweaking it. And the final result is exactly the answer to my very first question.

The regex is actually very simple(if you understand them), but it took me around 3 days to figure it out. The code looks like that:

$invalid = array
(
"/[^а-я]я[.^а-я]*/",
"/[^а-я]ф[.^а-я]*/",
"/[^а-я]мар[.^а-я]*/",
"/[^а-я]ап[.^а-я]*/",
"/[^а-я]май[.^а-я]*/",
"/[^а-я]юн[.^а-я]*/",
"/[^а-я]юл[.^а-я]*/",
"/[^а-я]ав[.^а-я]*/",
"/[^а-я]сеп[.^а-я]*/",
"/[^а-я]о[.^а-я]*/",
"/[^а-я]н[.^а-я]*/",
"/[^а-я]дек[.^а-я]*/",
"/[^а-я]сек[.^а-я]*/",
"/[^а-я]ми[.^а-я]*/",
"/[^а-я]ч[.^а-я]*/",
"/[^а-я]ден[.^а-я]*/",
"/[^а-я]дни[.^а-я]*/",
"/[^а-я]ме[.^а-я]*/",
"/[^а-я]г[.^а-я]*/"
);

And in english, that is similar to:

$invalid = array
(
"/[^a-z]ja[.^a-z]*/",
"/[^a-z]f[.^a-z]*/",
"/[^a-z]mar[.^a-z]*/",
"/[^a-z]ap[.^a-z]*/",
"/[^a-z]may[.^a-z]*/",
"/[^a-z]jun[.^a-z]*/",
"/[^a-z]jul[.^a-z]*/",
"/[^a-z]au[.^a-z]*/",
"/[^a-z]s[.^a-z]*/",
"/[^a-z]o[.^a-z]*/",
"/[^a-z]n[.^a-z]*/",
"/[^a-z]d[.^a-z]*/"
);

I'm using the english one for translation purposes - to bring back the correct bulgarian name of the month. Yes, maybe it's too complicated and not optimized, but I was looking for a reason to learn something new.

I might explain what the regex does, for those who want. But that is if I have time for it, and if I actually remember to do it.
Last edited by broken, .
broken
S3 licensed
Quote from NotAnIllusion :"$subject = януари февруари some english март" => The result from this should be "january february some english march".

It is supposed to replace and return all cyrillic words in the input string in one go, it seems to me.

Indeed. Sorry for the late response.

But, there are more than 24 instances in the Bulgarian language. It's just to be more flexible as I said. And there is a reason for that.

Different people write them in different ways. If I support 24, why not just support the way they will all start typing them?

Example with what should be turned into "September":
Септември (Translates: September)
Се (Translates Se. Unlikely, but not impossible to be shortened that way.)
Сеп (Translates: Sep)
Септ (Translates: Sept)

And, with the regular expression I'm using(the last one I posted), it's also typo-safe. It may use more resources, but in my case, it's better than reloading the page just to tell the user their date has not been recognized.

There's the code I'm using, and it works fine so far:

<?php 
function validate_months($string)
{
    
$invalid = array
    (
        
"/я[нуари]/",
        
"/ф[евруари]/",
        
"/мар[т]/",
        
"/ап[рил]/",
        
"/май/",
        
"/юн[и]/",
        
"/юл[и]/",
        
"/ав[густ]/",
        
"/с[ептември]/",
        
"/о[ктомври]/",
        
"/н[оември]/",
        
"/д[екември]/"
    
);
    
    
$valid = array
    (
        
"January",
        
"February",
        
"March",
        
"April",
        
"May",
        
"June",
        
"July",
        
"August",
        
"September",
        
"October",
        
"November",
        
"December"
    
);
    
    
$string preg_replace($invalid$validmb_strtolower($string));
    
// And to strip other weird stuff, I've created another function
    
$string strip_weirdness($string);
    return 
$string;
}
?>

PS: Sorry for the confusing reply. Hope you understand what I'm trying to say.
broken
S3 licensed
Quote from thisnameistaken :I am having trouble understanding what this is supposed to do, I think all the Cyrillic characters are confusing me.

So the first pattern should pull the word for january out of the string? And replace it with the English word 'january'?

Yes.
Quote from thisnameistaken :If you're writing a pattern to match only one specific substring (it seems you're using different patterns for february and march) wouldn't it make more sense to just use str_replace()?

Well, I just want it to be more flexible. You know, in English, you can write February, or you can write Feb. You can do the same in Bulgarian.

Anyway, I think I found a solution.
Just make the pattern like so: F[ebruary].
Of course, that would mean that June and July patterns would be like this: Jun[e] and Jul[y].
Simple(?) PHP regex
broken
S3 licensed
Hi, I am having a little difficulty with regexes, as you have already probably guessed from the title.

Actually, I've learned them a few times now. But every time I need to use one, I need to learn them again. They just don't want to stay in my head.

Basically, what I want to achieve, is to match a specific letter, and all the letters that follow after it, until it reaches another character(which isn't anymore a letter). I want to do it for Cyrillic letters, if that matters. But it should be the same thing as for Latin ones, I guess.

I am using http://www.functions-online.com/preg_replace.html to test as soon as I find something that might solve the task.
Here's what I'm testing with now:
$pattern = array('/я[а-я]+[^а-я]/', '/ф[\p{L}]+[^\p{L}]/', '/м[\p{Cyrillic}][^\p{Cyrillic}]/')
$replacement = array('january', 'february', 'march')
$subject = януари февруари some english март

January almost works.
February is a little worse.
March just doesn't.

In January, I think I only need to make it not stop after same matches? I tried placing a dot before the plus ('/я[а-я].+[^а-я]/'), but then it returned only "january".. xD

Thanks for any help in advance!

[E] The result from this should be "january february some english march".
Last edited by broken, .
broken
S3 licensed
Thanks.

Needed to know if I have to make my functions compatible with that change.
(And now I do, obviously.)
broken
S3 licensed
Is there any reason for the NCN.UCID to be an integer? If not, then.. this is a bug?
broken
S3 licensed
Quote from PMD9409 :Hey if you think about it, no one will be able to guess these passwords.

That's the whole point.

But they are not very safe against attacks.. After all, they only consist of letters, and maybe a number here or there. But if someone wants to hack your account, a strong password is not a 100% guarantee that they would fail. My main idea was to have a password that your friends have no way of guessing.

This is like the middle option:
Best: Use a strong password generator (very safe, but not really easy to remember)
Middle: Use this generator (not very safe, but fairly easy to remember)
Worst: Chose a password, which is either very easy to guess, or just the same as your username (no comment)


Of course, you can always think of a password yourself, but I didn't include that above, because I wouldn't have been able to say that PassGen is the middle solution.
broken
S3 licensed
Quote from FPVaaron :I tried to add a new word but apperently ****, [**] and [**] are already added. what a dirty mind you have.

Not really, those words never existed. Maybe you didn't enter the captcha code? It says that the word already exists if you don't. I will have to fix that.
Quote from Takumi_lfs :Generated password: fuuuuuuuuuuucollected

Sorry, but I had to ban most of your words.

@Everyone: Thanks for having fun with it. It's cool to see people are having fun with it, haha.

And a little request: If you are going to enter words, please make sure you enter them separately (either by submitting them one by one, or dividing them with spaces). Multiple words at once make the generator loseitsuniqueness a bit.
broken
S3 licensed
Quote from morpha :I suggest:
[+ code]

Why leave all those other symbols? I'm leaving only a-z and 0-9. And lowering everything before that.

And by the way: Uploading the changes in a minute. ^_^

[E] Changes uploaded. And, morpha, thanks for suggesting array_unique. I had forgotten about it.
Limitation added: You can't submit more than 15 words at once("at once", meaning per form submission). It will just get the first 15.
Last edited by broken, .
broken
S3 licensed
Yeah... That's a good idea. Thanks!
broken
S3 licensed
The list is still too small, yes. ;d

And a quick change: You can now add 300 words per captcha. If any bots get to it, I will put it back to 10 again.
broken
S3 licensed
It's still better than having a password identical to your username. If you try a bit harder, you can find something funny, that you can actually remember. And it won't be too long. Or too random, as a really strong password would be. Yes, the passwords generated from it aren't really safe, but at least you won't need to go to your email, or whatever to copy it.
Stupid little random pass gen
broken
S3 licensed
Sooo, hello... I don't really know how to start this thread, because there's only one thing to say, and I didn't want to start drifting around the point, but there I am, doing exactly that. Anyway..

I made a small app, just to entertain myself, and to practice my skills on something a bit unusual.

There's the link: http://lmutafov.com/projects/passgen/

What is it?
Quote from The site :PassGen is an application, that creates a password from a random sequence of 2 to 5 words. The words are submitted by you, or any other person.

I decided to name it PassGen, because I am that smart, and this is such a unique name. Accepting suggestions for a name, anyone? Or I could just make it generate one itself.

The captcha pops up on every 10 successfully submitted words.

The database was just reset. The choice of what's going to be in it is up to you. Of course - random stuff like "asd", and the likes will be deleted. Offensive stuff will also be deleted.

And some useless information, in case you care:
How did I come up with such a stupid idea? - It happened at work, when I had reached the point when 95% of the work was multiplying (copy/paste/delete stuff (I was making the admin sys for a site)), so you can tell how boring that was. And then, it just struck me - make a pass generator. It's gonna be something really fast, and it's going to be entertaining, and this boredom would go away, eventually. I had watched The Social Network the night before, so I had an idea about how the "design" was going to be too. If you've watched the movie, you'll see how similar it is to FACEMASH . I did it, it took 20mins to make the basic functionality, and boredom was defeated too. After that, it took me a few more days to implement some stuff, before it's ready to go public. And there it is - the result from total boredom.

Well, that's it. Have fun.. or.. something.

[E] And uh, yeah, I just noticed the overflow. Sorry about that.
broken
S3 licensed
Well, I will definitely look that up when I have more time, even though I am quite happy with the results I've came up with. I used a UNION. Tested it with a few queries, and like this

(SELECT `column` FROM `table` LIMIT x,1)
UNION ALL
(SELECT `column` FROM `table` LIMIT y,1)
UNION ALL
(SELECT `column` FROM `table` LIMIT z,1)

, the query takes 0.0004 sec. I won't be pulling out more than 5 results, so for me, that's more than satisfying. And as for the randomization - I left that to the PHP.

[E] It will also work very well with gaps in the ids(with UNIONs), and it will still be as random. I didn't really like where the article headed when it came down to those gaps. But maybe I just have to read it more carefully.
Last edited by broken, .
ORDER BY RAND() alternatives (PHP + MySQL)
broken
S3 licensed
Hi,

I'm building a small app, which extracts 2 to 5 different results from a database, but I did it in a very wrong way at first.

Let's say that for these examples we need to extract 3 random results.
At first, I did it like that: ORDER BY RAND() LIMIT 3
But it started loading longer, so I decided to try and optimize it a bit.

And so I did. Right now, it gets the row count with an SQL query; php randomly picks 3 values, and I turn that in a WHERE `id` = 'x' OR `id` = 'y' OR `id` = 'z' query. I know putting LIMIT to that would make it more optimized, but I want to optimize it even more than that.

So, I was thinking of sending 3 queries to the database. Like so:
ORDER BY `id` LIMIT x,1
ORDER BY `id` LIMIT y,1
ORDER BY `id` LIMIT z,1

But, is this actually more optimized? Also, is there a better way of doing it? Or in other words: What's the best way of doing it?
broken
S3 licensed
I never said, or even hinted I could do that. How did you come up with that idea?
broken
S3 licensed
Quote from Bmxtwins :cruising isn't realistic. Or atleast i'm pretty sure noone is driving an FIA GT1 car down the street, nor are there barriers in the street either.

We do have red/white barriers in the middle of the street in my city.
The previous thing... yes, ok, but it is just a game, who needs it to be so realistic? Also, if you are the right person, and try hard enough, you could achieve in getting any car on a normal road.
broken
S3 licensed
I don't see how "We've got too many of them" is a valid point. There are too many of the race servers too, and most of them are also empty. So, that very same point is valid for race servers. The point, that "LFS is a racing simulator" is also invalid. It might be a racing simulator, and it is. Some cars are made for driving in the city too. Do you see me attacking people, because they've decided to go on the track and participate in a race or drift, just because the car isn't made for that?
broken
S3 licensed
Funny.
broken
S3 licensed
Quote from reason0809 :i wasnt speaking in someones name anyways, so i dont get the question

Quote from reason0809 :[..]c'mon people, WE DONT NEED THIS

.
broken
S3 licensed
Quote from reason0809 :[..]WE DONT NEED THIS

Don't enter the server, then.

And, please, I don't know you - why are you speaking from my name?
broken
S3 licensed
If all you, complaining people really hate the situation that much, and it bothers you a lot, go organize a protest. Heck, go protest in front of Scawen's house if you're that unhappy.

But, I bet, the moment he opens his door you will all start screaming like little JB fangirls..


+ By complaining here you are doing exactly nothing. You may think you have a whole community behind your back, but it's actually just you, in your room, alone.
FGED GREDG RDFGDR GSFDG