Jump to content

TrickyTommy

Members
  • Posts

    50
  • Joined

  • Last visited

Everything posted by TrickyTommy

  1. Hi! I want serverside variables be drawn on my screen. This is what i have done so far, the script is not really working, but there are no errors, but it draws "nil". What i have done so far: Server: CanPlayerChooseTeam = false CanPlayerChooseCharacter = true function CanChooseTeam() return CanPlayerChooseTeam end addEvent ("CanChooseTeam", true) addEventHandler ("CanChooseTeam", root, CanChooseTeam) function CanChooseCharacter() return CanPlayerChooseCharacter end addEvent ("CanChooseCharacter", true) addEventHandler ("CanChooseCharacter", root, CanChooseCharacter) function SendDatasToDebug(BoolTeam, BoolChar) if BoolChar then BoolTeam = CanPlayerChooseTeam BoolChar = CanPlayerChooseCharacter triggerClientEvent ("RecieveDatas", root, BoolTeam, BoolChar) end end addEvent ("SendDatasToDebug", true) addEventHandler ("SendDatasToDebug", root, SendDatasToDebug) function ModifyDefaultChooseValues(Client, Command, Factor, Value) if Value then if Factor == "team" and Value == "true" then CanPlayerChooseTeam = true end if Factor == "team" and Value == "false" then CanPlayerChooseTeam = false end if Factor == "character" and Value == "true" then CanPlayerChooseCharacter = true end if Factor == "character" and Value == "false" then CanPlayerChooseCharacter = false end end end addCommandHandler ("mchoose", ModifyDefaultChooseValues) Client: function RecieveDatas(BoolTeam, BoolChar) if BoolChar then BoolTeam = BoolTeam BoolChar = BoolChar end end addEvent ("RecieveDatas", true) addEventHandler ("RecieveDatas", root, RecieveDatas) function RenderDebugHud() triggerServerEvent ("SendDatasToDebug", root, BoolTeam, BoolChar) dxDrawText ("Engedélyezett csapatválasztás: "..tostring(BoolTeam).."", 500, 500) end addEventHandler ("onClientRender", root, RenderDebugHud)
  2. Hey friends, i want to make an authentication system. But i am not good at SQL and i have no clue where to start, thats why i would like to ask you for an example script with comments. Current DB name: mta_test, Current table name: users I use root. Basicly i need a command that inserts a string into mysql, and another command that checks if there is anything like the given string.
  3. okay, thanks, but how do i ask for example the car's maximum velocity?
  4. Hello, i want to get the original handling of all vehicles, and boost them a bit. But i can't get their speed, it returns nil! I did not understand the examples online. function realHandling() if isTimer (checkVehicles) then killTimer (checkVehicles) end local checkVehicles = setTimer (function() vehicles = getElementsByType("vehicle") for k, v in pairs(vehicles) do local originalHandling = getOriginalHandling(596) for k in pairs (originalHandling) do outputDebugString (tostring(k["maxVelocity"])) end if not getElementData (v, "realHandled") then end end end, 50, 0) end addEventHandler ("onResourceStart", getRootElement(), realHandling)
  5. thanks... but why do i need the brackets and the other stuff? on vehicle id list page there are no brackets and equalation marks and booleans just vehicle ids...
  6. thanks, and how sould i do the table-call?
  7. Hi! If i hit a marker an if node should run. It runs, but it is very strange, and i don't know what the problem is. I would like to make a script, that if i hit the marker(s) with a vehicle that is given in the table, it would just put something into debugscript 3, i can continue from there. What i have done so far: driveInAndGo = {596, 597, 598, 416, 533} function borderMarkerHit(client) --if driveInAndGo[getElementModel(client)]? if getElementType (client) == "vehicle" then outputDebugString ("the hit element was a vehicle") else outputDebugString ("the hit element was not a vehicle") end --getVehicleSirensOn end addEventHandler ("onMarkerHit", borderMarkerLeaveLS, borderMarkerHit) addEventHandler ("onMarkerHit", borderMarkerLeaveSF, borderMarkerHit) The strange thing is, that either the message that says hit element was a vehicle and hit element was not a vehicle gets displayed... I would continue it like this: if hit element was vehicle and it's ID is in the driveInAndGo table, something would happen.
  8. Hi! These are the first lines of my code, they are not belonging to any function. My problem is, that i can't make the marker's alpha to 0, nohow. What is wrong? endMarker1 = createMarker (-1495.65259, 590.80280, 34.57813-1, "checkpoint", 10, 255, 0, 0, 0) endMarker2 = createMarker (2780.93530, -225.25746, 24.13024, "checkpoint", 10, 255, 0, 0, 0) endMarker3 = createMarker (2765.39575, 321.42563, 8.28975, "checkpoint", 10, 255, 0, 0, 0) setElementAlpha (endMarker1, 0) setElementAlpha (endMarker2, 0) setElementAlpha (endMarker3, 0) fixed: changed it's type to cylinder, and from now on it is not visible.
  9. ohhh i did not know about that. you made my future days a lot easier, thanks for telling me about synchronizing
  10. but this is on client-side. my client side is able to get element data, from other clients? or what?
  11. Hi! I want other players to see each other's writing sign.
  12. i made a timer that delays it by 2500ms. works fine by now.
  13. I am making a job-system script, and it simply just won't work. "server triggered clientside event drawBusMarker, but event is not added clientside." local markerData = {} markerData["busMarkerX"] = 2481.96753 markerData["busMarkerY"] = -1670.67761 markerData["busMarkerZ"] = 13.34018 markerData["busMarkerSize"] = 2 markerData["busMarkerAlpha"] = 100 markerData["busMarkerR"] = 149 markerData["busMarkerG"] = 215 markerData["busMarkerB"] = 116 function createBusMarker() if isElement (busMarker) then destroyElement (busMarker) end triggerClientEvent ("drawBusMarker", getRootElement(), markerData["busMarkerX"], markerData["busMarkerY"], markerData["busMarkerZ"]) busMarker = createMarker (markerData["busMarkerX"], markerData["busMarkerY"], markerData["busMarkerZ"]-1, "cylinder", markerData["busMarkerSize"], markerData["busMarkerR"], markerData["busMarkerG"], markerData["busMarkerR"], markerData["busMarkerAlpha"]) return busMarker end Client: local white = tocolor(255,255,255,255) function dxDrawImage3D(x,y,z,w,h,m,c,r,...) local lx, ly, lz = x+w, y+h, (z+tonumber(r or 0)) or z return dxDrawMaterialLine3D(x,y,z, lx, ly, lz, m, h, c or white, ...) end function drawBusMarker(busX, busY, busZ) function renderBusMarker() local busIcon = dxCreateTexture("files/images/buszIkon.png") dxDrawImage3D (busX, busY, busZ, 200, 200) end addEventHandler ("onClientRender", getRootElement(), renderBusMarker) end addEvent ("drawBusMarker", true) addEventHandler ("drawBusMarker", getRootElement(), drawBusMarker) Sorry if i am not findig a simple mistake, but i am awake for a day now, and i am really tired. meta: clientside starts first <meta> <script src="codeCG.Job.lua" type="client"/> <script src="codeC.Job.lua" type="client"/> <script src="codeSG.Job.lua" type="server"/> <script src="codeS.Job.lua" type="server"/> <file src="files/images/buszIkon.png"/> </meta>
  14. looks awesome. i love it already!
  15. Hi! I am making a script, that writes above your head that you are typing if you do so. The only problem is, it does barely work, and strangely. When i escape from input, it won't disappear. What i have done so far: Client: function recieveConsoleImput(client) function render() --if client ~= localPlayer then dxDrawTextOnElement (client, "l'écriture... / Writing... / Ír...", _, _, _, _, _, _, 2) --end removeEventHandler ("onClientRender", getRootElement(), render) end addEventHandler ("onClientRender", getRootElement(), render) end addEvent ("recieveConsoleImput", true) addEventHandler ("recieveConsoleImput", getRootElement(), recieveConsoleImput) function checkConsoleImput() if isChatBoxInputActive(localPlayer) then triggerServerEvent ("forwardConsoleImput", getRootElement(), localPlayer) end end addEventHandler ("onClientRender", getRootElement(), checkConsoleImput) Server: function forwardConsoleImput(client) triggerClientEvent ("recieveConsoleImput", getRootElement(), client) end addEvent ("forwardConsoleImput", true) addEventHandler ("forwardConsoleImput", getRootElement(), forwardConsoleImput) heyyy whats wrong?
  16. as i know, the first one is the argument for alpha. anyways, still not working dxDrawRectangle3D (x, y, z+1, 100, 50, tocolor(255, 255, 255, 255))
  17. think the solution for the nametag works, yet the rectangle is not visible....
  18. Hi! I am trying to make two things on my server: -license plates above cars, and rectangles above them too. -player nametags, and my nametag should not be visible for myself. I have problems with both: -the rectrangle is not getting drawn above the car -i don't know how sould i make my nametag not visible for myself. Current progress: function Draw() local vehs = getElementsByType("vehicle") for k,v in ipairs(vehs) do dxDrawTextOnElement (v, getVehiclePlateText(v), 0.75, _, _, _, _, _, 2) local x, y, z = getElementPosition (v) dxDrawRectangle3D (x+1, y+1, z+1, 100, 25, tocolor(255, 0, 0, 0)) end local players = getElementsByType("player") for k,v in ipairs(players) do dxDrawTextOnElement (v, getPlayerName(v), _, _, _, _, _, _, 1) end end addEventHandler ("onClientRender", getRootElement(), Draw)
  19. yes. because i don't want to get the weapon's picture on the screen. i have not found a good image for it yet.
  20. yeah, i just noticed it. still not working.... local weaponID = getPedWeapon(localPlayer) outputDebugString (weaponID) if not weaponID == 44 and not weaponID == 45 then local WeaponIcon = dxDrawImage (1360/dX*jX, 70/dY*jY, 200/dX*jX, 100/dY*jY, "assets/images/weapons/"..tonumber(weaponID)..".png") else outputDebugString ("else") end at least this way weapons get drawn: local weaponID = getPedWeapon(localPlayer) outputDebugString (weaponID) local NotExist = {["44"] = true, ["45"] = true} if not NotExist[weaponID] then WeaponIcon = dxDrawImage (1360/dX*jX, 70/dY*jY, 200/dX*jX, 100/dY*jY, "assets/images/weapons/"..tonumber(weaponID)..".png") else outputDebugString ("else") end but yet it is attempting to draw on 44 and 45
  21. Hi. The script should draw an image of my current weapon if i don't hold weapon id 44 or 45, but it is not doing so. -- weap icon local weaponName = getPedWeapon(localPlayer) outputDebugString (weaponName) if tostring(weaponName) == not "44" and tostring(weaponName) == not "45" then local WeaponIcon = dxDrawImage (1360/dX*jX, 70/dY*jY, 200/dX*jX, 100/dY*jY, "assets/images/weapons/"..tonumber(fegyverid)..".png") else outputDebugString ("else") end "else" is being displayed, whether i hold weapon id 44, 45 or not.
  22. Actually, i found the piece of code on Wikipedia, but i don't really know what this part "k, v in ipairs" of the code does. I looked it up, but did not really understand the explanations.
  23. Hi! I want to send a message for the people, who has "Admin" as an element Data. This is what i could do so far: function sendMessageToAdmins(msg) for k, v in ipairs (getElementsByType("player")) do if getElementData (v, "Admin", true) then outputChatBox (msg, v) end end dunno how to continue.
×
×
  • Create New...