Jump to content

Et-win

Members
  • Posts

    1,390
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Et-win

  1. addEvent("onPlayerArrested") addEvent("onPlayerReleased") local jailLocations = {} local arrestedCrims = {} local cell = { ["jail 1"] = {3094.1767578125,-808.15942382813,1.2345782518387,6}, } --local cell = {-577.34661865234,2584.078125,53.515625,6},{1102.9329833984,-2927.1062011719,3.9781250953674,6} local zoneTables = { ["los santos"] = {1543.2390136719,-1676.0291748047,13.556066513062,0}, ["san fierro"] = {-1601.7484130859,722.07757568359,11.283002853394,0}, ["las venturas"] = {2289.6687011719,2423.37890625,10.8203125,0}, ["flint county"] = {-550.44763183594,-1006.8661499023,24.081153869629,0}, ["whetstone"] = {-2163.6845703125,-2387.5734863281,30.625,0}, ["red county"] = {633.32086181641,-571.38275146484,16.3359375,0}, ["tierra robada"] = {-1417.8824462891,2631.4116210938,55.8359375,0}, ["bone county"] = {-206.83717346191,981.92529296875,19.221559524536,0}, ["unknown"] = {-206.83717346191,981.92529296875,19.221559524536,0} } local prisonCells = { {-549.94152832031, 2595.9230957031, 53.515625}, {1102.9329833984, -2927.1062011719, 3.9781250953674} } function arrestCrim(crim,cop,message,message2,spawned) if crim and getPlayerTeam(crim) then if not arrestedCrims[crim] then if not spawned then if getElementData(crim,"jailed") then return end end setElementData(crim, "jailed", true) arrestedCrims[crim] = true local crimWanted = getWantedLevel(crim) local jailTime = crimWanted * 15 if getElementData(crim, "surrender.lesstime") then jailTime = jailTime * 0.50 toggleAllControls(crim, true) setElementData(crim,"surrender.lesstime",false) end if cop then local money = 2000 + (crimWanted * 400) --exports.ORCcommands:giveMoney(cop,money) givePlayerMoney ( cop, money ) end setInsideJail(crim,jailTime,crimWanted,adminjail) setInJail(crim,true) removePedFromVehicle(crim) takeAllWeapons(crim) triggerEvent("onPlayerArrested",root,crim,cop) if message then exports.ORCcommands:sendMessage(message, 255,255,255, false, false, true) end if message2 then exports.ORCcommands:sendMessage(message2,255,255,255,crim) end end end end addEvent("arrestCrim",true) addEventHandler("arrestCrim",root,arrestCrim) function setInsideJail(crim,jailTime,wanted,adminjail) fadeCamera(crim,false) tempweapons = {} w = getWantedLevel(crim) local username = getElementData(crim,"username") triggerClientEvent(crim,"startJailCounter",crim,jailTime) setTimer(warpPlayerToCell, 1000, 1, crim,cell,true,wanted,adminjail) end function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end function warpPlayerToCell(crim,place,tojail,wanted,adminjail) if crim and isElement(crim) then arrestedCrims[crim] = nil local newDim if tojail then -- if he is sent to jail local x,y,z = getElementPosition(crim) local zone = getZoneName(x,y,z,true) local zTable = zoneTables[zone:lower()] jailLocations[crim] = zTable newDim = 0 setElementHealth(crim, 100) -- -- -- -- -- -- -- -- -- -- -- -- -- -- - local randCell = math.random(#prisonCells); local X,Y,Z = prisonCells[randCell][1], prisonCells[randCell][2], prisonCells[randCell][3] setElementPosition(crim, X, Y, Z) toggleControl(crim, "jump", false) else -- released from jail newDim = 0 setElementInterior(crim, 0, place[1], place[2], place[3]) jailLocations[crim] = nil if theBlip and isElement(theBlip) then setElementVisibleTo(theBlip,root,true) end toggleControl(crim, "jump", true) end setElementDimension(crim, newDim) end end function playerGetReleased() -- source is crim if getElementType(source) == "player" then local injail = getInJail(source) if injail == true then toggleControl(crim, "jump", true) local spawn = jailLocations[source] or zoneTables["los santos"] setTimer(warpPlayerToCell,1000,1,source,spawn,false) triggerEvent("onPlayerReleased",getRootElement(),source) triggerClientEvent("onClientPlayerReleased",source) exports.ORCcommands:sendMessage(getPlayerName(source).." has been released from jail.",255,255,255, false, false, true) setWantedLevel(source,0) setElementData(source, "jailed", false) setInJail(source,false) -- -- -- -- -- -- -- -- -- -- -- -- -- setElementPosition(source, jailLocations[source][1], jailLocations[source][2], jailLocations[source][3]) jailLocations[source] = nil end end end addEvent("onPlayerGetReleased", true) addEventHandler("onPlayerGetReleased", root, playerGetReleased) -- JAILBREAKS OMG local vert1 = {-541.90118408203,2608.1440429688,53.515625} local vert2 = {-541.90118408203,2608.1440429688,53.515625} local w = vert2[1] - vert1[1] local h = vert2[2] - vert1[2] local d = vert2[3] - vert1[3] prisonCol = createColCuboid(vert1[1], vert1[2], vert1[3], w, h, d) setElementDimension(prisonCol, 0) setElementInterior(prisonCol, 0) function playerEnterJail(element,dimension) if element and dimension and getElementType(element) == "player" then local team = getPlayerTeam(element) if team and not (copTeams[getTeamName(team)] or getInJail(element)) then -- the player who entered jail area isn't a cop exports.ORCcommands:sendMessage("*JAIL* You are have entered the jail.",255,255,255,element) if (texthasdisplayed == nil) then texthasdisplayed = true exports.RPGpolice:alertPolice("*JAIL* There is a criminal breach in the prison, all units respond!") setTimer(rePrintText, 15000, 1) end modifyWantedLevel(element, 10) elseif copTeams[getTeamName(team)] and getTeamName(team) == "Police" then if isPedInVehicle(element) then blowVehicle(getPedOccupiedVehicle(element)) end if not isPedDead(element) then killPed(element) end exports.ORCcommands:sendMessage("*JAIL* You are not allowed to enter the jail as a cop. Leave its defense to the army.",255,255,255,element) end end end function playerLeaveJail(element,dimension) if element and dimension and getElementType(element) == "player" then if getElementData(element,"jailed") and not isPedDead(element) then modifyWantedLevel(element, 10) jailLocations[element] = nil for k,v in ipairs({"fire","enter_exit","action","crouch","next_weapon","previous_weapon"}) do toggleControl(element,v,true) end triggerEvent("onPlayerReleased",root,element) triggerClientEvent( element, "onClientPlayerReleased", element) setInJail(element,false) setElementData(element, "jailed", false) exports.ORCcommands:sendMessage("You have broken out from prison!",255,255,255, element, false) exports.RPGpolice:alertPolice( getPlayerName(element).." has broken out from prison!" ) toggleControl(element, "jump", true) end end end addEventHandler ( "onPlayerWasted", root, function() if getElementData(source,"jailed") then setElementData(source,"jailed",false) end end ) addEventHandler("onColShapeHit",prisonCol,playerEnterJail) addEventHandler("onColShapeLeave",prisonCol,playerLeaveJail) function rePrintText() texthasdisplayed = nil end function fadePlayerIn(crim) if crim then if isElement(crim) then fadeCamera(crim,true) end end end function resetCrimOnQuit() jailLocations[source] = nil end addEventHandler("onPlayerQuit", root, resetCrimOnQuit) You forgot argument 3 'pZ' (Position Z): prisonCol = createColCuboid(vert1[1], vert1[2], vert1[3], w, h, d) At line 139.
  2. Et-win

    Adminnick

    He want to output in the chatbox whenever some admin gives another player admin, supermoderator or whatever.
  3. Tested already? getWantedLevel changed to getPlayerWantedLevel?
  4. What is the problem now?
  5. Et-win

    [Question]

    Checked the server log files? Anyway I just used the code one of the people posted here. If there is nothing in the server log files, then change onPlayerPrivateMessage to onPlayerChat , then it should work.
  6. Et-win

    [Question]

    No, that script I posted have to be serverside, because onPlayerPrivateMessage is serverside only. e.e So that would be why it's not working.
  7. Et-win

    [Question]

    It will be putted into the server log, not in the chatbox or debug and not sure about console.
  8. Et-win

    [Question]

    function PM(theMessage, thePlayer) outputServerLog("From: "..getPlayerName(source).." to: "..getPlayerName(thePlayer)..": "..theMessage) end addEventHandler("onPlayerPrivateMessage", getRootElement(), PM) Next script not helping. Go read and learn the link he posted above my post.
  9. You're welcome. And that's alright, we are here to help.
  10. I know, as you can see I putted '--' before the code. (This means the whole line is not read-able by the script) If the outputten of selected item works, add what you want in the code. ( if (gtype == "Colour") then --Code for colour outputChatBox("Give colour", source) elseif (gtype == "Nitro") then --Code for nitro outputChatBox("Give nitro", source) elseif (gtype == "Repair") then --Code for repair outputChatBox("Give repair", source) end )
  11. Yes I do, but I'm not going to give it. I'm only here available to help if I want/know it.
  12. Ah yes, you are right. Didn't see that I got redirected from getWantedLevel to getPlayerWantedLevel.
  13. local marker = createMarker( 1220.8000488281, -1427.3000488281, 12.39999961853, "cylinder", 1.5, 0, 0, 0, 0) ----local ped = createPed(305,1220.8000488281, -1427.5999755859, 13.39999961853) createBlip (2000.763671875, 1539.0169677734, 13.5859375, 23 ,2 ) myFont = dxCreateFont( "BEBAS.ttf", 20 ) -- Create custom font GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_gridlist = {} windowjob = guiCreateWindow(392, 176, 408, 437, "Parts", false) guiWindowSetSizable(windowjob, false) guiSetVisible(windowjob, false) GUIEditor_Memo[1] = guiCreateMemo(25, 27, 367, 108, "This is the Vehicle Upgrades store, you can buy these objects to apply to your vehicle of any sort", false, windowjob) guiMemoSetReadOnly(GUIEditor_Memo[1], true) GUIEditor_gridlist[1] = guiCreateGridList(21, 258, 366, 111, false, windowjob) guiGridListAddColumn(GUIEditor_gridlist[1], "Upgrades", 0.5) guiGridListAddColumn(GUIEditor_gridlist[1], "Price", 0.5) for i = 1, 3 do guiGridListAddRow(GUIEditor_gridlist[1]) end guiGridListSetItemText(GUIEditor_gridlist[1], 0, 1, "Colour", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 0, 2, "$100", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 1, 1, "Nitro", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 1, 2, "$1000", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 2, 1, "Repair", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 2, 2, "$250", false, false) GUIEditor_Button[2] = guiCreateButton(206, 379, 174, 48, "Cancel", false, windowjob) GUIEditor_Button[1] = guiCreateButton(21, 379, 175, 48, "Buy!", false, windowjob) function GuiOpen(hitElement) setElementData ( localPlayer, "ownskin", getElementModel (localPlayer) ) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, GuiOpen) function GuiClose(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, GuiClose) function removeUpWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeUpWindow, false) function removeUpWindow() guiSetVisible(windowjob, false) showCursor(false) outputChatBox("ok, here is ok too") local gSelectedRow, gSelectedColumn = guiGridListGetSelectedItem(GUIEditor_gridlist[1]) triggerServerEvent ( "giveboomnitro", getLocalPlayer(), --[[what to give:]]guiGridListGetItemText(GUIEditor_gridlist[1], gSelectedRow, 1) ,--[[price:]]string.gsub(guiGridListGetItemText(GUIEditor_gridlist[1], gSelectedRow, 2), "%D", "")) outputChatBox("same here too") end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeUpWindow, false) local maxDistance = 12 -- the distance showing 3dtext local ped = createPed (305,1220.8000488281, -1427.5999755859, 13.39999961853) addEventHandler ( "onClientRender", root, function ( ) local pX, pY, pZ = getElementPosition ( localPlayer ) local pedX, pedY, pedZ = getElementPosition ( ped ) local distance = getDistanceBetweenPoints3D ( pX, pY, pZ, pedX, pedY, pedZ ) if ( distance <= 15 ) then local x, y = getScreenFromWorldPosition ( pedX, pedY, pedZ ) if ( x and y ) then dxDrawText( "Upgrades", x, y+1.5, _, _, tocolor( 255, 255, 0, 255 ), 1, myFont, "center", "center" ) end end end ) Oops, sorry :3
  14. Check with: outputChatBox(tostring(crim)) at the start of the function or crim is actually the player (usedata) or nil. If it is nil, then it wasn't correctly send.
  15. Serverside: function trololo() setElementData(source,"Nitro",0) setElementData(source,"Fix",0) setElementData(source,"Colour",0) end addEventHandler("onResourceStart",resourceRoot, function() -- its here that the whole error is found, you had missed 3 ends LOL local players = getElementsByType ( "player" ) for i,p in ipairs(players) do setElementData(p,"NitroT",false) setElementData(p,"FixT",false) setElementData(p,"ColourT",false) local sourceAccount = getPlayerAccount ( p ) if isGuestAccount ( sourceAccount ) then setElementData(p,"Nitro",0) setElementData(p,"Fix",0) setElementData(p,"Colour",0) else if (getAccountData(sourceAccount, "Nitro")) then setElementData(p,"Nitro",getAccountData(sourceAccount, "Nitro")) end if (getAccountData(sourceAccount, "Fix")) then setElementData(p,"Fix",getAccountData(sourceAccount, "Fix")) end if (getAccountData(sourceAccount, "Colour")) then setElementData(p,"Colour",getAccountData(sourceAccount, "Colour")) end if not (getAccountData(sourceAccount, "Nitro")) and not (getAccountData(sourceAccount, "Fix")) and not (getAccountData(sourceAccount, "Colour")) then setElementData(p,"Nitro",0) setElementData(p,"Fix",0) setElementData(p,"Colour",0) end end -- first end end -- second end end-- third end ) addEventHandler("onPlayerLogout",getRootElement(), function (acc) setAccountData(acc,"Nitro",getElementData(source,"Nitro")) setAccountData(acc,"Fix",getElementData(source,"Fix")) setAccountData(acc,"Colour",getElementData(source,"Colour")) setElementData(source,"Nitro",0) setElementData(source,"Fix",0) setElementData(source,"Colour",0) end ) -- this part is good addEventHandler("onPlayerLogin", root, function ( _, theCurrentAccount) if (getAccountData(theCurrentAccount, "Nitro")) then setElementData(source,"Nitro",getAccountData(theCurrentAccount, "Nitro")) end if (getAccountData(theCurrentAccount, "Fix")) then setElementData(source,"Fix",getAccountData(theCurrentAccount, "Fix")) end if (getAccountData(theCurrentAccount, "Colour")) then setElementData(source,"Colour",getAccountData(theCurrentAccount, "Colour")) end end ) -- this part also is good addEvent("giveboomnitro",true) addEventHandler("giveboomnitro",getRootElement(), function (gtype, price) -- lets say number for example outputChatBox(" trololooooo giveNitro was triggered",client) if (tonumber(price) ~= nil) then if (tonumber(price) > 0) then if ( getPlayerMoney (client) >= tonumber(price) ) then if (gtype == "Colour") then --Code for colour outputChatBox("Give colour", source) elseif (gtype == "Nitro") then --Code for nitro outputChatBox("Give nitro", source) elseif (gtype == "Repair") then --Code for repair outputChatBox("Give repair", source) end --takePlayerMoney(client, tonumber(price)) --local acc = getPlayerAccount ( client ) --setElementData(client,"Nitro",getElementData(client,"Nitro")+number) -- setAccountData(acc,"Nitro",getElementData(client,"Nitro")) else outputChatBox("You do not have enough money to buy Nitro",client,255,0,0,false) end end end end ) -- this part also is good Clientside: local marker = createMarker( 1220.8000488281, -1427.3000488281, 12.39999961853, "cylinder", 1.5, 0, 0, 0, 0) ----local ped = createPed(305,1220.8000488281, -1427.5999755859, 13.39999961853) createBlip (2000.763671875, 1539.0169677734, 13.5859375, 23 ,2 ) myFont = dxCreateFont( "BEBAS.ttf", 20 ) -- Create custom font GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_gridlist = {} windowjob = guiCreateWindow(392, 176, 408, 437, "Parts", false) guiWindowSetSizable(windowjob, false) guiSetVisible(windowjob, false) GUIEditor_Memo[1] = guiCreateMemo(25, 27, 367, 108, "This is the Vehicle Upgrades store, you can buy these objects to apply to your vehicle of any sort", false, windowjob) guiMemoSetReadOnly(GUIEditor_Memo[1], true) GUIEditor_gridlist[1] = guiCreateGridList(21, 258, 366, 111, false, windowjob) guiGridListAddColumn(GUIEditor_gridlist[1], "Upgrades", 0.5) guiGridListAddColumn(GUIEditor_gridlist[1], "Price", 0.5) for i = 1, 3 do guiGridListAddRow(GUIEditor_gridlist[1]) end guiGridListSetItemText(GUIEditor_gridlist[1], 0, 1, "Colour", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 0, 2, "$100", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 1, 1, "Nitro", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 1, 2, "$1000", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 2, 1, "Repair", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 2, 2, "$250", false, false) GUIEditor_Button[2] = guiCreateButton(206, 379, 174, 48, "Cancel", false, windowjob) GUIEditor_Button[1] = guiCreateButton(21, 379, 175, 48, "Buy!", false, windowjob) function GuiOpen(hitElement) setElementData ( localPlayer, "ownskin", getElementModel (localPlayer) ) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, GuiOpen) function GuiClose(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, GuiClose) function removeUpWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeUpWindow, false) function removeUpWindow() guiSetVisible(windowjob, false) showCursor(false) outputChatBox("ok, here is ok too") local gSelectedRow, gSelectedColumn = guiGetSelectedItem(GUIEditor_gridlist[1]) triggerServerEvent ( "giveboomnitro", getLocalPlayer(), --[[what to give:]]guiGridListGetItemText(GUIEditor_gridlist[1], gSelectedRow, 1) ,--[[price:]]string.gsub(guiGridListGetItemText(GUIEditor_gridlist[1], gSelectedRow, 2), "%D", "")) outputChatBox("same here too") end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeUpWindow, false) local maxDistance = 12 -- the distance showing 3dtext local ped = createPed (305,1220.8000488281, -1427.5999755859, 13.39999961853) addEventHandler ( "onClientRender", root, function ( ) local pX, pY, pZ = getElementPosition ( localPlayer ) local pedX, pedY, pedZ = getElementPosition ( ped ) local distance = getDistanceBetweenPoints3D ( pX, pY, pZ, pedX, pedY, pedZ ) if ( distance <= 15 ) then local x, y = getScreenFromWorldPosition ( pedX, pedY, pedZ ) if ( x and y ) then dxDrawText( "Upgrades", x, y+1.5, _, _, tocolor( 255, 255, 0, 255 ), 1, myFont, "center", "center" ) end end end ) I edited the script a bit. It gets what is selected in the gridlist and it sends it to the server. (With the price) (Not tested) I added outputChatBox for you to check or it outputs the correct selected item.
  16. I would make the guiCreateEdit invisible so it's there but you can't see it. Then with DX use guiGetText.
  17. Alright, and what is 'number' for? ( function (number) --is connect to guiGetText( GUIEditor_gridlist[1], 1, 1) --Which I already don't understand, since guiGetText only needs one element to get the text )
  18. May I ask why you want to use get/setElementData and not a variable?
  19. At the moment, I don't understand/know what you want to do with 'number'.
  20. If 'number' is not a number but nill, then that won't happen, because he skips that part of the code by then. EDIT: triggerServerEvent ( "giveboomnitro", getLocalPlayer(), guiGetText( GUIEditor_gridlist[1], 1, 1)) Are you sure the guiGetText is correct? Because I think he is getting the GridList now?
  21. Add: if (tonumber(number) ~= nil) then
  22. Et-win

    [Question]

    function randomname(theMessage --[[Message]], thePlayer --[[The player where the message is send to]]) --You can do the rest. (source = the player who send the message end addEventHandler("onPlayerPrivateMessage", getRootElement(), randomname) Good luck, you should try to make it by yourself.
  23. Et-win

    [Question]

    outputServerLog You can use too.
  24. Et-win

    Hud problem

    I would only use a variable and check or it's 'true'.
×
×
  • Create New...