Jump to content

scaryface87

Members
  • Posts

    123
  • Joined

  • Last visited

Posts posted by scaryface87

  1. 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.

  2. 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) 
      
    

  3. 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) 
      
      
      
      
    

  4. 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) 
      
      
    

  5. 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) 
      
      
    

  6. 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?

  7. 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 
      
    

  8. 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

  9. 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

  10. 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

  11. Hello ,

    I would like to know how to assign an ID starting from 1 to unlimitedd.

    For example if person got ID 1 then the next one requesting an id will receive ID 2.

    I would like to do this with

      
    setElementData 
      
    

    Thank you in advance

  12. Hello ,

    I wanna use getAccountData to save data for a system.

    So now i got a problem.

    I wanna use getAccountData result into client side (i know its server side only)

    So i wanna make a "VIP" button if the getAccountData returns true.

    For example

      
    function test(playerSource) 
    local playerAccount = getPlayerAccount(playerSource) 
    if getAccountData(playerAccount,"vip") then 
    -- here it should go to client side i guess but then i end up in a problem.(check the next lua box) 
    end 
    end 
      
    

      
    --- a quick gui 
    function theGui() 
            window = guiCreateWindow(216, 118, 387, 281, "", false) 
            guiWindowSetSizable(GUIEditor.window[1], false) 
      
            button = guiCreateButton(23, 193, 342, 78, "VIP.", false, window) 
    --- Here i should make a trigger for getting the account data which i cant due fact getAccountData is server side only 
    button = guiCreateButton(23, 193, 342, 78, "Not Vip.", false, window) 
    end 
      
    

    Sorry for bad explaination

  13. Hello ,

    Is it possible to remove the option "No"?

    OR even better is it possible to make it "restart" the current map if the vote is No?

    Due fact it just says "votemap : not enough votes to change to "map name" on map "map name"

    Thank you in advance

  14. Hello ,

    So i made some statistics on the web for my server.

    I would like to make a page without a login popup.

    So if i go to IP:22005/(name of script)/index.html i dont want to get a "login panel" if i try to reach it

    Sorry for bad english

  15. Hello ,

    I would like to remove the value in a elementdata

    What i mean is this thing bellow

      
    setElementData(thePlayer,"peds",[b]5[/b]) -- settng the elementdata 
      
      
    function removePed() 
    removeElementData(thePlayer,"peds",-1) -- Lowering the last value with -1 (cant get it to work like this) 
    end 
    addCommandHandler("takeped",removeped) 
      
    

    I wanna make something like that (the bold 5 should be lowered by -1 once i do /takeped

    Thank you in advance,

×
×
  • Create New...