-
Posts
353 -
Joined
-
Last visited
-
Days Won
3
Everything posted by LoPollo
-
As it should be: the goal of the quoted script is having a table used to workaround the issue you have, and the resource is this script with an exported function that read that table and tell you if the player was in a vehicle when he dead/was killed, returning the vehicle he was in if or false. Keep in mind the resource i posted as hex works by having an handler with high priority, so it's not reliable when used together with resources that have handlers of onPlayerWasted on "high" priority or higher, or similar situations* * Read the spoiler
-
Are you starting the resource when already connected? Also there are parts i don't understand: if currentSkin == #skins[tostring(team)] then currentSkin = 1 and currentskin is the model of the player... why compare to table lenght?
-
Check "[Install_Path]\MTA San Andreas 1.5\MTA\logs\clientscript.log" for client errors and warnings (default: "C:\Program Files (x86)\MTA San Andreas 1.5\MTA\logs\clientscript.log")
-
Didn't finish to read the code, but according to getElementsByType getElementsByType ("vehicle", true)--line 10 --should be getElementsByType ("vehicle", root, true) PS: this should also throw an error, did you make sure there aren't? What do you mean with "displayed"? How can you display a collision?
-
Watch these lines: html of the page: <script> function test(command){ var login = document.getElementById("login").value var password = document.getElementById("password").value mta.triggerEvent("cmsg", login, password, command) } </script> <div class="login"> <input type="text" placeholder="username" name="user" id="login"><br> <input type="password" placeholder="password" name="password" id="password"><br> <input type="button" value="Login" onclick=test("login")> <input type="button" value="Register" onclick=test("register")> </div> client.lua function cmsg(login, password, command) if (command == "login") then triggerServerEvent("login", resourceRoot, login, password) elseif (command == "register") then triggerServerEvent("register", resourceRoot, login, password) end end addEvent("cmsg", true) addEventHandler("cmsg", root, cmsg) He defined a func in js that triggers an event in the script, and then handles it from there... but i don't know where that "mta" comes from: mta.triggerEvent("cmsg", login, password, command) login and password are the inputs, command is the one passed with onclick=test("register") or onclick=test("login") but i don't know where that "mta" comes from... maybe it's predefined?
-
I wasn't replying cause i don't actually have an answer given my knowledges, but since it seems this applies more on less to all people that viewed this for nearly a day.... what do you mean? making all the stuff in html and displaying it with a browser? I think (but not sure) it will work on all PCs, but (still not sure) the browser is slower. As you may understand i'm not really helpful, so have you seen resources like this (i didn't)? If i have time i could give a shot to this intresting argument (html gui)... but till now if nobody knows this... i think you will have to test it yourself sorry Still don't lose hopes about someone experienced with this, and don't let the topic die... i am interested to you questions too
-
(Objects only) In some cases there are workarounds, you can simulate adding an object importing the model, replacing a non used (there are few) or far away object ID, and enjoy the new model. When you get far from the "added" object you unload the model and restore the default. You can have pratically infinite objects with the same ID and different models if they are far enough, and combining more objects ids let you have a much bigger pool. This can be complex through, and not always applicable. But if you have a "chuncked" map and enough ids, you can make really big map/islands/whatever. But making bigs things will cause other problems due to gta sa limits (i'm talking about streaming) I've applied this concept to have some different islands in my test server, using the same id (snowday, deathfall 1&2, a driftmap, snowvalley, iraq)
-
check traffic light states, use with setTrafficLightState
-
Just an idea, but if we bind the label element directly to the veh? Something like this for k, v in ipairs( getElementsByType( "vehicle" ) ) do local name = getVehicleName(v) lbl4[k] = {} ay4 = ay4 + 24 lbl4[k][1] = guiCreateLabel( 10, ay4, 150, 45, tostring(name), false, scrollpane4) lbl4[k][2] = v --"bind" it using tables end addEventHandler( "onClientGUIClick", lbl4[k][1], function() local vehName = guiGetText(source) local theVehicle = lbl4[k][2] --here's the veh vehID = guiCreateLabel( 590, 200, 150, 45, "Vehicle ID:"..tostring(getElementData(vehName,"veh.dbID")), false, staticPanel) end) Note: as always it's untested
-
If i make it for you, next time you won't still be able to script. Read the wiki to learn the funcs, read resources so you can quickly learn lua and mta basics. The thing you want to achieve is not far from you, it's easy and you can make it: it's a very good starting point. Let's write something and check the logs to see where you wrote syntax errors, in little scripts these are near 100% of problems you can encounter. You will eventually get the "logic" and learn to convert that thought to a working script. We can help through this, but it's hard someone will make the entire script for you for free (even if i've seen this happening). Start reading the examples in the wiki and other simple scripts, write something, check if it works, and if not reply here: we're still here to help! Good luck
-
I can't understand what this means: if isObjectInACLGroup("user." .. account, aclGetGroup("Admin,Moderator,Owner")) then end Text: To make a text on the head of someone you could make a clientside script that checks if the admin is on duty (and if he is then draw the text) setElementData(...) getElementData(...) dxCreateRenderTarget(...) dxSetRenderTarget(...) dxDrawText(...) addEventHandler( "onClientRender", ...) Weapons: getDistanceBetweenPoints3D(...) giveWeapon(...) --use triggers to use it client side if you really need to otherwise --if you make this script serverside you can replace getDistance... with colshapes createColSphere(...) attachElements(...) addEventHandler("onColShapeHit", ...) --you can use colshapes in clientside to but it require additional work to handle them (streaming) Another solution is to prevent them from shooting setControlState(...)
-
Probably exports["(T-RPG)VIP"]:isPlayerVIP(thePlayer) returns a boolean value, and you can't compare ( > ) a boolean with 1 (a number) It would be helpful if you posted the error you receive, but if i'm right it should be something like "cannot compare boolean with number". If i'm wrong then post more info about the problem, starting from the error
-
Are you using this cmd? also is your server a default one (no scripts other than defaults, -play +race)?
-
Great idea! Hope it gets implemented
-
You are right... it acceps elements and not coord... i was thinking a way without the function and used the "logic" with the isElWithinCol that already do a part of the job
-
get the element coords, iterate all the colpshapes and check if it's inside
-
More info pls. What setting(s) are you changing?
-
There's a workaround i have written it in a hurry so test it before implementing it in a script local pedsOccupiedVehicles = {} function onVehEnterHandler(thePlayer,seat,jacked) local theVehicle = source pedsOccupiedVehicles[thePlayer] = theVehicle end addEventHandler( "onVehicleEnter", root, onVehEnterHandler) function onVehExitHandler(thePlayer,seat,jacked) local theVehicle = source pedsOccupiedVehicles[thePlayer] = false end addEventHandler( "onVehicleExit", root, onVehExitHandler ) function onPlayerDeathHandler(totalAmmo, killer, killerWeapon, bodypart, stealth) local thePlayer = source pedsOccupiedVehicles[thePlayer] = false end addEventHandler( "onPlayerWasted", root, onPlayerDeathHandler) function checkOnStart(theResource) for _,thePlayer in pairs(getElementsByType( "player")) do pedsOccupiedVehicles[thePlayer] = getPedOccupiedVehicle( thePlayer ) end end addEventHandler( "onResourceStart", resourceRoot, checkOnStart ) I tried to be as clear as possible, let me know if it works PS: maybe it's a good idea to make a resource with an exported function? setting the handler of death to low, and declaring an exported function that returns the veh for that player may be helpful, you wouldn't have to implement it in every script
-
In the scripting forum it would be helpful if we had a dedicated tag for help requests and resolved topics, so we can see if a topic has been resolved or if we can still help him. I'm not saying that a resolved topic should be closed (maybe an even better solution could be found), and i'm not requesting unrestriced edit or similar (we all know that's not good, think about someone deleting the main post and thus making it useless to everyone who have the same problem, or someone that edits the main post making the replies nonsense, etc). I'm suggesting a tag made exactly for this: split the answered questions from open problems. it will be faster to search for a problem, and who enters the forum to help others will not have to waste their time in topics that they will later found solved. Hope i've been clear. Also post here if you like the idea and above all post here why you don't like the idea, so we can use criticism to make this idea better and more complete
-
I would check the names of variables (i would avoid "marker", "client" for example) I also suggest a full rewrite of the code aligning it like this: function someFunction(someParameter) local someVariable = doSomethingWith(someParameter) if someCondition then someVariable = doSomethingMoreWith(someVariable) end return someVariable end It will be readable and it will make our work much faster, easier and with fewer errors caused by not understanding the code, so more reliable So your aligned code is: local client = getLocalPlayer() local rootElement = getRootElement() local theMarker = nil addEvent("showVehicle",true) addEventHandler("showVehicle",rootElement, function (vehiclesTable,marker) theMarker = marker guiSetVisible(window ,true) showCursor(false) guiGridListClear(grid ) for i,v in pairs(vehiclesTable) do function spawnveh(button, press) if(press) then if(button == tostring(i)) then triggerServerEvent("vehicle_spawn",client,client,getVehicleModelFromName(v),theMarker) exports["SAEGMessages"]:sendClientMessage("You "..tonumber(getVehicleModelFromName(v)).."e.",client,255,100,0) end end end local row = guiGridListAddRow(grid ) guiGridListSetItemText(grid , row, 1, tostring(i), false, true) guiGridListSetItemText(grid , row, 2, getVehicleNameFromModel(v), false, false) addEventHandler("onClientKey", rootElement,spawnveh) end end ) You are making a gui, use it instead of "onClientKey" ! What will happen if #vehiclesTable is more than 10 (0-9)? you won't be able to reach those.
-
Marking as resolved a topic
LoPollo replied to LoPollo's topic in Site/Forum/Discord/Mantis/Wiki related
Good... then i think i'm going to make a topic for this suggestion (that topic is more like an info request) Is this section ok or is there a suggestion subforum (and not client/server feature requests)?