-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
Yes you can, login as admin then type /createhouse thehouseInterior thehouseDimension thehousePrice
-
[Help] How can i make my car mod Server Sided?
Castillo replied to NotAvailable's topic in Scripting
Impossible. -
hi, im genting problems making a second car slot in my car system, i cant find what is the error in the code, maybe someone can give me a hand , here is my code: server-side carShopMarker = createMarker (-1953.68, 304.57, 34.46875, "cylinder", 3, 255, 0, 0, 127) addEvent ("viewGUI", true) function markerHit (hitPlayer, matchingDimension) if (source == carShopMarker) then triggerClientEvent ("viewGUI", hitPlayer) outputChatBox ("Welcome to the vehicleshop!", hitPlayer, 255, 0, 0) end end addEventHandler ("onMarkerHit", getRootElement(), markerHit) addEvent ("carShopCarBuy", true) addEventHandler ("carShopCarBuy", getRootElement(), function(id, cost, name) if (getPlayerMoney (source) >= tonumber(cost)) then outputChatBox ("Bought a " .. name, source, 255, 0, 0, false) outputChatBox ("ID: " .. id, source, 255, 0, 0, false) outputChatBox ("Cost: " .. cost, source, 255, 0, 0, false) takePlayerMoney (source, tonumber (cost)) setAccountData (getPlayerAccount (source), "funmodev2-car", tonumber(id)) setAccountData (getPlayerAccount (source), "funmodev2-paintjob", 3) setAccountData (getPlayerAccount (source), "funmodev2-carupg", 0) else outputChatBox ("You are too poor!", source, 255, 0, 0, false) end end) addEvent ("carShopCarBuy2", true) addEventHandler ("carShopCarBuy2", getRootElement(), function(id2, cost2, name2,slot2) if (getPlayerMoney (source) >= tonumber(cost2)) then outputChatBox ("Bought a " .. name2, source, 255, 0, 0, false) outputChatBox ("ID: " .. id2, source, 255, 0, 0, false) outputChatBox ("Cost: " .. cost2, source, 255, 0, 0, false) takePlayerMoney (source, tonumber (cost2)) setAccountData (getPlayerAccount (source), "funmode2-car", tonumber(id2)) setAccountData (getPlayerAccount (source), "funmode2-paintjob", 3) setAccountData (getPlayerAccount (source), "funmode2-carupg", 0) else outputChatBox ("You are too poor!", source, 255, 0, 0, false) end end) client-side carshopWindow = guiCreateWindow(12,120,289,325,"City Car Shop",false) guiSetVisible (carshopWindow, false) guiSetAlpha(carshopWindow,1) guiWindowSetSizable(carshopWindow,false) selectLabel = guiCreateLabel(10,20,257,25,"Select your car",false,carshopWindow) guiSetAlpha(selectLabel,1) guiLabelSetColor(selectLabel,255,255,255) guiLabelSetVerticalAlign(selectLabel,"top") guiLabelSetHorizontalAlign(selectLabel,"left",false) guiSetFont(selectLabel,"default-bold-small") slot1 = guiCreateRadioButton(188,72,90,21," Slot 1",false,carshopWindow) slot2 = guiCreateRadioButton(188,101,90,21," Slot 2",false,carshopWindow) slotLabel = guiCreateLabel(191,34,91,20,"Select car slot",false,carshopWindow) carGridList = guiCreateGridList(9,39,171,213,false,carshopWindow) guiGridListSetSelectionMode(carGridList,0) carColumn = guiGridListAddColumn(carGridList,"Car",0.5) costColumn = guiGridListAddColumn(carGridList,"$",0.3) local cars = {{579,60000},{400,60000},{404,28000},{489,65000},{505,65000},{479,45000},{442,45000},{458,45000},{602,100000},{496,42500},{401,41000},{518,60000},{527,75000},{589,75000},{419,45000},{533,75000},{526,50000},{474,55000},{545,50000},{517,45000},{410,41000},{600,50000},{436,41000},{580,50000},{439,75000},{549,75000},{491,45000},{445,45000},{507,45000},{585,45000},{587,100000},{466,55000},{492,50000},{546,45000},{551,45000},{516,45000},{467,45000},{426,47500},{547,45000},{405,55000},{409,75000},{550,45000},{566,45000},{540,45000},{421,50000},{529,45000},{402,250000},{542,65000},{603,150000},{475,75000},{562,175000},{565,95000},{559,125000},{561,50000},{560,125000},{558,100000},{429,150000},{541,150000},{415,150000},{480,95000},{434,100000},{494,200000},{502,200000},{503,200000},{411,300000},{506,150000},{451,300000},{555,95000},{477,95000},{499,25000},{498,25000},{578,50000},{486,70000},{406,500000},{573,250000},{455,75000},{588,50000},{403,75000},{423,1000000},{414,50000},{443,75000},{515,75000},{514,75000},{531,12000},{456,45000},{422,45000},{482,95000},{530,12000},{418,45000},{572,12000},{582,50000},{413,50000},{440,50000},{543,65000},{583,12000},{478,35000},{554,50000},{536,75000},{575,75000},{534,75000},{567,75000},{535,75000},{576,75000},{412,75000},{568,75000},{457,12000},{483,45000},{508,40000},{571,10000},{500,55000},{444,250000},{556,250000},{557,250000},{495,100000},{539,75000},{485,12000},{431,60000},{438,45000},{437,60000},{574,12000},{420,45000},{525,75000},{408,50000},{428,65000}} for i,v in ipairs (cars) do local carName = getVehicleNameFromModel (v[1]) local row = guiGridListAddRow (carGridList) guiGridListSetItemText (carGridList, row, 1, carName, false, true) guiGridListSetItemText (carGridList, row, 2, tostring(v[2]), false, true) end guiSetAlpha(carGridList,1) buyButton = guiCreateButton(30,274,124,34,"BUY CAR",false,carshopWindow) guiSetAlpha(buyButton,1) closeButton = guiCreateButton(240,277,33,30,"X",false,carshopWindow) if (guiRadioButtonGetSelected(slot1)) then _carSlot=1 elseif (guiRadioButtonGetSelected(slot2)) then _carSlot=2 end addEvent ("viewGUI", true) function viewGUI () if (getLocalPlayer() == source) then guiSetVisible (carshopWindow, true) showCursor (true) end end addEventHandler ("viewGUI", getRootElement(), viewGUI) function onClientGUIClick (button, state, absoluteX, absoluteYe, carSlot) if (source == buyButton) then guiSetVisible (carshopWindow, false) showCursor (false,false) if (guiGridListGetSelectedItem (carGridList)) then local carName = guiGridListGetItemText (carGridList, guiGridListGetSelectedItem (carGridList), 1) local carID = getVehicleModelFromName (carName) local carCost = guiGridListGetItemText (carGridList, guiGridListGetSelectedItem (carGridList), 2) triggerServerEvent ("carShopCarBuy", getLocalPlayer(), carID, carCost, carName ) end elseif (source == closeButton) then guiSetVisible (carshopWindow, false) showCursor (false,false) end if (source == buyButton) and _carSlot2 then guiSetVisible (carshopWindow, false) showCursor (false,false) if (guiGridListGetSelectedItem (carGridList)) then local carName2 = guiGridListGetItemText (carGridList, guiGridListGetSelectedItem (carGridList), 1) local carID2 = getVehicleModelFromName (carName) local carCost2 = guiGridListGetItemText (carGridList, guiGridListGetSelectedItem (carGridList), 2) triggerServerEvent ("carShopCarBuy2", getLocalPlayer(), carID2, carCost2, carName2, carSlot2 ) end elseif (source == closeButton) then guiSetVisible (carshopWindow, false) showCursor (false) end end addEventHandler ("onClientGUIClick", getRootElement(), onClientGUIClick)
-
I think it works what i did but i dint tested with another player, here is the code code removed
-
hey, i have a money drop script, but i wont when the player suicides lose his money, someone know how to do when he suicide dont lose it? here is my code code removed
-
i have this but it sets the server game speed not the player function slowMotion ( playerSource ) if ( playerSource ) then setGameSpeed(0.5, playerSource) outputChatBox ( "Slow Motion Activated", playerSource ) end end addCommandHandler ( "slow", slowMotion )
-
But how exactly i can detect who executed function?
-
Hey, i tryed to use the setGameSpeed function to do a kind of slow motion but i failed, so if someone could give me a example ( i want the setGameSpeed only sets for who executes function ) Thanks
-
Do you have any proof of him stealing? cause i dint saw any topic of him with any client side script.
-
onClientClick Or you could use dxGUIElements functions I have in one of my resources (scripts/client/dxGUI for needed scripts and scripts/client/Spawnscreen.lua for example usage) Example usage: addDXGUIElement({ info = {parent = "aContainer", priority = 2, type = "text", id = "teamTitle"}, normalData = {text = "Team", left = 10, top = 10, color = tocolor(255,255,255), scale = 1.2, font = "default-bold", postGUI = true}, hoverData = {color = tocolor(100,100,100)} -- change colour on mouse hover }) parent is a common parent element, or string of whatever, so you could later do: makeDXGUIVisible("aContainer", true) (true means that cursor is also shown) Also, you could specify activeData, which will be used, when button has been clicked on, or you can manually change DXGUIElement state to active with changeGUIElementActive(info, boolean state), where info is a table containing the parent, priority, type and id keys. If state is true, element will be changed to active state (for whatever reason you want to), or when false then to deactive=normal state. You can also add to normalData func and funcAttributes, so that when "button" is clicked, func(funcAttributes) will be called, btw put the functions you want to use there before making the GUI elements (or add filename before GUI functions in meta.xml), because the func is added by reference (just check the example in Spawnscreen.lua). Also, you can add sound for hover and click events (again, check the example usage in Spawnscreen.lua). Thanks, i will take a look right now.
-
Thank you very much, this worked perfect, now i can continue learning dx Edit: btw, someone of us know how i could make a button like i do in gui? but with dx funtions.
-
Exactly what i used, but how to use it in same function?
-
I used this to show it but how i can do to hide etc with only 1 key, this is what i used function show_dx () addEventHandler("onClientRender",rootElement, create2DRectangle) showCursor(true) end bindKey ( "m", "down", show_dx )
-
Hey, i made some dx draw things and now i want to toggle it visible with a bindKey, like i do with gui using "guiSetVisible".
-
this is his code, addCommandHandler("roll",rolldice) function rolldice(player,comd) local roll = math.random(1,4) if roll == 1 then outputChatBox("u won") elseif roll == 2 then outputChatBox("u lost") elseif roll == 3 then setPlayerMuted(source,true); setTimer(function() setPlayerMuted(source,false) end,1,30000) elseif roll == 4 then outputChatBox("u win") end end
-
Omg this resource rocks, thanks for sharing
-
Still same errors , and my account has that data "exp.lvl"
-
Your code gives me a error in line 1 expected near "=" Edit: i ve fixed that but now it gives 1 warning in line 4 and 1 error in line 5 saying line 4: Bad argument getElementData line 5: attempt to perform arithmetic on local "kills" (a boolean value) any help?
-
Ok, thanks karlis for the example, now i have how to start
-
hey there, i wish that someone could give me a example of how to make a random word, like in 5 minutes outputs to chat box "first one type ASO8 win the contest" and when he types it outputs who did it and that he won. could someone give me a hand? Thanks
-
this isnt what he asked if im not wrong, he asked how to output the code of the gui he made not a gui that he want to edit.
-
hey, im suposing that u unziped the guieditor.zip before run it cause if u dont do it it wont work like u want, to get what u did with guieditor press a button called "OUTPUT CODE" if im not wrong thats the name, then go to guieditor folder and find this file "GUIEditor_output.txt". i hope its some help