[QB/ESX] [FREE] snr-motelv2 / simple config, open source, qb-target supported and optimized

[QB/ESX] [FREE] SNR-MOTELV2 / SIMPLE CONFIG, OPEN SOURCE, QB-TARGET SUPPORTED AND OPTIMIZED

Friends, since v1 is a simple escape, v2 is a simple motel script that every breathing being can install, which you can set up both esx and qbye with qb-target support in one move!

Features;

  • When you enter the game, it gives you a random motel room.
  • Only qbcore infrastructure can use Target!
  • shared/config.you can configure the framework via lua.
  • You can copy and use the codes in the script, after all, I’m sharing, and whoever wants to change their name can also change it.
  • shared/config.you can make blip setting via lua.
  • I also shared the maps in the photo, I don’t remember the producer, but I shared it with him.

Preview;

1
2
3
4
5
notify
7

Download;

Script (Github)

Code is accessible Yes
Subscription-based No
Lines (approximately) 398
Requirements qb-core or esx
Support Yes
4 Likes

Upd+++

I had already told on other forums that your script is not really optimized and coding was not correct. You told me that you would change it according my advices to you but i see you still didn’t do anything.
There are mistakes like usage of loops, distance checks instead of polyzones, drawtexts, markers etc. that are not optimized at all.
Still an advice to change them instead of telling that it is optimized …
Besides that, it’s a nice resource. Keep up the good work.

1 Like

Let me repeat the answer I gave in other forums, you suggested Polyzone but I didn’t want to use the script to provide less requirements. In the framework selection, he asked me to install it on the script name, but instead I did it based on the config selection, you asked me to put a return on the player load triggers, logic came and I did it. The reason I’m not doing some of the things you said is because I don’t want to reduce the requirements of the script.

You still didn’t got it.
What i mean was, you have while loop, inside the while loop you are checking for the config option and after true you are looping one more time for the coreobject :

What i meant was, why do you need the first while loop for ? And gave you the idea besides this to do it automatically with GetResourceState native. So based on the framework script name you can see which framework they are running and use that as framework.

What i told you about the controls was, use a return instead of if … then (empty) else …
And you just typed return inside if … then return else … :smiley:
So in my example i adviced to use it like :

RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function()
    if Config.ESXorQBorNewQB == "qb" or Config.ESXorQBorNewQB == "newqb" then return end
    suankimoteli = math.random(1, #pinkcage)
    TriggerEvent('notification', locale.Newmotel ..suankimoteli, 1)
end)

An you did :

RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function()
    if Config.ESXorQBorNewQB == "qb" or Config.ESXorQBorNewQB == "newqb" then
	return
    else
        suankimoteli = math.random(1, #pinkcage)
        TriggerEvent('notification', locale.Newmotel ..suankimoteli, 1)
    end
end)

About the dependencies, everyone uses nowadays polyzone, ox_lib, qtarget, qb-target or whatever other optimized script. You can just use it also in your scripts if you want to call them “optimized”.

Don’t get me wrong, i’m just trying to point you to the right direction since you were away from coding for a long time. If you learn the right way, you will always do it right.

2 Likes

i have corrected now the playerloaded return section.

if you examine the while loop, it breaks after checking the core 1 time. (except old qb)

thank you very much for your suggestions :heart:

What i mean was, you don’t need that while loop and breaks because you are already checking inside the thread for config and load the framework if it succeed.

I have send a PR with the optimizations.

1 Like

+Updated

1 Like