DarkByte Posted July 6, 2016 Posted July 6, 2016 Hello, i have a problem. The zone name won't draw, if i put the code in main hud it screws up. ------------>> local screenW, screenH = guiGetScreenSize ( ) function renderNewLocation() -- if (not isPlayerHudComponentVisible("radar") or isPlayerMapVisible() or not hudEnabled) then return end local x,y,z = getElementPosition(localPlayer) local zone = getZoneName(x, y, z) if (zone == "El Castillo del Diablo") then zone = "Ghost Town" end if (cur_zone == zone) then return end cur_zone = zone dxDrawShadowText(zone, screenW*(280/1980), 30, screenW*(280/1980), 30, tocolor(254, 254, 254, 255), scale,"bankgothic", "center", "top", false, false, true, true, false) outputChatBox(zone) end addEventHandler("onClientRender",root,renderNewLocation) When I hear someone saying Mac is better than PC. w0t?w0t? w0t? Great minds discuss ideas, average minds discuss events and small minds discuss people.
Walid Posted July 6, 2016 Posted July 6, 2016 Try this ------------>> local screenW, screenH = guiGetScreenSize ( ) function renderNewLocation() local x,y,z = getElementPosition(localPlayer) local zone = getZoneName(x, y, z) if (zone == "El Castillo del Diablo") then zone = "Ghost Town" end dxDrawText(zone, screenW*(280/1980), 30, screenW*(280/1980), 30, tocolor(254, 254, 254, 255), scale,"bankgothic", "center", "top", false, false, true, true, false) end addEventHandler("onClientRender",root,renderNewLocation) Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
DarkByte Posted July 6, 2016 Author Posted July 6, 2016 Oh gosh, you saved me THANKS When I hear someone saying Mac is better than PC. w0t?w0t? w0t? Great minds discuss ideas, average minds discuss events and small minds discuss people.
Walid Posted July 6, 2016 Posted July 6, 2016 Oh gosh, you saved me THANKS You are welcome. Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
DarkByte Posted July 6, 2016 Author Posted July 6, 2016 Found the mess. FIXED When I hear someone saying Mac is better than PC. w0t?w0t? w0t? Great minds discuss ideas, average minds discuss events and small minds discuss people.
DarkByte Posted July 6, 2016 Author Posted July 6, 2016 I've made a script for events, it works but the text suddenly disappears. Here is the code. Client function output (text,name) dxDrawText(""..text.."[Hosted by "..name.."", 4, 5, 296, 20, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end addEvent("sendText", true) addEventHandler("sendText", getRootElement(), output) Server nametags_Players = getElementsByType('player') function events(thePlayer,_, ...) if exports.staff:isPlayerStaff(thePlayer) then for i,allPlayers in ipairs(nametags_Players) do local message = table.concat({...}, ' ') local name = getPlayerName(thePlayer) triggerClientEvent(allPlayers, "sendText", getRootElement(), message,name) end end end addCommandHandler("event",events) When I hear someone saying Mac is better than PC. w0t?w0t? w0t? Great minds discuss ideas, average minds discuss events and small minds discuss people.
Walid Posted July 6, 2016 Posted July 6, 2016 Untested (i'm using the phone) *Client side -- output event stuff function output (text,name) text = text name = name addEventHandler ( "onClientRender", getRootElement(), drawEvent) setTimer(removeEventDraw,10000,1) end addEvent("sendText", true) addEventHandler("sendText", getRootElement(), output) -- remove draw event after 10 seconds function removeEventDraw () removeEventHandler ( "onClientRender", getRootElement(), drawEvent ) end -- draw event message local screenW, screenH = guiGetScreenSize ( ) function drawEvent() dxDrawText(text.."[Hosted by "..name.."]", screenW*(280/1980), 30, screenW*(280/1980), 30, tocolor(254, 254, 254, 255), 1,"default", "center", "top", false, false, true, true, false) end *Server side function events(thePlayer,_, ...) local nametags_Players = getElementsByType('player') if exports.staff:isPlayerStaff(thePlayer) then for i,allPlayers in ipairs(nametags_Players) do local message = table.concat({...}, ' ') if message and message ~= "" then local name = getPlayerName(thePlayer) triggerClientEvent(allPlayers, "sendText", getRootElement(), message,name) end end end end addCommandHandler("event",events) Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
DarkByte Posted July 6, 2016 Author Posted July 6, 2016 It's the same, suddenly disappers When I hear someone saying Mac is better than PC. w0t?w0t? w0t? Great minds discuss ideas, average minds discuss events and small minds discuss people.
Captain Cody Posted July 6, 2016 Posted July 6, 2016 Seams to be nothing wrong with the code. Are you sure you copied Client side correctly?
DarkByte Posted July 7, 2016 Author Posted July 7, 2016 It disappears instantly but everything works... When I hear someone saying Mac is better than PC. w0t?w0t? w0t? Great minds discuss ideas, average minds discuss events and small minds discuss people.
Walid Posted July 7, 2016 Posted July 7, 2016 It disappears instantly but everything works... Just remove setTimer function here: Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
DarkByte Posted July 7, 2016 Author Posted July 7, 2016 When I hear someone saying Mac is better than PC. w0t?w0t? w0t? Great minds discuss ideas, average minds discuss events and small minds discuss people.
DarkByte Posted July 7, 2016 Author Posted July 7, 2016 Fixed it, thanks for help When I hear someone saying Mac is better than PC. w0t?w0t? w0t? Great minds discuss ideas, average minds discuss events and small minds discuss people.
Walid Posted July 7, 2016 Posted July 7, 2016 -- Client side -- output event stuff function output (text,name) if text and name then t , n = text , name addEventHandler ( "onClientRender", getRootElement(), drawEvent) setTimer(removeEventDraw,10000,1) end end addEvent("sendText", true) addEventHandler("sendText", getRootElement(), output) -- remove draw event after 10 seconds function removeEventDraw () removeEventHandler ( "onClientRender", getRootElement(), drawEvent ) end -- draw event message local screenW, screenH = guiGetScreenSize ( ) function drawEvent() dxDrawText(t.."[Hosted by "..n.."]", screenW*(280/1980), 30, screenW*(280/1980), 30, tocolor(254, 254, 254, 255), 1,"default", "center", "top", false, false, true, true, false) end --Server side: function events(thePlayer,_, ...) local nametags_Players = getElementsByType('player') if exports.staff:isPlayerStaff(thePlayer) then for i,allPlayers in ipairs(nametags_Players) do local message = table.concat({...}, ' ') if message and message ~= "" then local name = getPlayerName(thePlayer) triggerClientEvent(allPlayers, "sendText", getRootElement(), message,name) end end end end addCommandHandler("event",events) Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
DarkByte Posted July 7, 2016 Author Posted July 7, 2016 Helped me a lot thanks When I hear someone saying Mac is better than PC. w0t?w0t? w0t? Great minds discuss ideas, average minds discuss events and small minds discuss people.
Walid Posted July 7, 2016 Posted July 7, 2016 Helped me a lot thanks You are welcome Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
DarkByte Posted July 7, 2016 Author Posted July 7, 2016 One more thing, the text length goes straight but i want to go in rows, here's an example. How i want to draw it.. When I hear someone saying Mac is better than PC. w0t?w0t? w0t? Great minds discuss ideas, average minds discuss events and small minds discuss people.
Walid Posted July 7, 2016 Posted July 7, 2016 you can use sth like this -- Example: local example = "an example string" for i in string.gmatch(example, "%S+") do outputChatBox(i) end Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
DarkByte Posted July 7, 2016 Author Posted July 7, 2016 I want to toggle the control false if the data is true but it wont work... g_ArmedVehicles = { [425] = true, [447] = true, [520] = true, [430] = false, [464] = false, [432] = true } function checkNoDMGreen () if g_ArmedVehicles[getPedOccupiedVehicle(source)] and getElementData(source,"invincible",true) or getElementData(source,"green", true) then toggleControl(player, 'vehicle_fire', false) toggleControl(player, 'vehicle_secondary_fire', false) end end setTimer(checkNoDMGreen,100,0) When I hear someone saying Mac is better than PC. w0t?w0t? w0t? Great minds discuss ideas, average minds discuss events and small minds discuss people.
Walid Posted July 7, 2016 Posted July 7, 2016 didn't work because: source: not defined in your code. player: same thing with player. Try to use "onPlayerVehicleEnter" or just get a table of all the vehicles that exist and loop through it. Example: local g_ArmedVehicles = {[425] = true,[447] = true,[520] = true,[430] = false,[464] = false,[432] = true} function checkNoDMGreen() local vehicles = getElementsByType ( "vehicle" ) for _, vehicle in ipairs(vehicles) do if g_ArmedVehicles[getElementModel(vehicle)] then local invicsible = getElementData(vehicle,"invincible") local green = getElementData(vehicle,"green") if invicible or green then local player = getVehicleController (vehicle) if player then toggleControl(player, 'vehicle_fire', false) toggleControl(player, 'vehicle_secondary_fire', false) end end end end end setTimer(checkNoDMGreen,100,0) Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
DarkByte Posted July 7, 2016 Author Posted July 7, 2016 Didnt work.. When I hear someone saying Mac is better than PC. w0t?w0t? w0t? Great minds discuss ideas, average minds discuss events and small minds discuss people.
Walid Posted July 7, 2016 Posted July 7, 2016 Didnt work.. working fine for me check your elementData. Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
DarkByte Posted July 7, 2016 Author Posted July 7, 2016 I'm not setting data on vehicle, i'm setting the data on player. When I hear someone saying Mac is better than PC. w0t?w0t? w0t? Great minds discuss ideas, average minds discuss events and small minds discuss people.
Walid Posted July 7, 2016 Posted July 7, 2016 I'm not setting data on vehicle, i'm setting the data on player. check your code as i can see source == vehicle. anyways try this: local g_ArmedVehicles = {[425] = true,[447] = true,[520] = true,[430] = false,[464] = false,[432] = true} function checkNoDMGreen() local vehicles = getElementsByType ( "vehicle" ) for _, vehicle in ipairs(vehicles) do if g_ArmedVehicles[getElementModel(vehicle)] then local player = getVehicleController (vehicle) if player then -- check elementData here then usetoggleControl toggleControl(player, 'vehicle_fire', false) toggleControl(player, 'vehicle_secondary_fire', false) end end end end setTimer(checkNoDMGreen,100,0) Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
DarkByte Posted July 7, 2016 Author Posted July 7, 2016 works When I hear someone saying Mac is better than PC. w0t?w0t? w0t? Great minds discuss ideas, average minds discuss events and small minds discuss people.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now