-
Posts
367 -
Joined
-
Last visited
Everything posted by kieran
-
My bad, I forget many are hard coded I personally think there is an easier way to disable hard coded scripts, can they not just add them to xml so you can simply do a true/false to choose if they are active? In my opinion would be so much easier...
-
Can't edit last post so no hating for double posting, here is the solution! I used "isPedOnGround" same function in one of the maps where you need to defend area 51 and attacking team must be on foot to trigger function. function testMarker(hitElement, matchingDimension) if isElement(hitElement) and getElementType(hitElement) == "player" and matchingDimension then if getPlayerTeam(hitElement) and getTeamFromName("Test") then local playerTeam = getPlayerTeam(hitElement) local checkTeam = getTeamFromName("Test") if tostring(playerTeam) == tostring(checkTeam) then if isPedOnGround ( hitElement ) then outputChatBox("It works!", hitElement, 255, 0, 0, false) else outputChatBox("You must be on foot!", hitElement, 255, 0, 0, false) end end end end end addEventHandler("onMarkerHit", testingMarker, testMarker) Thanks all for help!
-
@koragg Thanks I got a ton of errors after deleting it saying it can't find resource, useful tip hehe. And yes, it does just cancel message, but as you say, just use your method and search for "login:" easier than having another messy script! Lol
-
For now I am trying to simply make a marker to set a team, only if the player is on foot he will be able to trigger the event to set team, I then am trying to get a second marker to (for now) output text to the player in the team... As you can see all this happens, but the problem is that the functions are triggered if player is in vehicle and if player is on foot, meaning they could abuse it later as I plan to make a simple GUI outlining the job, the job will be a drug delivery/weapons delivery, this is very easy to do, just make vehicles in table, attach a few crates or something to inside of vehicle and when the vehicle spawn it will trigger a client side event creating a marker, attaching a blip, and then when the player hits the marker created, he will get a cash reward depending on vehicle health. I know how to do the actual script... But for now I just want to take it easy and tackle the main issue, events being triggered when a player hits a marker. Is a lot to read? Make sense?
-
Thanks all! Infinity was closest, I figured out by replacing if isPedInVehicle(hitElement) then return end with if isElement(hitElement) and getElementType(hitElement) == "vehicle" and matchingDimension then return end It would do a simple check to see if element is vehicle and return if it is. It may be a little weird to use that but it works! no errors hehe. Once again thanks @Infinity#, @koragg and @DNL291 EDIT ^^^Never mind, nothing works, it always triggers the event is server side (obviously) so I dunno if that is problem, anyway! Cheers chaps.
-
You shouldn't be getting any weapons, is there any other lua files at all from this resource? Have you tried entering with 0 weapons?
-
Maybe add function to get weapons using getPedWeapon, getPedAmmo, and givePedWeapon, givePedAmmo ? Hold on! See in your "spawns" do you have something called "givePedWeapon" or "givePlayerWeapon" ? If so that's where your problem is!
-
@DNL291 No luck, says the same thing: [2017-07-08 06:41:27] WARNING: Teams\JobTest.lua:6: Bad argument @ 'getPlayerTeam' [Expected player at argument 1, got vehicle] [2017-07-08 06:41:27] WARNING: Teams\JobTest.lua:10: Bad argument @ 'setPlayerTeam' [Expected player at argument 1, got vehicle] And now it also says: [2017-07-08 06:41:34] WARNING: Teams\JobTest.lua:17: Bad argument @ 'getPlayerTeam' [Expected player at argument 1, got marker] (My bad, last error was my fault, but first two still there)
-
Hello, I am trying to detect if an element is a vehicle for a team system I'm working on, I have little in the way of a script so far, but it is below... TestTeam = createTeam ( "Test", 20, 100, 150 ) job_mark = createMarker (7002.419921875, -4831.384765625, 9.60000038147, 'cylinder', 2.0, 20, 100, 150, 255) Test_mark = createMarker (7000.419921875, -4831.384765625, 9.7, 'cylinder', 1.0, 20, 100, 150, 255) function Take_Job(source) local theTeam = getPlayerTeam ( source ) if theTeam then setPlayerTeam ( source, nil ) end setPlayerTeam ( source, TestTeam ) end addEventHandler("onMarkerHit", job_mark, Take_Job) function TestMarker(source) if ( isElement(source) and getElementType(source) == 'player' ) then --Here is where I want to check if player is in vehicle. local theVeh = getPedOccupiedVehicle(source) if ( theVeh ) then return else local theTeam = getPlayerTeam ( source ) --The bit below works fine, just need to sort the small section above if theTeam == TestTeam then outputChatBox("it works!", source, 255, 0, 0) end end end end addEventHandler("onMarkerHit", job_mark, TestMarker) Basically if it's a vehicle, return, if it's a player, then later I am making a GUI etc, but for now keeping it simple with giving a message.
-
nvm, in resources on adminpanel there is "mapmanager" set mapmanager.currentmap to false. There must be a simpler way though, eg setting through acl, but the only way I found is disabling via resources so far Simple way to stop votemanager and helpmanager (if you will never ever use these again) is just delete them in resources after you stop it running...
-
Okay, so you know how you do /vote or press f9 to open help and vote for maps? I want to stop these resources from loading and also stop the current map output on chat box, sorry for not being clear, can attach a few screenshots if needed. and thanks for the link! I'll check it out Example: Currently playing: Mode - Map Is there anyway to do text match using "onClientChatMessage" ?
-
Hello I want to know how to disable the "login: you have successfully logged in" message and the vote/help manager. I have been wondering how to do this for quite some time now..... I have messed with various files in the server folder (just acl.xml and server.conf) setting startup to 0 on vote manager and help manager, but nothing has worked... I restarted the server BEFORE changing these and started it again after saving them. Also sorry if wrong section, there's not a general help section, just scripting and MTA chat...
-
I got as far as saving the string, but I just have an issue with actually giving the team now, the error is: WARNING: Teams\team.lua:22: Bad argument @ 'setPlayerTeam' [Expected team at argument 2, got string 'TestTeam'] server script --Team save function onPlayQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then -- if the player is logged in local myTeam = getPlayerTeam ( source ) if (myTeam) then local currentTeam = getTeamName ( myTeam ) setAccountData ( playeraccount, "TeamLog", currentTeam ) -- save it in his account end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayQuit ) --Team load function onPlayLogin (_, playeraccount ) if ( playeraccount ) then local LoadTeam = getAccountData ( playeraccount, "TeamLog" ) if ( LoadTeam ) then setPlayerTeam ( source, LoadTeam ) end end end addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayLogin ) I've tried using getTeamFromName but it doesn't work. EDIT Okay, I have got it working! I feel so dumb, it got the string, so it got the team name, so I just changed this(For anyone that needs this script): teamLoad = getTeamFromName ( LoadTeam ) setPlayerTeam ( source, LoadTeam ) Thank you so much for all your help I can finally work on the job scripts now! haha
-
@MIKI785 Attempted to make it again, I don't think it's quite right, won't work... --Team save function onPlayQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local playerTeam = getPlayerTeam(source) if (playerTeam) then local currentTeam = getTeamFromName ( "playerTeam" ) setAccountData ( playeraccount, "TeamLog", currentTeam ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayQuit ) --Team load function onPlayLogin (_, playeraccount ) if ( playeraccount ) then local LoadTeam = getAccountData ( playeraccount, "TeamLog" ) if ( LoadTeam ) then setPlayerTeam ( source, LoadTeam ) end end end addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayLogin )
-
(facepalm) I forgot only certain things can be stored as data thanks.
-
Topic cool down So I noticed if you have laggy internet you can click button multiple times by mistake, is there any way of doing a 10 - 20 second "topic cool down" where you may not submit one topic after another? Or even a way of going through your recent topics posted and matching the text to 3-5 of them so if it is the same it would reject it due to spam? I'm saying this because... Plainly obvious reasons, I accidentally hit submit 4 times as page wasn't loading (brother was taking up lot of bandwidth).
-
Okay, straight to the point, I am trying to edit the "save_system" script on the MTA resources hoping it will allow me to get a better understanding of setting account data etc, but I am unsure if I'm doing it right, code is below... Not posting whole script, that is a lot to read changed nothing but adding lines below. function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount, "funmodev2-money") if (accountData) then local playerTeam = getAccountData (theCurrentAccount, "funmodev2-Team") setPlayerTeam ( source, playerTeam ) end end end addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) function onQuit (quitType, reason, responsibleElement) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then setAccountData (account, "funmodev2-playerTeam", getPlayerTeam (source)) end end end addEventHandler ("onPlayerQuit", getRootElement(), onQuit) --full thing is around 150 lines, rest is just weapons, armor, money etc which works perfectly. No errors, debug 3 shows nothing, team is called Admin, could there be an ACL group conflict? P.S. Very sorry for spam, submit was not loading
-
I know @pa3ck, but sometimes I have difficulty understanding the explanations, that's why I personally like videos, you can see what they change and what it does etc, but I think I need to just practice and focus on one thing at a time, I have been trying too much at once...
-
Thanks Think I best get back to that page about scripting.
-
I get that, but I want to re-spawn a vehicle if the data is true, and destroy the element if it's false.... It will either re-spawn a vehicle if I don't have destroyElement in, or destroy it if I do add it to destroy it
-
Trying super simple script to set a vehicles data and then re-spawn it if the data is true, it SORT of works, but only AFTER the vehicle explodes. Sorry to bother with so many simple scripts. --This will destroy cars with no data, I want second function to give a vehicle data and if it's true to respawn it :P function respawnExplodedVehicle() setTimer(destroyElement, 1000, 1, source) end addEventHandler("onVehicleExplode", getRootElement(), respawnExplodedVehicle) veh1 = createVehicle( 420, 367.9130859375, 2485.162109375, 17, 0, 0, 90 )--Creating and naming function vehres() veh = setElementData( veh1, "tempdata.check" ) setVehicleColor ( veh1, 189, 200, 12 ) if ( veh == true ) then setTimer(respawnVehicle, 1000, 1, source) elseif ( veh == false ) then return --trying stuff, thought problem was because the code was in first function end end addEventHandler("onVehicleExplode", getRootElement(), vehres)--respawn it Debug says it needs argument at argument 3, but I can't think of what to put there... Edit Change to veh1 = createVehicle( 420, 367.9130859375, 2485.162109375, 17, 0, 0, 90 ) function vehres() veh = setElementData( veh1, "tempdata.check", Vehicle ) setVehicleColor ( veh1, 189, 200, 12 ) if ( veh == true ) then setTimer(respawnVehicle, 1000, 1, source) elseif ( veh == false ) then return end end addEventHandler("onVehicleExplode", getRootElement(), vehres) But now it says it expects Element at argument one where respawnVehicle is (Line 6). o,o
-
Thanks @DNL291 and @kikos500, it works! tried the script with vehicles DNL, I assume it would work with players too!
-
it freezes him then lets him run..... I am trying to set a peds collisions, is that maybe the problem...? function Ghost() setElementCollisionsEnabled(source, false) setTimer(setElementCollisionsEnabled, 20000, 1, source, true) end addEventHandler("onClientPlayerSpawn", getRootElement(), Ghost) Changed your false and trues, basically he is frozen 20 secs, then he moves. Edit Okay, so this works for vehicles, but how can I get players? just a simple getElementPosition? addEventHandler("onClientVehicleEnter", getRootElement(), function () local v = getPedOccupiedVehicle(localPlayer) -- Get her's Vehicle ID for index,vehicle in ipairs(getElementsByType("vehicle")) do --LOOP through all Vehicles setElementCollidableWith(vehicle, v, false) -- Set the Collison off with the Other vehicles. end end )
-
Hey, so another broken script I made... Wow, a lot gone wrong today anyway.... Tried making a sort of script for players spawning so if say 10 players spawn at once they won't all be stuck in each other, here's the simple stuff I tried. function Ghost() setTimer(setElementCollisionsEnabled, 20000, 1, source, false) setTimer(setElementCollisionsEnabled, 1000, 1, source, true) end addEventHandler("onPlayerSpawn", getRootElement(), Ghost) Basically it freezes him is the problem maybe I have it server and not client side?
-
Tell me if this works, I am a bad scripter, so chances are it will not, but if you get errors on your server then post here. function show_hide_tags( ) local players = getElementsByType ( "player" ) for key, player in ipairs ( players ) do setPlayerNametagShowing ( player, false ) end end function show_hide_tags( ) setPlayerNametagShowing ( source, false ) end addEventHandler("onPlayerJoin",root, function () bindKey(source,"n","down",show_hide_tags) end) Call it server side on your meta.xml