
BinSlayer1
Members-
Posts
491 -
Joined
-
Last visited
Everything posted by BinSlayer1
-
@myonlake: Why teach him to use an old module? MTA supports sql/mysql itself.. https://wiki.multitheftauto.com/wiki/Ser ... _functions Check the "db..." functions. They can be used for both sql and mysql and unless you have a mysql server you're gonna have to use sql @ GanJaRuleZ But yes, I also suggest setAccountData for beginners especially because it requires an account and not everybody will spam it. But if you think you're up for it, sql is a far more efficient method
-
local police = {[598]=true, [596]=true, [597]=true, [599]=true, [601]=true, [490]=true, [528]=true} function pAccess (thePlayer, seat) if police[getElementModel(source)] and getTeamName(getPlayerTeam(thePlayer)) ~= "LVPD" and seat == 0 then cancelEvent() outputChatBox("you are not a Police officer", thePlayer) end end addEventHandler("onVehicleStartEnter",root,pAccess) Here you go. But.. You do realise that you must learn from the codes that are given to you, don't you? Next time try to do it yourself. You need to learn from the mta wiki. Click the function names in the code for more info.
-
local police = {[598]=true, [596]=true, [597]=true, [599]=true, [601]=true, [490]=true, [528]=true} function pAccess (thePlayer) if police[getElementModel(source)] and getTeamName(getPlayerTeam(thePlayer)) ~= "LVPD" then cancelEvent() outputChatBox("you are not a Police officer", thePlayer) end end addEventHandler("onVehicleStartEnter",root,pAccess)
-
that's what it's scripted to do.. it looks like it does just that
-
thats the only file? whats this for then if i may ask? registry.db thx mate it's to be used by the first SQL functions to exist in MTA. https://wiki.multitheftauto.com/wiki/Ser ... _functions The ones that begin with "execute..." The ones that begin with "db..." are newer and they are able to have their own database different than registry.db
-
Since you say you don't know what is needed, I'll explain so u understand (having the function names isn't everything so this might help u) so let's start off by using command handler: addCommandHandler in the cmd handler, check that the player is in a vehicle with isPedInVehicle Check that the vehicle has no existent element data about owner, because if it does then you shouldn't override it Attach the player element to the vehicle as element data afterwards, onVehicleStartEnter. Check to see if the vehicle has an owner. If it does, you will cancel this event IF the player stored as element data in the vehicle that is about to be entered is different than the player attempting to enter it Note: everything gets lost in case of vehicle being destroyed somehow. It's gonna be harder to avoid this, but not impossible I believe.
-
no https://wiki.multitheftauto.com/wiki/SetElementData "As such you should avoid passing data that is not able to be synced into this function (i.e. xmlnodes, acls, aclgroups etc.)" Passing GUI elements to setElementData is not able to be synced with the server since GUI elements do not exist in the server.
-
But that defeats the purpose of ACL.. You might as well do user.* and it's as good as deleted
-
if I understand correctly you want to convert RO to ro? str = 'RO' str = string.lower(str) > str = 'ro'
-
Goddamnit you dont have the slightest clue about scripting yet you will give your opinion on just about everything because you so experienced. When a resource start event is attached to the root element, it is REQUIRED to check that the resource passed is the current resource (getThisResource()) . Because, otherwise (since it's attached to the root element), it'll execute the codes everytime a (ANY) resource starts
-
Creating a script which reloads a resource at a certain time
BinSlayer1 replied to Thomas_Matthew's topic in Scripting
use setTimer and leave the timer to run indefinitely every 5 seconds or so and check if #getElementsByType('player') returns 0 if it does return 0 then restartResource() and destroy the timer and no 'else' -
Damn that was my bad, didnt notice sry most lua scripts actually have lowercase letter @ beginning of function D:
-
You must run this script from the same resource as the laser resource.. Because I didn't add any export to it so those functions are unknown to your current resource
-
Great. Although somebody with wiki access should edit https://wiki.multitheftauto.com/wiki/Filepath because this is not described there. (Although you can find it in xmlLoadFile's page, it should be made clear)
-
you need to store as element data and then use it in dxDrawImage -> :/img.png NOTICE the ":" , they are required. I am not 100% sure as I haven't tested it myself, BUT this is the explanation of filepath @ xmlLoadFile https://wiki.multitheftauto.com/wiki/XmlLoadFile I can only assume this filepath system is persistent across all MTA functions EDIT: Also, check the Note here about client-side paths : https://wiki.multitheftauto.com/wiki/Filepath
-
Didn't work. Should i put it in ACL? No. But you need to make sure it's running in server-side. Debug it like this addEventHandler("onPlayerSpawn",root, function() outputChatBox(tostring(isLaserEnabled(source)), source) outputChatBox(tostring(setLaserEnabled(source, true)), source) --if not isLaserEnabled(source) then setLaserEnabled(source, true) end end ) Run this script server-side. Tell me exactly what it says in the chatbox when you SPAWN.
-
So? That's just your original script that you posted here.. But you've been given a bunch of scripts. Have you tested them out? If yes, well, do they behave like you want? Orange's script looks fine to me. If it doesn't work, then say what doesn't work..
-
addEventHandler("onPlayerSpawn",root, function() if not isLaserEnabled(source) then setLaserEnabled(source, true) end end ) Use it server-side
-
but not an exception in private mail? I do not want to create a server but it's just a curiosity to try to please but this is the wrong place to ask.. you need to go to their website/forum this forum is for MTA-related stuff (MTA as a whole). Servers are private and their scripts are unknown to the MTA Community
-
What happend to the dude-part? Well then. No problem, DUDE! PS: I just had to say that
-
addEvent('onPlayerReachCheckpoint', true) --this is most important... since the event is CUSTOM and not built-in MTA.. --Check this: [url=https://wiki.multitheftauto.com/wiki/RU/Resource:Race]https://wiki.multitheftauto.com/wiki/RU/Resource:Race[/url] addEventHandler("onPlayerReachCheckpoint", root --you forgot this bit function(checkpoint) --i am not sure, but i dont think you can name the function if you use it like that. Afaik the function must already exist when calling it by name local randomboats = math.random(454, 472) if ( isPedInVehicle ( source ) ) then if checkpoint == 1 then setElementModel ( getPedOccupiedVehicle (source), randomboats ) end end end ) PS: What's with all the 'dude-dude-dude' thing..
-
Sorry but you have a lot of errors. This time I will post how you should have done it hoping you can learn by looking at the code adminTeam = createTeam ( "Admins", 255, 0, 0 ) function setPlayerAdmin() accountname = getAccountName (getPlayerAccount(source)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "admin" ) ) then setPlayerTeam(source, adminTeam) end end addEventHandler('onPlayerLogin', root, setPlayerAdmin) Notice onPlayerLogin instead of onPlayerJoin. When the player joins he will most likely not have logged into his admin account
-
How do you expect help without posting any code? We have no idea what you did there, or if it's correct at all.
-
No, you need to use getTeamFromName I know the problem has been solved, but I'd like to clarify that you don't need to use getTeamFromName. createTeam returns an element which can be used for all functions just fine. (Tested)
-
MOJRM-511, your code looks fine. However, createTeam returns a team element if it was successfully created, false if invalid arguments are passed or a team with that name already exists. MAKE SURE the team is NOT already created by some other resource or whatever. If this is not the case, then maybe meta.xml is wrong?