Jump to content

|H|TiTanium

Members
  • Posts

    74
  • Joined

  • Last visited

Everything posted by |H|TiTanium

  1. Basically I tried many times and probably I'm doing it wrong, but I didn't know how do I create a if condition inside another one, so I tried and tried and nothing works... I need elements to get checked using isElement and then they will get destroyed, because I'm getting a debug message. When you change from a row to another the previous Ped in preview should get destroyed ( it's happening correctly ), but before getting destroyed it should get checked using isElement, but it doesn't work \; Please can you show at least an example showing how do I add an isElement to check Elements and stop the debugs message ( Bad 'element' pointer blablabla ) function gridClick ( state, absoluteX, absoluteY) if isElement(panteraprev) and isElement(pastorprev) then destroyElement =true end local campos = guiGridListGetItemText ( myGridList, guiGridListGetSelectedItem ( myGridList ), 1 ) if campos == "Tiger" then tigreprev = createPed( 40, 2144.87671, -1177.68799, 23.82031 ) destroyElement(panteraprev) destroyElement(pastorprev) destroyElement(rotprev) destroyElement(loboprev) destroyElement(foxprev) end if campos == "Panther" then panteraprev = createPed( 44, 2144.87671, -1177.68799, 23.82031 ) destroyElement(tigreprev) destroyElement(pastorprev) destroyElement(rotprev) destroyElement(loboprev) destroyElement(foxprev) end if campos == "Dog German Shepherd" then pastorprev = createPed( 46, 2144.87671, -1177.68799, 23.82031 ) destroyElement(panteraprev) destroyElement(tigreprev) destroyElement(rotprev) destroyElement(loboprev) destroyElement(foxprev) end if campos == "Dog Rottweiler" then rotprev = createPed( 49, 2144.87671, -1177.68799, 23.82031 ) destroyElement(panteraprev) destroyElement(pastorprev) destroyElement(tigreprev) destroyElement(loboprev) destroyElement(foxprev) end if campos == "Wolf" then loboprev = createPed( 47, 2144.87671, -1177.68799, 23.82031 ) destroyElement(panteraprev) destroyElement(pastorprev) destroyElement(rotprev) destroyElement(tigreprev) destroyElement(foxprev) end if campos == "Fox" then foxprev = createPed( 48, 2144.87671, -1177.68799, 23.82031 ) destroyElement(panteraprev) destroyElement(pastorprev) destroyElement(rotprev) destroyElement(loboprev) destroyElement(tigreprev) end end addEventHandler ("onClientGUIClick", myGridList, gridClick)
  2. I thought about using it, but I was afraid of messing up everything DD:
  3. I'm getting a debugscript error, it says Bad 'element' pointer @ 'destroyElement'(1) And it says to every line where you find destroyElement. I made what you've told me to, and now I got this : function gridClick ( state, absoluteX, absoluteY) local campos = guiGridListGetItemText ( myGridList, guiGridListGetSelectedItem ( myGridList ), 1 ) if campos == "Tiger" then tigreprev = createPed( 40, 2144.87671, -1177.68799, 23.82031 ) destroyElement(panteraprev) destroyElement(pastorprev) destroyElement(rotprev) destroyElement(loboprev) destroyElement(foxprev) end if campos == "Panther" then panteraprev = createPed( 44, 2144.87671, -1177.68799, 23.82031 ) destroyElement(tigreprev) destroyElement(pastorprev) destroyElement(rotprev) destroyElement(loboprev) destroyElement(foxprev) end if campos == "Dog German Shepherd" then pastorprev = createPed( 46, 2144.87671, -1177.68799, 23.82031 ) destroyElement(panteraprev) destroyElement(tigreprev) destroyElement(rotprev) destroyElement(loboprev) destroyElement(foxprev) end if campos == "Dog Rottweiler" then rotprev = createPed( 49, 2144.87671, -1177.68799, 23.82031 ) destroyElement(panteraprev) destroyElement(pastorprev) destroyElement(tigreprev) destroyElement(loboprev) destroyElement(foxprev) end if campos == "Wolf" then loboprev = createPed( 47, 2144.87671, -1177.68799, 23.82031 ) destroyElement(panteraprev) destroyElement(pastorprev) destroyElement(rotprev) destroyElement(tigreprev) destroyElement(foxprev) end if campos == "Fox" then foxprev = createPed( 48, 2144.87671, -1177.68799, 23.82031 ) destroyElement(panteraprev) destroyElement(pastorprev) destroyElement(rotprev) destroyElement(loboprev) destroyElement(tigreprev) end end addEventHandler ("onClientGUIClick", myGridList, gridClick) It works fine, but there are those debug messages, saying that there is something wrong on each destroyElement... I get "Bad 'element' pointer @ 'destroyElement'(1)" everytime I change between rows
  4. Well, it's simple but I'm not an expert, basically when player click on a Row of gridlist, a Ped should spawn, and if he changes the row ( clicks on another one ) the previous Ped should get deleted and a new one get created. What is happening wrong ? The Ped is created, but everytime I click on another row, The previous Ped keeps there, instead of being destroyed. What is wrong ? I need it like this: When GUI opens, I click on the first Row to get a preview of the Ped, when I click on another Row, the previous Ped should get deleted and the new one should get into my preview. But it's not what is happening. Here is the thing which is supposed to do the job ( at least in my mind ) function gridClick ( state, absoluteX, absoluteY) local campos = guiGridListGetItemText ( myGridList, guiGridListGetSelectedItem ( myGridList ), 1 ) if campos == "Tiger" then local tigreprev = createPed( 40, 2144.87671, -1177.68799, 23.82031 ) destroyElement(panteraprev) destroyElement(pastorprev) destroyElement(rotprev) destroyElement(loboprev) destroyElement(foxprev) end if campos == "Panther" then local panteraprev = createPed( 44, 2144.87671, -1177.68799, 23.82031 ) destroyElement(tigreprev) destroyElement(pastorprev) destroyElement(rotprev) destroyElement(loboprev) destroyElement(foxprev) end if campos == "Dog German Shepherd" then local pastorprev = createPed( 46, 2144.87671, -1177.68799, 23.82031 ) destroyElement(panteraprev) destroyElement(tigreprev) destroyElement(rotprev) destroyElement(loboprev) destroyElement(foxprev) end if campos == "Dog Rottweiler" then local rotprev = createPed( 49, 2144.87671, -1177.68799, 23.82031 ) destroyElement(panteraprev) destroyElement(pastorprev) destroyElement(tigreprev) destroyElement(loboprev) destroyElement(foxprev) end if campos == "Wolf" then local loboprev = createPed( 47, 2144.87671, -1177.68799, 23.82031 ) destroyElement(panteraprev) destroyElement(pastorprev) destroyElement(rotprev) destroyElement(tigreprev) destroyElement(foxprev) end if campos == "Fox" then local foxprev = createPed( 48, 2144.87671, -1177.68799, 23.82031 ) destroyElement(panteraprev) destroyElement(pastorprev) destroyElement(rotprev) destroyElement(loboprev) destroyElement(tigreprev) end end addEventHandler ("onClientGUIClick", myGridList, gridClick)
  5. Not needed, it's fixed now, thanks anyway ;DDD
  6. Yeah, it's working, but this is the problem now : Please, there is a bug, before screen gets faded the camera is already placed and looking to the wall, how do I make screen fade first and then camera gets placed and looking at the wall ?
  7. Read my edit and if you can help me, please do it
  8. EDIT: Please, there is a bug, before screen gets faded the camera is already placed and looking to the wall, how do I make screen fade first and then camera gets placed and looking at the wall ? So now, I got a new problem, when the player reaches marker, his camera is faded to black and then it backs to normal, then when it's back a GUI appears and the camera is looking to the wall ( as I want ), but when the player clicks on Close button, the camera still looking at wall, I tried setCameraTarget , but the seems impossible as what I'm trying to do can only be made on server-side ( I'm scripting on client-side ), I got these lua codes, First code is working perfectly, camera is faded, GUI appears, camera is looking at wall. Second code is the problem... function showGUI( hitElement, matchingDimension ) if ( hitElement == getLocalPlayer() and source == myMarker ) then setCameraMatrix( 2151.23975, -1178.32861, 23.82031, 2139.42456, -1178.52942, 23.99219 ) -- This is where camera is at and where it's looking at showChat( false ) -- Chat is hidden as soon as camera is faded guiSetVisible ( myWindow, true ) -- Gui appears and also Cursor showCursor( true ) end end addEventHandler( "onClientMarkerHit", getRootElement(), showGUI ) The above code is when player reaches the marker, and the below is when player clicks on "Close" button. Problem is here : function quandofecha( thePlayer ) fadeCamera ( false, 1, 0, 0, 0 ) setTimer ( fadeCamera, 1000, 1, true ) setCameraTarget( thePlayer ) -- I'm sure I'm doing this wrongly, but I don't have any idea of how do I back the camera, also I think it's not possible on client-side ( I'm building on it ) and please, teach me how do I do it... showChat( true ) end addEventHandler("onClientGUIClick", myButton2, quandofecha, false)
  9. oh, my bad I tried : setTimer ( piscar, 1000, 1, true ) I thought I should trigger it to the function
  10. Hello, it's not a big problem and I'm sure you can do it easily, as I'm not an experienced scripter yet, I thought about asking you how do I do it. My problem is that I can do my screen black using fadeCamera but I don't know how do I back to normal. I tried setTimer but probably I made something wrong and due that it doesn't work. It's made client-side This is the function which makes my screen black: function piscar( hitElement, matchingDimension ) if ( hitElement == getLocalPlayer() and source == myMarker ) then fadeCamera ( false, 1, 0, 0, 0 ) end end addEventHandler( "onClientMarkerHit", getRootElement(), piscar ) As you see, when I reach marker, my screen is faded to black, but it doesn't back to normal, the only thing I need is a way of making screen back to normal.
  11. Is it possible to add your script to mine, because they will already have to download slothbot, and so it could look like this: local tigre1 = call (getResourceFromName("slothbot"), "spawnBot", x+3, y+1, z, rot, skin, interior, dimension, team, weapon, mode, modesubject) setElementData ( tigre1, "pet", cachorro ) setElementExtraHealth ( tigre1, 999 ) else outputChatBox("Você não tem dinheiro para criar um PET", thePlayer, 225, 0, 0) end end addCommandHandler( "tigre", petTigre ) I'm getting an error, which says the client side couldn't be found...
  12. Yeah, it's working better now, but there is a bug, after you keep shooting at Ped, he doesn't lose life, and suddenly he just gets a very low HP, and then you can kill him easily again
  13. Ped is created on server-side, so I thought it should be also created on server-side. local cachorro2 = call (getResourceFromName("slothbot"), "spawnBot", x+3, y+1, z, rot, skin, interior, dimension, team, weapon, mode, modesubject) else outputChatBox("Você não tem dinheiro para criar um PET", thePlayer, 225, 0, 0) end end addCommandHandler( "cachorro2", petCao) addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), function() exports [ "extra_health" ]:setElementExtraHealth ( cachorro2, 999 ) end ) All arguments are already created, so it's not needed to show them all
  14. What is better ? Making Ped invencible ( making a setTimer function to increase Ped's health every x seconds ) or making him with a big life ? Also , I was trying to add what you told me to. I got no result, I don't know if I'm making it rightly. I tested on server-side, no result: addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), function() exports [ "extra_health" ]:setElementExtraHealth ( cachorro2, 999 ) end ) Also tried on Client-side, but doesn't work at all. please teach me how.
  15. Is there a way to prevent Ped getting killed easily ? If maximum health is 200%, I wanna know if it's possible to make him more invencible, like reducing damage, etc. Also, is 200% = 999 ?
  16. I have already created the Ped, using slothbot and an argument like this local cachorro2 = blablablabla setPedStat( cachorro2, 24, 999 ) So basically I'm trying to increase Ped's health using setPedStat, so ID is 247 and max_health should be set to 999 ( As I think it's the maximum ... ) But it doesn't work, it's the same ease to kill the Ped ;(((. Please may someone teach me how do I do it ?
  17. Done. Something strange happened to me, yesterday GUI was working fine, today I could just see the Cursor, so I did what you have said to and works fine now. function showGUI( hitElement, matchingDimension ) if ( hitElement == getLocalPlayer() and source == myMarker ) then guiSetVisible ( myWindow, true ) showCursor( true ) else end end addEventHandler( "onClientMarkerHit", getRootElement(), showGUI ) function closeGUI ( ) guiSetVisible ( myWindow, false ) showCursor( false ) end addEventHandler("onClientGUIClick", myButton2, closeGUI, false)
  18. I know if it's possible to save your Ped, like this: Someone buys a Ped ( created with slothbot ) to protect him, if the player leaves the server, Ped is automatically deleted, if the player comes again to server, Ped is automatically created again, with the same arguments ( skins, coordinates, etc ). I wanna know if it's possible and if so, tell me the statements please, if it's not abusing you so much
  19. Works fine now, I forgot to use it. Thank you for remembering me about it
  20. Ok, it works a bit better now, but the main problem and the last one is that when a player enters the server the GUI shows up automatically instead of keeping hidden. I don't know what is wrong. I need a help to make GUI hidden and then just show up when a player hits marker function showGUI( hitElement, matchingDimension ) if ( guiGetVisible ( myWindow ) == true ) then guiSetVisible ( myWindow, false ) else guiSetVisible ( myWindow, true ) showCursor( true ) end end addEventHandler( "onClientMarkerHit", getRootElement(), showGUI ) function closeGUI ( ) guiSetVisible ( myWindow, false ) showCursor( false ) end addEventHandler("onClientGUIClick", myButton2, closeGUI, false)
  21. Ok, it works a bit better now, but the main problem and the last one is that when a player enters the server the GUI shows up automatically instead of keeping hidden. I don't know what is wrong. I need a help to make GUI hidden and then just show up when a player hits marker function showGUI( hitElement, matchingDimension ) guiSetVisible ( myWindow, true ) showCursor( true ) end addEventHandler( "onClientMarkerHit", getRootElement(), showGUI ) function closeGUI ( ) guiSetVisible ( myWindow, false ) showCursor( false ) end addEventHandler("onClientGUIClick", myButton2, closeGUI, false)
  22. Basically, my script is about a GUI which should open when a player enters a marker, but it doesn't work, when I enter server, the GUI automatically shows up on my screen instead of being hidden til I get to marker, here I got the code. I just need your help to make the GUI appears when a player reaches the marker. function showGUI( hitElement, matchingDimension ) if ( guiGetVisible ( myWindow ) == true ) then guiSetVisible ( myWindow, false ) else guiSetVisible ( myWindow, true ) showCursor( true ) end end addEventHandler( "onMarkerHit", myMarker, showGUI ) function closeGUI( leaveElement, matchingDimension ) guiSetVisible ( myWindow, false ) showCursor( false ) end addEventHandler( "onMarkerLeave", myMarker, closeGUI )
  23. I'm doing an event manager, built in a GUI panel. But of course, I gotta make only admins allowed to open GUI, but everytime I try to add the below code (I'm not sure if I'm using the right one) I get message errors. But I'm sure something is wrong, as when I log, GUI opens automatically, so basic I want this : I wanna make only Admins allowed to open GUI, and to make it appear using /events and so close using myButton8 local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ( "user.".. accName, aclGetGroup ( "Admin" ) ) then I wanna add the above code to the code below. function showGUI ( ) if ( guiGetVisible ( myWindow ) == true ) then guiSetVisible ( myWindow, false ) else guiSetVisible ( myWindow, true ) showCursor( true ) end end addEventHandler("onClientResourceStart", resourceRoot, showGUI) addCommandHandler ( "events", showGUI ) function closeGUI ( ) guiSetVisible ( myWindow, false ) showCursor( false ) end addEventHandler("onClientGUIClick", myButton8, closeGUI, false)
  24. "There is currently no text in this page"
×
×
  • Create New...