-
Posts
1,273 -
Joined
-
Last visited
-
Days Won
1
Everything posted by GTX
-
Then why do you use an export function to official scoreboard? I can't help you, I don't know anything about DayZ.
-
exports.scoreboard:addScoreboardColumn('Zombie kills') addEvent("onBotWasted",true) addEventHandler("onBotWasted",root, function (killer) givePlayerMoney(killer,50) addPlayerZombieKills(killer) end) function addPlayerZombieKills(killer) local account = getPlayerAccount(killer) if isGuestAccount(account) then return end local zombieKills = getAccountData(account,"Zombie kills") if not zombieKills then setAccountData(account,"Zombie kills",0) end setAccountData(account,"Zombie kills",tonumber(zombieKills)+1) setElementData(killer, "Zombie kills", tonumber(zombieKills)+1) end addEventHandler("onPlayerLogin",root, function () local account = getPlayerAccount(source) if isGuestAccount(account) then return end local zombieKills = getAccountData(account,"Zombie kills") if zombieKills then setElementData(source,"Zombie kills",tostring(zombieKills)) else setElementData(source,"Zombie kills",0) end end)
-
I'm sorry for that. I edited my previous post.
-
Second argument is optional. It's root by default if the second argument is nil.
-
exports.scoreboard:addScoreboardColumn('Zombie kills') addEvent("onZombieWasted",true) addEventHandler("onZombieWasted",root, function (killer) givePlayerMoney(killer,50) addPlayerZombieKills(killer) end) function addPlayerZombieKills(killer) local account = getPlayerAccount(killer) if isGuestAccount(account) then return end local zombieKills = getAccountData(account,"Zombie kills") if not zombieKills then setAccountData(account,"Zombie kills",0) end setAccountData(account,"Zombie kills",tonumber(zombieKills)+1) setElementData(killer, "Zombie kills", tonumber(zombieKills)+1) end addEventHandler("onPlayerLogin",root, function () local account = getPlayerAccount(source) if isGuestAccount(account) then return end local zombieKills = getAccountData(account,"Zombie kills") if zombieKills then setElementData(source,"Zombie kills",tostring(zombieKills)) else setElementData(source,"Zombie kills",0) end end)
-
guns = { {22, 7}, {24, 30}, {28, 14}, {29, 17}, {32, 11}, {25, 40}, {26, 50}, {27, 65}, {30, 22}, {31, 27}, {33, 73}, {34, 60}, {23, 80}, {44, 500}, {45, 500}, {46, 500}, {8, 200000}, } overrideName = { {"Sub machine gun", "Your name"} } addEventHandler( "onClientResourceStart", getRootElement( ), function ( startedRes ) if startedRes == getThisResource() then createGunMenu() end end ); m = { } local rootNode = xmlLoadFile( "shops.xml" ) local markNodes = xmlNodeGetChildren(rootNode) for i,node in ipairs(markNodes) do local attr = xmlNodeGetAttributes( node ) local theMarker = createMarker(attr["posX"],attr["posY"],attr["posZ"],"corona",2,255,0,0,255) setElementInterior(theMarker,attr["interior"]) if attr["pedSkinID"] then thePed = createPed( attr["pedSkinID"], attr["pedX"],attr["pedY"],attr["pedZ"] ) setElementInterior(thePed,attr["interior"]) setElementRotation(thePed,0,0,attr["pedR"]) end m[i] = { theMarker, thePed } end function showGunMenu(hitPlayer) if hitPlayer == localPlayer then for i,v in ipairs(m) do if source == v[1] then g_px, g_py, g_pz = getElementPosition(v[2]) playSFX3D ( "spc_fa", 13, math.random(60,72), g_px, g_py, g_pz ) end end guiSetVisible(guiWdw, true) triggerServerEvent ("span",localPlayer) showCursor(true) end end for i,v in ipairs(m) do addEventHandler("onClientMarkerHit",v[1],showGunMenu) end function createGunMenu() guiWdw = guiCreateWindow ( 379, 208, 602, 370, "Buhonero", false ) gunList = guiCreateGridList ( 0.05, 0.05, 0.3, 0.9, true, guiWdw ) colGun = guiGridListAddColumn( gunList, "Gun", 0.5 ) colCost = guiGridListAddColumn( gunList, "Costbullet", 0.5 ) btnDiscard = guiCreateButton(0.4, 0.8, 0.15, 0.15, "Descartar", true, guiWdw) btnClose = guiCreateButton(0.6, 0.8, 0.15, 0.15, "Cerrar", true, guiWdw) btnBuy = guiCreateButton(0.8, 0.8, 0.15, 0.15, "Comprar/Buy.", true, guiWdw) btnAdd = guiCreateButton(0.8, 0.1, 0.15, 0.1, "Añadir/Add", true, guiWdw) editAmount = guiCreateEdit (0.4, 0.1, 0.35, 0.1, "Ammo", true, guiWdw) guiWindowSetSizable( guiWdw, false) guiSetVisible(guiWdw, false) addEventHandler("onClientGUIClick", btnClose, clientSubmitClose, false) addEventHandler("onClientGUIClick", btnDiscard, clientSubmitDiscard, false) addEventHandler("onClientGUIClick", btnBuy, clientSubmitBuy, false) addEventHandler("onClientGUIClick", btnAdd, clientSubmitCart, false) for p,v in ipairs(guns) do row = guiGridListAddRow ( gunList ) for i=1, #overrideName do if getWeaponNameFromID(v[1]) == overrideName[i][1] then guiGridListSetItemText ( gunList, row, colGun, overrideName[i][2], false, false ) break else guiGridListSetItemText ( gunList, row, colGun, getWeaponNameFromID(v[1]), false, false ) end end guiGridListSetItemText ( gunList, row, colCost, v[2], false, false ) end cart = guiCreateGridList ( 0.4, 0.25, 0.55, 0.5, true, guiWdw ) colOrdGun = guiGridListAddColumn( cart, "Arma pedida", 0.33 ) colOrdAmmo = guiGridListAddColumn( cart, "Ammo", 0.33 ) colOrdCost = guiGridListAddColumn( cart, "Coste", 0.33 ) end addEvent ("guichanger",true) addEventHandler ("guichanger", getRootElement(), function() guiSetText (guiWdw,"Weapons Dealer") guiSetText (btnDiscard,"Discard") guiSetText (btnClose,"Close") guiSetText (btnAdd,"Add") guiSetText (btnBuy,"Buy") guiSetText (colOrdGun,"Weapon") guiSetText (colOrdAmmo,"Ammo") guiSetText (colOrdCost,"Cost") end) addEvent ("guichanger2",true) addEventHandler ("guichanger2", getRootElement(), function() guiSetText (guiWdw,"Vendedor de armas") guiSetText (btnDiscard,"Descartar") guiSetText (btnClose,"Cerrar") guiSetText (btnAdd,"Añadir") guiSetText (btnBuy,"Comprar") guiSetText (colOrdGun,"Arma") guiSetText (colOrdAmmo,"Munición") guiSetText (colOrdCost,"Coste") end) function clientSubmitBuy(button,state) if button == "left" and state == "up" then local rowCount = guiGridListGetRowCount ( cart ) local ordCost = 0 for i=0,rowCount-1,1 do ordCost = ordCost + guiGridListGetItemText ( cart, i, 3 ) end local playerMoney = getPlayerMoney() if playerMoney < ordCost then outputChatBox( "No te lo puedes permitir, necesitas $" .. ordCost .. "!" ) else guiSetText ( editAmount, "" ) guiSetInputEnabled(false) guiSetVisible(guiWdw, false) showCursor(false) for i=0,rowCount-1 do local ordGunName = guiGridListGetItemText ( cart, 0, 1 ) local ordGunAmmo = guiGridListGetItemText ( cart, 0, 2 ) local ordGunCost = guiGridListGetItemText ( cart, 0, 3 ) for i=1, #overrideName do if overrideName[i][2] == ordGunName then ordGunName = overrideName[i][1] break end end triggerServerEvent( "onClientGiveWeapon", getLocalPlayer(), ordGunName, ordGunAmmo, ordGunCost ) guiGridListRemoveRow(cart,0) end if rowCount > 0 then playSFX3D ( "spc_fa", 13, math.random(8,17), g_px, g_py, g_pz ) end end end end function clientSubmitCart(button,state) if button == "left" and state == "up" then local gunName = guiGridListGetItemText ( gunList, guiGridListGetSelectedItem(gunList), 1 ) local ammo = guiGetText(editAmount) local cost = ammo * guiGridListGetItemText ( gunList, guiGridListGetSelectedItem(gunList), 2 ) guiSetText ( editAmount, "" ) local row = guiGridListAddRow ( cart ) guiGridListSetItemText ( cart, row, colOrdGun, gunName, false, false ) guiGridListSetItemText ( cart, row, colOrdAmmo, ammo, false, false ) guiGridListSetItemText ( cart, row, colOrdCost, cost, false, false ) end end function clientSubmitClose(button,state) if button == "left" and state == "up" then guiSetText ( editAmount, "" ) guiSetInputEnabled(false) guiSetVisible(guiWdw, false) showCursor(false) local rowCount = guiGridListGetRowCount(cart) if rowCount > 0 then for i=0,rowCount-1 do guiGridListRemoveRow(cart,0) end end end end function clientSubmitDiscard(button,state) if button == "left" and state == "up" then local ar,ac = guiGridListGetSelectedItem(cart) guiGridListRemoveRow ( cart, ar ) end end
-
Check overrideName table. Put real gun names in first index, in the second, your desired name. guns = { {22, 7}, {24, 30}, {28, 14}, {29, 17}, {32, 11}, {25, 40}, {26, 50}, {27, 65}, {30, 22}, {31, 27}, {33, 73}, {34, 60}, {23, 80}, {44, 500}, {45, 500}, {46, 500}, {8, 200000}, } overrideName = { {"Sub machine gun", "Your name"} } addEventHandler( "onClientResourceStart", getRootElement( ), function ( startedRes ) if startedRes == getThisResource() then createGunMenu() end end ); m = { } local rootNode = xmlLoadFile( "shops.xml" ) local markNodes = xmlNodeGetChildren(rootNode) for i,node in ipairs(markNodes) do local attr = xmlNodeGetAttributes( node ) local theMarker = createMarker(attr["posX"],attr["posY"],attr["posZ"],"corona",2,255,0,0,255) setElementInterior(theMarker,attr["interior"]) if attr["pedSkinID"] then thePed = createPed( attr["pedSkinID"], attr["pedX"],attr["pedY"],attr["pedZ"] ) setElementInterior(thePed,attr["interior"]) setElementRotation(thePed,0,0,attr["pedR"]) end m[i] = { theMarker, thePed } end function showGunMenu(hitPlayer) if hitPlayer == localPlayer then for i,v in ipairs(m) do if source == v[1] then g_px, g_py, g_pz = getElementPosition(v[2]) playSFX3D ( "spc_fa", 13, math.random(60,72), g_px, g_py, g_pz ) end end guiSetVisible(guiWdw, true) triggerServerEvent ("span",localPlayer) showCursor(true) end end for i,v in ipairs(m) do addEventHandler("onClientMarkerHit",v[1],showGunMenu) end function createGunMenu() guiWdw = guiCreateWindow ( 379, 208, 602, 370, "Buhonero", false ) gunList = guiCreateGridList ( 0.05, 0.05, 0.3, 0.9, true, guiWdw ) colGun = guiGridListAddColumn( gunList, "Gun", 0.5 ) colCost = guiGridListAddColumn( gunList, "Costbullet", 0.5 ) btnDiscard = guiCreateButton(0.4, 0.8, 0.15, 0.15, "Descartar", true, guiWdw) btnClose = guiCreateButton(0.6, 0.8, 0.15, 0.15, "Cerrar", true, guiWdw) btnBuy = guiCreateButton(0.8, 0.8, 0.15, 0.15, "Comprar/Buy.", true, guiWdw) btnAdd = guiCreateButton(0.8, 0.1, 0.15, 0.1, "Añadir/Add", true, guiWdw) editAmount = guiCreateEdit (0.4, 0.1, 0.35, 0.1, "Ammo", true, guiWdw) guiWindowSetSizable( guiWdw, false) guiSetVisible(guiWdw, false) addEventHandler("onClientGUIClick", btnClose, clientSubmitClose, false) addEventHandler("onClientGUIClick", btnDiscard, clientSubmitDiscard, false) addEventHandler("onClientGUIClick", btnBuy, clientSubmitBuy, false) addEventHandler("onClientGUIClick", btnAdd, clientSubmitCart, false) for p,v in ipairs(guns) do row = guiGridListAddRow ( gunList ) for i=1, #overrideName do if getWeaponNameFromID(v[1]) == overrideName[i][1] then guiGridListSetItemText ( gunList, row, colGun, overrideName[i][2], false, false ) else guiGridListSetItemText ( gunList, row, colGun, getWeaponNameFromID(v[1]), false, false ) end end guiGridListSetItemText ( gunList, row, colCost, v[2], false, false ) end cart = guiCreateGridList ( 0.4, 0.25, 0.55, 0.5, true, guiWdw ) colOrdGun = guiGridListAddColumn( cart, "Arma pedida", 0.33 ) colOrdAmmo = guiGridListAddColumn( cart, "Ammo", 0.33 ) colOrdCost = guiGridListAddColumn( cart, "Coste", 0.33 ) end addEvent ("guichanger",true) addEventHandler ("guichanger", getRootElement(), function() guiSetText (guiWdw,"Weapons Dealer") guiSetText (btnDiscard,"Discard") guiSetText (btnClose,"Close") guiSetText (btnAdd,"Add") guiSetText (btnBuy,"Buy") guiSetText (colOrdGun,"Weapon") guiSetText (colOrdAmmo,"Ammo") guiSetText (colOrdCost,"Cost") end) addEvent ("guichanger2",true) addEventHandler ("guichanger2", getRootElement(), function() guiSetText (guiWdw,"Vendedor de armas") guiSetText (btnDiscard,"Descartar") guiSetText (btnClose,"Cerrar") guiSetText (btnAdd,"Añadir") guiSetText (btnBuy,"Comprar") guiSetText (colOrdGun,"Arma") guiSetText (colOrdAmmo,"Munición") guiSetText (colOrdCost,"Coste") end) function clientSubmitBuy(button,state) if button == "left" and state == "up" then local rowCount = guiGridListGetRowCount ( cart ) local ordCost = 0 for i=0,rowCount-1,1 do ordCost = ordCost + guiGridListGetItemText ( cart, i, 3 ) end local playerMoney = getPlayerMoney() if playerMoney < ordCost then outputChatBox( "No te lo puedes permitir, necesitas $" .. ordCost .. "!" ) else guiSetText ( editAmount, "" ) guiSetInputEnabled(false) guiSetVisible(guiWdw, false) showCursor(false) for i=0,rowCount-1 do local ordGunName = guiGridListGetItemText ( cart, 0, 1 ) local ordGunAmmo = guiGridListGetItemText ( cart, 0, 2 ) local ordGunCost = guiGridListGetItemText ( cart, 0, 3 ) triggerServerEvent( "onClientGiveWeapon", getLocalPlayer(), ordGunName, ordGunAmmo, ordGunCost ) guiGridListRemoveRow(cart,0) end if rowCount > 0 then playSFX3D ( "spc_fa", 13, math.random(8,17), g_px, g_py, g_pz ) end end end end function clientSubmitCart(button,state) if button == "left" and state == "up" then local gunName = guiGridListGetItemText ( gunList, guiGridListGetSelectedItem(gunList), 1 ) local ammo = guiGetText(editAmount) local cost = ammo * guiGridListGetItemText ( gunList, guiGridListGetSelectedItem(gunList), 2 ) guiSetText ( editAmount, "" ) local row = guiGridListAddRow ( cart ) guiGridListSetItemText ( cart, row, colOrdGun, gunName, false, false ) guiGridListSetItemText ( cart, row, colOrdAmmo, ammo, false, false ) guiGridListSetItemText ( cart, row, colOrdCost, cost, false, false ) end end function clientSubmitClose(button,state) if button == "left" and state == "up" then guiSetText ( editAmount, "" ) guiSetInputEnabled(false) guiSetVisible(guiWdw, false) showCursor(false) local rowCount = guiGridListGetRowCount(cart) if rowCount > 0 then for i=0,rowCount-1 do guiGridListRemoveRow(cart,0) end end end end function clientSubmitDiscard(button,state) if button == "left" and state == "up" then local ar,ac = guiGridListGetSelectedItem(cart) guiGridListRemoveRow ( cart, ar ) end end
-
Are you serious? Your last part is not tabulated and all wrong. The top is tabulated and correct. This is not your script. And why tonumber to a number? function toggleEngine ( key, keyState ) local data = getElementData ( source, "fuel" ) if getVehicleEngineState(source) == true then setVehicleEngineState ( source, false ) else if data == 0 then return end setVehicleEngineState ( source, true ) end end bindKey ( "j", "down", toggleEngine ) Correct: if tonumber(data) == 0 then Wrong and useless: if data == tonumber(0) then
-
Obviously, because you're iterating through string (which you can't). function showits(player) if isElement(player) then triggerClientEvent(player,"showit",player,Table) end end addCommandHandler("showit",showits) function addWordToGridList(Table) guiSetVisible(window1,true) for i=1, #Table do local row = guiGridListAddRow(gridlist1) guiGridListSetItemText (gridlist1, row, collumn1,tostring(Table[i]),false, false) end end addEvent("showit",true) addEventHandler("showit",root,addWordToGridList)
-
It's an easy workaround. local pedPos = { {2321.06, 36.8, 26.48,88, "John"}, {-553.84, 2594, 53.93,258, "Banana"}, {-1969.19, -2427.74, 30.63,233, "Dr. Who"} } local skins = {73,179} local peds = {} local blips = {} addEventHandler("onClientResourceStart", resourceRoot, function() for i=1, # peds do peds[i] = createPed(skins[math.random(1, #skins)], traderpPos[i][1], traderpPos[i][2], traderpPos[i][3]) if peds[i] then blips[i] = createBlip(traderpPos[i][1], traderpPos[i][2], traderpPos[i][3]) setElementData(blips[i], "name", traderpPos[i][5]) setElementData(blips[i], "color", {255, 255, 255}) setElementFrozen(traders[i], true) if pedPos[i][4] then setPedRotation( pedsi], pedPos[i][4]) end end end end )
-
Just do an admin check in your script.
-
This should do. addEvent ( "onClientUserSettingChange", true ) addEventHandler ( "onClientUserSettingChange", root, function ( g, v ) if ( g == "usersettings_usetopbar" ) then if not tobool ( v ) and useTopbar then useTopbar = false removeEventHandler ( "onClientRender", root, dxDrawNotificationBar ) elseif tobool ( v ) and not useTopbar then useTopbar = true addEventHandler ( "onClientRender", root, dxDrawNotificationBar ) end elseif ( g == "usersetting_notification_joinquitmessages" ) then joinquit = v elseif ( g == "usersetting_notification_nickchangemessages" ) then namechanges = v end end ) local maxMessages = 5; local DefaultTime = 8; local moveSpeed = 2; local sx, sy = guiGetScreenSize ( ) local DefaultPos = true; local messages_top = { } local toDo = { } local messageDelay = 500 local TheResourceName = getResourceName ( getThisResource ( ) ) local lastAutoMessage = 1 local t = 0 function sendClientMessage ( msg, r, g, b, img, checkImgPath ) local found = false for i, v in pairs(messages_top) do local msgs = unpack(v, 1, 1) if msg == msgs then found = true break end end if found == true then return end if ( checkImgPath == nil ) then checkImgPath = true; end if ( img and sourceResource and checkImgPath ) then img = ":"..tostring(getResourceName(sourceResource)).."/"..img; end return _sendClientMessage ( msg, r, g, b, img ); end function _sendClientMessage ( msg, r, g, b, img ) if ( useTopbar ) then if ( not exports.NGLogin:isClientLoggedin ( ) ) then return end local msg, r, g, b = tostring ( msg ), tonumber ( r ) or 255, tonumber ( g ) or 255, tonumber ( b ) or 255 local img = img or ""; if ( img ~= "" and not fileExists ( img ) ) then img = "" end local data = { msg, r, g, b, getTickCount ( ) + DefaultTime*1000, -25, true, img } if ( getTickCount ( ) - t >= messageDelay ) then table.insert ( messages_top, data ) t = getTickCount ( ) else table.insert ( toDo, data ) end else outputChatBox ( msg, r, g, b ) end end addEvent ( TheResourceName..":sendClientMessage", true ) addEventHandler ( TheResourceName..":sendClientMessage", root, _sendClientMessage ) local width = (sx/1.95) local t2 = getTickCount ( ) function dxDrawNotificationBar ( ) if ( #toDo > 0 and getTickCount ( ) -t >= messageDelay ) then local d = toDo[1] d[5] = getTickCount ( ) + DefaultTime*1000 table.insert ( messages_top, d ) table.remove ( toDo, 1 ) t = getTickCount ( ) end local doRemove = { } for i, v in pairs ( messages_top ) do local i = i - 1 local msg, r, g, b, rTime, y = unpack ( v ) local continue = true if ( rTime < getTickCount ( ) and v[7] ) then messages_top[i+1][7] = false end if ( v[7] ) then if ( messages_top[i] ) then toY = messages_top[i][6] + 25 else toY = 0 end if ( y ~= toY ) then if ( y < toY ) then y = y + moveSpeed if ( y > toY ) then y = toY end else y = y - moveSpeed if ( y < toY ) then y = toY end end else if ( #messages_top > maxMessages ) then messages_top[1][5] = 0 messages_top[1][7] = false end end else y = y - moveSpeed if ( y < -25 ) then continue = false end end messages_top[i+1][6] = y local lColor = tocolor ( 0, 0, 0, 255 ) dxDrawRectangle ( (sx/2-width/2), rsy*y, width, rsy*25, tocolor ( 0, 0, 0, 120 ) ) dxDrawLine ( (sx/2-width/2), rsy*y, (sx/2-width/2)+width, rsy*y, lColor ) dxDrawLine ( (sx/2-width/2), rsy*y, (sx/2-width/2), rsy*(y+25), lColor ) dxDrawLine ( (sx/2+width/2), rsy*y, (sx/2+width/2), rsy*(y+25), lColor ) dxDrawLine ( (sx/2+width/2)-width, rsy*(y+25), (sx/2+width/2), rsy*(y+25), lColor ) if ( v[8] and v[8] ~= "" ) then dxDrawImage ( (sx/2-width/2)+3, (rsy*y)+2, rsx*21, rsy*21, v[8] ); dxDrawImage ( (sx/2-width/2)+(width-25), (rsy*y)+2, rsx*21, rsy*21, v[8] ); end dxDrawText ( v[1], 0, rsy*y, sx, rsy*(y+25), tocolor ( v[2], v[3], v[4], 255 ), rsx*1, "default-bold", "center", "center", true, false, false, true ) if ( not continue ) then table.insert ( doRemove, i+1 ) end end if ( #doRemove > 0 ) then for i, v in ipairs ( doRemove ) do if ( messages_top [ v ] ) then table.remove ( messages_top, v ) end end end end addEventHandler ( "onClientRender", root, dxDrawNotificationBar ) function tobool ( input ) local input = tostring ( input ):lower ( ) if ( input == "true" ) then return true elseif ( input == "false" ) then return false else return nil end end
-
That's not the full code, I guess. And try make it yourself.
-
You're saying I didn't help you? Well, yeah, it was mostly because your English sucked and I suggested you to go to Spanish forums. Stop creating new topics, you have the old one, reply to it, bump it. And learn some English please... There you go: First you have to drop the table: executeSQLQuery("DROP TABLE LogAdmin") Client: logadmin = guiCreateGridList(0.01, 0.04, 0.70, 0.91, true, TabTest2) logadmid = guiGridListAddColumn(logadmin, "ID", 0.03) logadm1 = guiGridListAddColumn(logadmin, "Fecha", 0.1) logadm2 = guiGridListAddColumn(logadmin, "Admin", 0.3) logadm3 = guiGridListAddColumn(logadmin, "Premio", 0.3) logadm4 = guiGridListAddColumn(logadmin, "Cantidad", 0.3) logadm5 = guiGridListAddColumn(logadmin, "Selecc/Todos", 0.3) logadm6 = guiGridListAddColumn(logadmin, "Jugador", 0.3) borrarselec = guiCreateButton(0.73, 0.24, 0.13, 0.09, "Borrar Seleccionado", true, TabTest2) function onbtn() if source == borrarselec then borrarlogadmin() end end addEventHandler("onClientGUIClick", root, onbtn) function veryaellogad(tab) guiGridListClear(logadmin) for i, gs in pairs(tab) do local row = guiGridListAddRow(logadmin) guiGridListSetItemText(logadmin, row,logadmid, gs.id, false, true) guiGridListSetItemText(logadmin, row,logadm1, gs.Fecha, false, true) guiGridListSetItemText(logadmin, row,logadm2, gs.Admin, false, true) guiGridListSetItemText(logadmin, row,logadm3, gs.Premio, false, true) guiGridListSetItemText(logadmin, row,logadm4, gs.Cantidad, false, true) guiGridListSetItemText(logadmin, row,logadm5, gs.SelecTodos, false, true) guiGridListSetItemText(logadmin, row,logadm6, gs.Jugador, false, true) end end addEvent("veryaellog", true) addEventHandler("veryaellog", root, veryaellogad) function borrarlogadmin() local id = guiGridListGetItemText(logadmin, guiGridListGetSelectedItem(logadmin), 1) if id and id ~= -1 then triggerServerEvent("borrarlogadmin", localPlayer, id) end end triggerServerEvent("VerLogAdmin", localPlayer) Server: executeSQLQuery("CREATE TABLE IF NOT EXISTS LogAdmin (id INTEGER PRIMARY KEY, Fecha TEXT, Admin TEXT, Premio TEXT,Cantidad TEXT,SelecTodos TEXT,Jugador TEXT)") function VerLogAdmin() tablodelgadmin = executeSQLQuery("SELECT * FROM LogAdmin") triggerClientEvent (source,"veryaellog",source,tablodelgadmin) end addEvent ("VerLogAdmin", true) addEventHandler ("VerLogAdmin", root, VerLogAdmin) addEvent("borrarlogadmin", true) function borrarlogadmin(id) if id then executeSQLQuery("DELETE FROM LogAdmin WHERE id='"..id.."'") VerLogAdmin() end end addEventHandler("borrarlogadmin", root, borrarlogadmin)
-
Still don't understand you. Show a "rectangle" on the map: createRadarArea Remove rectangle: local textFont = "sans" local textScale = 0.8 local heightPadding = 1 local widthPadding = 1 local xOffset = 5 local minAlpha = 10 local textAlpha = 255 local rectangleColor = tocolor(0,0,0,155) local floor = math.floor local w,h = guiGetScreenSize() local function drawMapStuff() if isPlayerMapVisible() then local sx,sy,ex,ey = getPlayerMapBoundingBox() local mw,mh = ex-sx,sy-ey local cx,cy = (sx+ex)/2,(sy+ey)/2 local ppuX,ppuY = mw/6000,mh/6000 local fontHeight = dxGetFontHeight(textScale,textFont) local yOffset = fontHeight/2 local blips = getElementsByType("blip") for k,v in ipairs(blips) do local px,py = getElementPosition(v) local x = floor(cx+px*ppuX+xOffset) local y = floor(cy+py*ppuY-yOffset) local jname = getElementData(v,"name") or "" local nameLength = dxGetTextWidth(jname,textScale,textFont) local r,g,b = unpack(getElementData(v,"color") or {255, 255, 255}) if getBlipIcon(v) == 23 then r, g, b = 0, 255, 0 jname = "whatever you want" elseif getBlipIcon(v) == 42 then r, g, b = 255, 0, 0 jname = "whatever you want 2" end local _,_,_,a = getBlipColor(v) if a>minAlpha then dxDrawText(jname,x,y,x+nameLength,y+fontHeight,tocolor(r,g,b,textAlpha),textScale,textFont,"left","top",false,false,false,true) end end end end addEventHandler("onClientRender",getRootElement(),drawMapStuff)
-
I was thinking of that also, they're truly a bit much seperate. So, nope, it's not your server.
-
I don't understand you. Keep trying. It's all about maths.
-
Just... Use this: local textFont = "sans" local textScale = 0.8 local heightPadding = 1 local widthPadding = 1 local xOffset = 5 local minAlpha = 10 local textAlpha = 255 local rectangleColor = tocolor(0,0,0,155) local floor = math.floor local w,h = guiGetScreenSize() local function drawMapStuff() if isPlayerMapVisible() then local sx,sy,ex,ey = getPlayerMapBoundingBox() local mw,mh = ex-sx,sy-ey local cx,cy = (sx+ex)/2,(sy+ey)/2 local ppuX,ppuY = mw/6000,mh/6000 local fontHeight = dxGetFontHeight(textScale,textFont) local yOffset = fontHeight/2 local blips = getElementsByType("blip") for k,v in ipairs(blips) do local px,py = getElementPosition(v) local x = floor(cx+px*ppuX+xOffset) local y = floor(cy+py*ppuY-yOffset) local jname = getElementData(v,"name") or "" local nameLength = dxGetTextWidth(jname,textScale,textFont) local r,g,b = unpack(getElementData(v,"color") or {255, 255, 255}) if getBlipIcon(v) == 23 then r, g, b = 0, 255, 0 jname = "whatever you want" elseif getBlipIcon(v) == 42 then r, g, b = 255, 0, 0 jname = "whatever you want 2" end local _,_,_,a = getBlipColor(v) if a>minAlpha then dxDrawRectangle(x-widthPadding,y+heightPadding,nameLength+widthPadding*2,fontHeight-heightPadding*1,rectangleColor,false) dxDrawText(jname,x,y,x+nameLength,y+fontHeight,tocolor(r,g,b,textAlpha),textScale,textFont,"left","top",false,false,false,true) end end end end addEventHandler("onClientRender",getRootElement(),drawMapStuff)
-
Good job! MTA has changed a lot since I joined, of course, in a good way!
-
They do have collisions. We can't help you there. http://prntscr.com/7t69vn
-
The text should be colored, the rectangle is black at all times. Which do you want it colored? Rectangle or the text? EDIT: If it works for me, it should work for you. (http://prntscr.com/7t60f1) This is the code I used: local textFont = "sans" local textScale = 0.8 local heightPadding = 1 local widthPadding = 1 local xOffset = 5 local minAlpha = 10 local textAlpha = 255 local rectangleColor = tocolor(0,0,0,155) local floor = math.floor local w,h = guiGetScreenSize() local function drawMapStuff() if isPlayerMapVisible() then local sx,sy,ex,ey = getPlayerMapBoundingBox() local mw,mh = ex-sx,sy-ey local cx,cy = (sx+ex)/2,(sy+ey)/2 local ppuX,ppuY = mw/6000,mh/6000 local fontHeight = dxGetFontHeight(textScale,textFont) local yOffset = fontHeight/2 local blips = getElementsByType("blip") for k,v in ipairs(blips) do local px,py = getElementPosition(v) local x = floor(cx+px*ppuX+xOffset) local y = floor(cy+py*ppuY-yOffset) local jname = getElementData(v,"name") or "none" local nameLength = dxGetTextWidth(jname,textScale,textFont) local r,g,b = unpack(getElementData(v,"color") or {255, 255, 255}) local _,_,_,a = getBlipColor(v) if a>minAlpha then dxDrawRectangle(x-widthPadding,y+heightPadding,nameLength+widthPadding*2,fontHeight-heightPadding*1,rectangleColor,false) dxDrawText(jname,x,y,x+nameLength,y+fontHeight,tocolor(r,g,b,textAlpha),textScale,textFont,"left","top",false,false,false,true) end end end end addEventHandler("onClientRender",getRootElement(),drawMapStuff)