thund3rbird23
Members-
Posts
129 -
Joined
-
Last visited
Everything posted by thund3rbird23
-
It doesn't seem to work. I stored steeringLock for all vehicles and I want to set to attach to the vehicles when they are loaded. I did print the vehicle id and the steeringLock from the database and it's correct: print("Load vehicle [" .. vehicleID .. "] for characterId: " .. data.owner) print(data.steeringLock) then I did setElementData to the vehicles but nothing changes. Keeps the default steeringLock for the vehicles.... setElementData(vehicle, "vehicle.steeringLock", data.steeringLock) setVehicleHandling(vehicle, "steeringLock", data.steeringLock) Or set the handling when players enter the vehicle.
-
mistake , sorry
-
I need to use tables. I don't know how to do that... because I wants to get data from database as JSON: local tunings = fromJSON(data.tunings) if tunings == nil then return elseif tunings[1] == 2 then local handling = getVehicleHandling(vehicle) setVehicleHandling(vehicle, "engineAcceleration", handling + 0.4) setVehicleHandling(vehicle, "maxVelocity", handling + 19) end So in the tunings table have this value: [ [ 2, 4, 4, 4 ] ] as you see if the tunings table first value is 2 then I want to add some values to the current handling. How can I do that?
-
I want to add values to the current handling. How can I do that? This gives me an error: "attempt to perform arithmetic on local 'handling' (a table value)" local handling = getVehicleHandling(vehicle) setVehicleHandling(vehicle, "engineAcceleration", handling + 0.4) setVehicleHandling(vehicle, "maxVelocity", handling + 19)
-
It isn't possible to do with dx? I don't want toggle, I want to close the panel when clicked to close button
-
I want to do, if I click to the close dxdrawrectangle then close the panel. What's wrong with this code?: local screenW, screenH = guiGetScreenSize() function renderPanel() dxDrawRectangle(screenW * 0.3324, screenH * 0.2799, screenW * 0.3609, screenH * 0.3581, tocolor(0, 0, 0, 205), false) closebutton = dxDrawRectangle(screenW * 0.6428, screenH * 0.2513, screenW * 0.0483, screenH * 0.0208, tocolor(254, 23, 23, 205), false) dxDrawText("Close", screenW * 0.6420, screenH * 0.2513, screenW * 0.6911, screenH * 0.2721, tocolor(255, 255, 255, 205), 1.00, "default", "center", "top", false, false, false, false, false) end function panel() addEventHandler("onClientRender", root, renderPanel) addEventHandler("onClientGUIClick", root, function (button, state) if button == "left" and state == up then if (source == closebutton) then removeEventHandler("onClientRender", getRootElement(), renderPanel) end end end) end addCommandHandler("openpanel", panel)
-
createWeapon server side with bone_attach?
thund3rbird23 replied to thund3rbird23's topic in Scripting
Okay, so if I join to the server as "Jeff" then I need to use Jeff? if so where I need to use the name Jeff? in client side where I trigger server events like this: triggerServerEvent("alapAK", resourceRoot, "Jeff") triggerServerEvent("removealapAK", resourceRoot, "Jeff") and server side like this?: function AKalap(thePlayer) local x, y, z = getElementPosition(thePlayer) local alapak = createObject(1254, x, y, z) setAttachedWeaponForPlayer ("Jeff", alapak) exports['bone_attach']:attachElementToBone(alapak, thePlayer, 12, 0, 0, 0, 0, -90, 0) end addEvent("alapAK", true) addEventHandler("alapAK", resourceRoot, AKalap) function removeAKalap(thePlayer) local alapak = getAttachedWeaponForPlayer ("Jeff") if alapak then outputDebugString(thePlayer) iprint(thePlayer) if isElement(alapak) then exports['bone_attach']:detachElementFromBone(alapak) moveObject(alapak, 1 ,0 ,0 ,0) else destroyAttachedWeaponForPlayer ("Jeff") end end end addEvent("removealapAK", true) addEventHandler("removealapAK", getRootElement(), removeAKalap) Or I'm totally lost? Sorry... it's too much for me but I really want to make works this. -
createWeapon server side with bone_attach?
thund3rbird23 replied to thund3rbird23's topic in Scripting
am I need to specify the player for event alapAK too or use localPlayer?: triggerServerEvent("alapAK", resourceRoot, thePlayer) if I do specify the player I get errors in debug. -
createWeapon server side with bone_attach?
thund3rbird23 replied to thund3rbird23's topic in Scripting
And what do you have to do when there is no error and still figure out what is going on? got nil for local alapak = getAttachedWeaponForPlayer (thePlayer) -- here outputDebugString(alapak) -
createWeapon server side with bone_attach?
thund3rbird23 replied to thund3rbird23's topic in Scripting
Do you mean that?: triggerServerEvent("removealapAK", resourceRoot, thePlayer) Anyways don't works or I doing something wrong... it's get attached but can't detach and no error in debugscript. -
createWeapon server side with bone_attach?
thund3rbird23 replied to thund3rbird23's topic in Scripting
Huh, I never used tables so this is like the Chinese language for me, lol. Can't you substitute my code with those functions please? I just need that last deatach thing -
createWeapon server side with bone_attach?
thund3rbird23 replied to thund3rbird23's topic in Scripting
what do you mean? I wrote before your comment that's isn't good? Because that's attach the object but a bit buggy (?) when got attached to 2 player's hand in the same time and one of them detach then the other can't detach. -
createWeapon server side with bone_attach?
thund3rbird23 replied to thund3rbird23's topic in Scripting
Ok, I did it, but now if I attach weapon and my friend too in the same time and I detach the weapon then my friend can't detach... it's just keep displaying in his hand why? function AKalap(thePlayer) x, y, z = getElementPosition(thePlayer) alapak = createObject(1254, x, y, z) exports['bone_attach']:attachElementToBone(alapak, thePlayer, 12, 0, 0, 0, 0, -90, 0) end addEvent("alapAK", true) addEventHandler("alapAK", resourceRoot, AKalap) function removeAKalap() exports.bone_attach:detachElementFromBone(alapak) moveObject(alapak, 1 ,0 ,0 ,0) end addEvent("removealapAK", true) addEventHandler("removealapAK", getRootElement(), removeAKalap) -
How can I make visible the created weapon to all players? I'm trying to figure out but doesn't works, I got errors in debugscript. --- client side --- local x, y, z = getElementPosition(localPlayer) local default = createWeapon("ak-47", x, y, z) local new = createObject(2965, x, y, z) triggerServerEvent("newWeapon", resourceRoot, default, new) --- server side --- function weap(thePlayer, default, new) attachElements(default, new) exports['bone_attach']:attachElementToBone(new[thePlayer], localPlayer, 12, 0, 0, 0, 0, -90, 0) end addEvent("newWeapon", true) addEventHandler("newWeapon", resourceRoot, weap) Debugscript errors: clientside element 'object' at argument 4 @ 'triggerServerEvent' clientside element 'weapon' at argument 3 @ 'triggerServerEvent'
-
Thanks! But I still don't know how to display that in client side.
-
Thanks, I did with your suggestion: -- Client-side local guiText = guiGetText(pin) triggerServerEvent("check", resourceRoot, guiText) -- pass data -- Server-side function checkEvent(text) outputChatBox(text) end addEvent("check", true) addEventHandler("check", resourceRoot, checkEvent) But what about if I have something in server side and I want to display it in client side? Example (I want to display the "res" in client side): function LoadMessages() local query = dbQuery(connection, "SELECT * FROM messages WHERE characterID = 1") local result = dbPoll(query,-1) for x, ad in ipairs( result ) do local res = result[x]['message'] end end addEvent("LoadMsg", true) addEventHandler("LoadMsg", resourceRoot, LoadMessages)
-
I have an input label in client side called "fakeInputs.Message" and I want to process this label's value in server side and insert this value to the database it's possible? Here is how works the input label: function processFakeInput(key, forcedInput) local theInput, inputType, maxChar = getActiveFakeInput(type(forcedInput) == "string" and forcedInput or false) if theInput then if not fakeInputs[theInput] then fakeInputs[theInput] = "" end if key == "enter" then elseif key == "backspace" then fakeInputs[theInput] = utf8.sub(fakeInputs[theInput], 1, -2) else if maxChar > utf8.len(fakeInputs[theInput]) then if inputType == "num-only" then if tonumber(key) then fakeInputs[theInput] = fakeInputs[theInput] .. key end else fakeInputs[theInput] = fakeInputs[theInput] .. key end end end end end So in server side I need something like this ( ofc, that doesn't work because I don't know how to get the value from client side): dbExec(connection, "INSERT INTO messages VALUES (?)", fakeInputs.Message)
-
I'm trying to call a function: exports["s_phone"]:showPhoneFunction(itemValue) But I get this error, why? what's wrong? function showPhoneFunction(itemValue) if showPhone then exports.chat:sendLocalMeAction(localPlayer, "open") showPhone = false loadedPhoneInterFace = false actualPhoneID = -1 menu = -1 currentChat = -1 musicID = -1 removeEventHandler("onClientRender", getRootElement(), PlayedSound) if isElement(sound) then stopSound(sound) end else exports.chat:sendLocalMeAction(localPlayer, "close") showPhone = true inCallMember = nil actualPhoneID = itemValue triggerServerEvent("getPhoneDataFromServer", localPlayer, localPlayer, actualPhoneID) triggerServerEvent("getPhoneContactFromServer", localPlayer, localPlayer, actualPhoneID) menu = 1 numberText = {} callMessages = {} phoneContacts = {} currentCallMSG = -3 end end I'm added to meta.xml the following line: <export function="showPhoneFunction" type="client" />
-
How to determine if something attached to player's hand?
thund3rbird23 replied to thund3rbird23's topic in Scripting
Uff, I just forgot to close the function with 'end'. It's works now. -
How to determine if something attached to player's hand?
thund3rbird23 replied to thund3rbird23's topic in Scripting
I'm trying to figure out how to use this function, but doesn't works. Attached "doboz" to the player's hand: doboz[thePlayer] = createObject(2912,0,0,0) exports.bone_attach:attachElementToBone(doboz[thePlayer], thePlayer, 12,0,0,0.70,0,165,0) And after that I wants to get if the "doboz" attached to the bone or no: function xy(thePlayer) if (exports.bone_attach:isElementAttachedToBone(doboz[thePlayer]))then outputChatBox("Yes!") else outputChatBox("No!") end addCommandHandler("xy", xy) -
How to determine if something attached to player's hand?
thund3rbird23 replied to thund3rbird23's topic in Scripting
Yes, I realized after posted. -
I did this in guieditor: dxDrawLine(512 - 1, 645 - 1, 512 - 1, 674, tocolor(37, 199, 0, 255), 1, false) dxDrawLine(859, 645 - 1, 512 - 1, 645 - 1, tocolor(37, 199, 0, 255), 1, false) dxDrawLine(512 - 1, 674, 859, 674, tocolor(37, 199, 0, 255), 1, false) dxDrawLine(859, 674, 859, 645 - 1, tocolor(37, 199, 0, 255), 1, false) dxDrawRectangle(512, 645, 347, 29, tocolor(0, 0, 0, 197), false) How can I make this to relative if I'm using: local screenW, screenH = guiGetScreenSize()
-
I want to store random generated number when I click to the vehicle. I attached a crate to the player's hand when a progress bar reaches 100% and if I click to the vehicle it's destroying. What I'm needed: Random generate a number which is storing when I click to the vehicle and retrieve that number when I click to the vehicle again or make a gui when I click to the vehicle and displays "store" and below "retrieve" so if I click to the store button then stores the number if I click to the retrieve button then retrieve that number or something like that.
-
How to determine if something attached to player's hand?
thund3rbird23 replied to thund3rbird23's topic in Scripting
I'm using this: https://community.multitheftauto.com/index.php?p=resources&s=details&id=2540 -
I attached a crate to the player's hand, is there any way to determine if the crate is attached or not? crate = createObject(2912,0,0,0) exports.bone_attach:attachElementToBone(crate,localPlayer,12,0,0,0.70,0,165,0)
