Jump to content

scaryface87

Members
  • Posts

    123
  • Joined

  • Last visited

scaryface87's Achievements

Sucka

Sucka (13/54)

0

Reputation

  1. Hello , Is it possible to bind a key to control the camera on foot? For example binding num_2,4,6,8 to move arround on foot? Thanks in advance.
  2. Hello , Im trying to go a little bit higher. This time if u do /rent it"ll set a data to a createdcar , this car gets saved in a SQL file So i made a collumn with model , x ,y ,z , owner if script starts it creates a vehicle with the info it get + it sets elementdata (value is in collumn owner) My question is is it possible to get the object with the elementdata of the owner & remove hes name to "rentable"? Hm i think i might be able to make it so im trying it first.
  3. Ah right i forgot about setAccountData & getAccountData , Thank you! i"ll try it
  4. Hello , I would like to make a "rent" script if u do /rent (number of days) for example /rent 1 , then ur renting something for a certain day u fill in. Something like this below : I should be able to restart the script without losing the (timer?) (the rent) function rentMe(playerSource) outputChatBox("You rented me for *how many day here*!") setElementData(playerSource,"hasRent",1) end addCommandHandler("rent",rentMe)
  5. Hello , So i tought it would fix my actual script but it didnt. So i've made a function to attach an object to myself (a cone) but if someone elses takes another cone and i do tries to remove the cone wen he clcks on it after doing command then it removes the latest created object created by a player i remove hes. its still not the actual code but its kind of the same & it should help. -- server local playerObjects = {} function createCones() playerObjects[player] = createObject(1238,1042.91797,1024.59106,11.00000) -- playerObjects[player] = createObject(1238,1042,91797,1024,59106,12) -- i know this isnt going to work but i kindda want it to work end addCommandHandler("createCone",createCones) -- this gets triggered by something else but u can take it as a commandhandler function onPlayerClick(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) attachElements(playerObjects[player],player,0,1,0.2) -- attach clicked cone end addEvent("onPlayerClick",true) addEventHandler("onPlayerClick",getRootElement(),onPlayerClick) function onRemoveRequest(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) destroyElement(playerObjects[player]) -- to remove the clicked cone too end addEvent("onRemoveRequest",true) addEventHandler("onRemoveRequest",getRootElement(),onRemoveRequest) --- client --- function testCursor() if isCursorShowing ( getLocalPlayer() ) then showCursor(false) removeEventHandler("onClientClick",getRootElement(),clickHandler) else showCursor(true) addEventHandler("onClientClick",getRootElement(),clickHandler) end end addCommandHandler("cursor",testCursor) function removeCursor() if isCursorShowing ( getLocalPlayer() ) then showCursor(false) removeEventHandler("onClientClick",getRootElement(),clickRemoveHandler) else showCursor(true) addEventHandler("onClientClick",getRootElement(),clickRemoveHandler) end end addCommandHandler("removecursor",removeCursor) function clickHandler(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) if clickedElement then triggerServerEvent("onPlayerClick",resourceRoot,button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) end end function clickRemoveHandler(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) if clickedElement then triggerServerEvent("onRemoveRequest",resourceRoot,button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) end end addEventHandler("onClientClick",getRootElement(),clickRemoveHandler)
  6. Its getting sence for me now So if im correct i dont have to use table.insert or should i use it in any case
  7. Hm i give it a try even tought i never used tables So if im right its someting like this : I have no clue how to use it So if im right it can be somethign like this : myTabel = {} function testFunc(playerSource) table.insert ( myTable, { "1238", 3, 2, 1 } )-- i dont get this but i tried for i,v in ipairs ( myTabel ) do -- to get everything of the table... local model = getElementModel(v[1]) local object[i] = createObject ( model, tonumber([v2]), tonumber([v3]), tonumber([v4])) attachElements(object[i],playerSource,0,1,0.2) end end addCommandHandler("attach",testFunct) function testother(playerSource) detachElements(object[i],playerSource) table.remove(myTable,) --- same unfinished but idk how to do this too end addCommandHandler("removeobJect",testother)
  8. Hello, I've made a script lately but i got a little problem. If player1 uses the command /attachobject the object will attach If player2 uses it also it"ll works fine But if player1 uses /removeobject then it removes the object of player2 not player1. So my question is , is it possible to name the created object "object(playeraccount) ? Sorry for bad english here is my script ; #server side function testFunct(playerSource) object = createObject(1238,0,0,0) setElementCollisionsEnabled(object,false) -- anti push abuse + camerafix with other objects attachElements(object,playerSource,0,1,0.2) end addCommandHandler("attach",testfunction) function testFunct(playerSource) object = createObject(1238,0,0,0) attachElements(object,playerSource,0,1,0.2) end addCommandHandler("attach",testFunct) function testother() detachElements(object,playerSource) end addCommandHandler("removeobJect",testother)
  9. I want the object seen by everyone so is my other part server side EDIT Fixed it bymyself used getElementData clientside
  10. Hello , So im trying to maake a function to check if the elementdata on the clicked object is true or not I tried the following thing wich is working BUT if i click on another object without the elementdata it shows as true. Also this is triggered whenever i click on it if im in any gui is it possible to fix this also?
  11. Hello , I would like to know if its posssible to check multiple collumns. What i mean with it is the 2 lines below this should be one and sshould only delete a table if it maatches the the model & name(playername) in the SQL database executeSQLQuery("DELETE FROM `InteriorObjectsTEST` WHERE `model`=?",model) -- i defined model already executeSQLQuery("DELETE FROM `InteriorObjectsTEST` WHERE `name`=?",playerName) --- -- basicly this but then in one line and shouldnt delete everything
  12. Hello , I've found a little problem. The script is functionaling perfectly except the part that the database is getting created? Everything is working fine but if i check registery.db i cant see the table there. Any idea why? function createTable() executeSQLQuery("CREATE TABLE IF NOT EXISTS lastID (lastID NUMERIC)") end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),createTable) Fixed with restarting server
  13. Thank you very much! I got it all working with SQL now. If im right SQL wont create any laggs?(or atleast not big ones)
  14. Hello , One more question is it possible to save the last number? So if i restart the script for example the number will go up depending the last number thats given out? Edit : Fixed it with elementdata but if i restart the server its gone Or am i wrong and it"ll keeps the eleentdata even after restarting the server. Greetings
  15. Hello , this isnt rlly helping me out as im not understunding it properly. So i wanna try to make aanother thing for : function numberup() number = +1 -- this is wrong i know outputChatBox("".. number .."") end addCommandHandler("number",numberup) What it should do : after doing /nextnumber it should do +1 from the previous number so if player 1 uses /number then it says 1 then player 2 will use /number , then it"ll say 2
×
×
  • Create New...