-
Posts
1,312 -
Joined
-
Last visited
Everything posted by KariiiM
-
Yes this function just detach the element, So do you want me to make the box destroyed?
-
local tank = {} function PutBoxOnHand() local x, y, z = getElementPosition ( source ) --Get the players position tank[source] = createObject ( 1220, x, y, z + 5 ) --Create a tank attachElements ( tank[source], source, 0, 0, -1 ) --Attach the tank to the player. end addEvent("PutBoxOnHand", true) addEventHandler("PutBoxOnHand", getRootElement(),PutBoxOnHand) function removeBoxFromHands () if (isElementAttached(tank[source])) then detachElements(tank[source]) end end addEvent("removeBoxHands", true) addEventHandler("removeBoxHands", getRootElement(),removeBoxFromHands)
-
Okay, here you go Test it and tell me the results to let me know local tank = {} function PutBoxOnHand(tank, x, y, z) local x, y, z = getElementPosition ( source ) --Get the players position tank[source] = createObject ( 1220, x, y, z + 5 ) --Create a tank attachElements ( tank[source], source, 0, 0, -1 ) --Attach the tank to the player. end addEvent("PutBoxOnHand", true) addEventHandler("PutBoxOnHand", getRootElement(),PutBoxOnHand) function removeBoxFromHands (thePlayer) if (isElementAttached(tank[source])) then detachElements(tank[source]) end end addEvent("removeBoxHands", true) addEventHandler("removeBoxHands", getRootElement(),removeBoxFromHands)
-
Hey, which element do you want to detach? "tank" ? from player's hands?
-
Yes you've to change it to setElementFrozen because they're about to remove this function I think, but that won't fix it. Try to debug your code by any action and see what's going on then post the whole code.
-
If I understand what you means, you've to use the usefull function, findRotation
-
You need a server to connect with mysql, if you don't have , change it to sqlite,
-
you can help me with this command? i dont understand how to use it.. Sure, post the full code
-
Yeah, so here's the problem, I suggest you to keep it server side better
-
It should works in client side too, just delete the file that was already created and test it again.
-
Here you go, local ped = createPed ( 120, -353.5361328125, -426.357421875, 6.944408416748 ) local tree = createObject ( 618, -353.5361328125, -426.357421875, 6.944408416748, 0, 0, 0 ) setPedFrozen ( ped ,true) attachElements ( ped, tree, 0, 0, 0 ) function onDamageTree(attacker,weapon) if attacker and isElement(attacker) and getElementType(attacker) == "player" then if weapon and weapon == 9 then if (getElementHealth(ped) <= 0) then --[[Your code.]] end end end end addEventHandler("onPlayerDamage",getRootElement(),onDamageTree)
-
What do you mean ? the speed of Hydra or you want it send rockets
-
Anytime, Also I suggest you to use /debugscript 3, this will output your code errors in each actions that your script did and it will help you alot in developing your scripting skills. Good luck, I wish you the best
-
I care alot about these small stuffs and you're welcome.
-
Try that function clickedregister() local username = guiGetText(registere[1]) outputChatBox(tostring(username)) local usercheck = fileOpen(username) if usercheck then fileClose(usercheck) outputChatBox("This account is already registered!") else outputChatBox("Ready to reigster!") end end addEventHandler("onClientGUIClick",registerb[1],clickedregister)
-
It's not really hard to make, all what you need is to create a ped and wood object then attach the ped into the wood by using attachElements, and check if the ped got damaged by "Chainsaw" weapon or not. After, If the ped is dead make the wood object move under the ground, use this function to make that moveObject. So now you've the basic to make it, try that if you did something wrong post your code. Note: I suggest you to create the object server side, If you did it in client only the localPlayer who will be able to see it.
-
function enterSafeZone(element, matchingDimension) local level = getPlayerWantedLevel () if ( level > 0 ) then toggleControl("sprint", false) end if (element ~= localPlayer or not matchingDimension) then return end if (getElementDimension(element) ~= 0) then return end if (isPlayerInTeam(localPlayer, "Staff")) then return end if (isTimer(leaveTimer)) then killTimer(leaveTimer) end if getElementHealth(localPlayer) <= 30 then setElementHealth(localPlayer, 0) exports.CORtexts:output("you have been killed for camping!", 255, 0, 0) end if (isPlayerInTeam(localPlayer, "Police Force") or isPlayerInTeam(localPlayer, "Police") or isPlayerInTeam(localPlayer, "Government") or isPlayerInTeam(localPlayer, "SWAT")) then exports.CORtexts:output("You have entered a no-camping zone.", 0, 255, 0) setPedWeaponSlot(localPlayer, 0) exports.CIFhelp:modTextBar("campHandler", "Protected, no camp area", 0, 255, 0) else setPedWeaponSlot(localPlayer, 0) exports.CIFhelp:modTextBar("campHandler", "Protected, no camp area", 0, 255, 0) end end
-
It should be like that, local level = getPlayerWantedLevel () if ( level > 0 ) then toggleControl("sprint", false) end
-
Post the whole code because that's impossbile, or just a part when you used this function.
-
Yes you're right I was kinda fast in the answer Edit: Try that function forceReload(player) outputChatBox ('aaa', root, 255, 255, 255, true) bindKey(player,"1","down") end function makeBind() for index, v in ipairs(getElementsByType("player")) do forceReload(v) end end
-
You both repeated the same errors, and btw your code is totally messy you forgot about 5 ends, Plus there're some arguments typed and not defined. Try that, It should works function giveSomeoneMoney(player, _, target, amount) if target then if amount then local money = getPlayerMoney(player) local targetplayer = getPlayerFromParticalName(target) local r, g, b = getPlayerNametagColor(targetplayer) local pr, pg, pb = getPlayerNametagColor(player) local hex = string.format("#%.2X%.2X%.2X", r, g, b) local fromHex = string.format("#%.2X%.2X%.2X", pr, pg, pb) local amount = tonumber(amount) if targetplayer then if money >= amount and amount >= 250 then givePlayerMoney(targetplayer, amount) takePlayerMoney(player, amount) outputChatBox("You Were Given from " ..fromHex .. getPlayerName(player).. " #00FF00$"..tostring(amount).."" , targetplayer, 0, 100, 0, true) outputChatBox("You Gave to "..hex..getPlayerName(targetplayer).." #00FF00$"..tostring(amount).."", player, 0, 100, 0, true) end end end end end addCommandHandler("give", giveSomeoneMoney) function getPlayerFromParticalName (name) -- BY TAPL local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end
-
Last Edit: I've edited your code as well, it must works correctly, try that local windowTitle = "CST Rules, Documentation and Answers" addEventHandler("onClientResourceStart", resourceRoot, function() local sx, sy = guiGetScreenSize() rule = guiCreateWindow((sx/2)-400, (sy/2)-300, 800, 600, tostring(windowTitle), false) guiWindowSetSizable(rule, false) guiSetAlpha (rule, 1) grid = guiCreateGridList(9, 64, 781, 164, false, rule) guiGridListSetSelectionMode(grid, 1) guiGridListSetSortingEnabled(grid, false) guiGridListAddColumn(grid, "Question", 0.9) for index, val in pairs(griditem) do local row = guiGridListAddRow(grid) guiGridListSetItemText(grid, row,1, val[1], false, false) end guiSetVisible( rule, false ) memo = guiCreateMemo(3, 238, 700, 350, "Select a Question above to learn about the game.", false, rule) guiMemoSetReadOnly(memo, true) ask = guiCreateButton(713, 238, 78, 89, "Ask a question that isn't answered here", false, rule) closebtn = guiCreateButton(713, 532, 78, 55, "Close", false, rule) search = guiCreateEdit(10, 24, 780, 35, "", false, rule) --combo = guiCreateComboBox(597, 100, 171, 29, "", false, rule) --for i, k in pairs ( rulesToFile ) do --guiComboBoxAddItem ( combo, i ) --end guiMemoSetReadOnly (memo, true) addEventHandler("onClientGUIClick", grid, clickedGridlist, false) addEventHandler("onClientGUIClick", closebtn, function () guiSetVisible(rule, false) showCursor(false) end, false) addEventHandler("onClientGUIClick", ask, showSupports, false) end) function searchFor() guiGridListClear(grid) local text = guiGetText(search) if (text ~= "" ) then for i, v in pairs(griditem) do local row = guiGridListAddRow(grid) if (string.find(string.upper(v), string.upper(text), 1, true)) then guiGridListSetItemText(grid, row, 1, tostring(v), false, false) end end end end addEventHandler("onClientGUIChanged", search,searchFor,false) Goodluck ~