-
Posts
1,273 -
Joined
-
Last visited
-
Days Won
1
Everything posted by GTX
-
What specifically do you want? Make meteor fall?
-
Debug your code. addEventHandler ("onPlayerWasted",getRootElement(), function(killer,weapon,bodypart) if killer then outputDebugString"killer found" if getElementData (killer,"hacedm") then outputChatBox ("En zonas de DM las recompensas de Mercenario están canceladas.",killer) return end if getElementData (killer,"oficiomercenario") then outputDebugString"mercenary data set for killer" if getPlayerMoney(source)<500 then setPlayerMoney (killer,getPlayerMoney(killer)+1000) outputChatBox ("¡Has matado a alguien y has recibido 1000$!",killer,255,0,0) return end local naombre = getPlayerName (source) setPlayerMoney (source,getPlayerMoney(source)-500) setPlayerMoney (killer,getPlayerMoney(killer)+1000) outputChatBox ("¡Has matado a alguien y has recibido 1000$!",killer,255,0,0) elseif getElementData (source,"oficiomercenario") then outputDebugString"data set for killed mercenary" if getPlayerMoney (source)<2000 then setPlayerMoney (killer,getPlayerMoney(killer)+1000) outputDebugString"less than 2000 money" return end setPlayerMoney (source,getPlayerMoney(source)-2000) setPlayerMoney (killer,getPlayerMoney(killer)+1000) outputDebugString"money set" end end end )
-
No, if you use it correctly. Use render targets, draw only when it's necessary.
-
An example: function createCurrentObject (player,cmd,objid) if getElementZoneName(player, true) == "Las Venturas" then if ( hasObjectPermissionTo ( player, "function.unbanSerial", true)) or (getElementData ( player, "permbuilder" ) == true) or (getElementData ( player, "tempbuilder" ) == true) then if playerobj[player] then outputChatBox ( "You are already editing an object. Please save or delete to make another.", player ) else local x, y, z = getElementPosition(player) destroyMObj (player) playerobj[player] = createObject(tonumber(objid), x + 5, y + 5, z - 1) if marker[player] then destroyElement(marker[player]) end if playerobj[player] then marker[player] = createMarker ( x, y, z, "arrow", 5, 255, 255, 0, 255) attachElementToElement ( marker[player], playerobj[player], 0, 0, 10) else outputChatBox ( "" ..objid.. " does not appear to be a valid model ID.", player ) end end else outputChatBox ( "You do not have permission to build.", player ) end end end addCommandHandler( "mcreate", createCurrentObject )
-
They're using their own scoreboard, not default.
-
https://wiki.multitheftauto.com/wiki/OOP_Basis https://wiki.multitheftauto.com/wiki/OOP_Introduction
-
requestBrowserDomains({"fbcdn.net"})
-
Well, I don't think that's possible. You can try it like this: exports.scoreboard:addScoreboardColumn('Home') exports.scoreboard:addScoreboardColumn('Home2') addEventHandler("onPlayerJoin", root, function() local country = exports.admin:getPlayerCountry(source) local flag = ":admin/client/images/flags/"..country..".png" setElementData(source, "Home", {type = "image", src = flag, height = 12, width = 16}) setElementData(source, "Home2", country or "N/A") end )
-
Because you didn't whitelist it... You mean some components in Facebook do not load? That's because Facebook has different servers for images, videos etc. Whitelist fbcdn.net.
-
It's nothing related to javascript. Javascript is fine.
-
triggerLatentClientEvent loadstring
-
Check if it is whitelisted. Note that CEF isn't stable yet. Still has some issues.
-
exports.scoreboard:addScoreboardColumn('Home') addEventHandler("onPlayerJoin", root, function() local country = exports.admin:getPlayerCountry(source) local flag = ":admin/client/images/flags/"..country..".png" setElementData(source, "Home", {type = "image", src = flag, height = 12, width = 16}) end )
-
It's not possible, because armor stat has no flag in GTA, never noticed it. You can make your own.
-
for i,veh in ipairs(patriotSpawns) do local x,y,z = veh[1],veh[2],veh[3] veh = createVehicle(470,x,y,z) vehCol = createColSphere(x,y,z,2.5) attachElements ( vehCol, veh, 0, 0, 0 ) setElementData(vehCol,"parent",veh) setElementData(veh,"parent",vehCol) setElementData(vehCol,"vehicle",true) setElementData(vehCol,"MAX_Slots",38) --Engine + Tires local tires,engine,parts = getVehicleAddonInfos (getElementModel(veh)) --setElementData(vehCol,"Tire_inVehicle",math.random(0,tires)) --setElementData(vehCol,"Engine_inVehicle",math.random(0,engine)) --setElementData(vehCol,"Parts_inVehicle",math.random(0,parts)) --vehicle_indentifikation setElementData(vehCol,"spawn",{470,x,y,z}) --others setElementData(vehCol,"fuel",10) for i,items in ipairs(lootItems["helicrashsides"]) do local randomNumber = math.random(1,10) if randomNumber == 5 then setElementData(vehCol,items[1],1) end end end
-
You must request for client to whitelist those. From requestBrowserDomains wiki example: requestBrowserDomains({ "mtasa.com" }) -- request browser domain showCursor(true) -- show cursor addEventHandler("onClientBrowserWhitelistChange", root, function(newDomains) if newDomains[1] == "mtasa.com" then local browser = createBrowser(1280, 720, false, false) -- create browser loadBrowserURL(browser, "https://mtasa.com/") -- load browser url end end )
-
function ponerPlayerList () if ( players ) then guiGridListClear(list) for id, player in ipairs(getElementsByType("player")) do if player ~= localPlayer and getPlayerTeam(player) and getTeamName(getPlayerTeam(player)) == "Criminals" then local row = guiGridListAddRow ( list ) guiGridListSetItemText ( list, row, players, getPlayerName ( player ), false, false ) end end end end
-
You have to sync it. Client: bindKey("H", "down", function() local vehicle = getPedOccupiedVehicle(localPlayer) local id = getElementModel (vehicle) local x, y, z = getElementPosition(vehicle) if ( vehicle ) and ( id == 425 ) then local dist = getElementDistanceFromCentreOfMassToBaseOfModel(vehicle) local offset = 2 local hit, _, _, _, hitElement = processLineOfSight(x, y, z-dist, x, y, z-dist-offset, false, true, false, false, false) if hit and getElementType(hitElement) == "vehicle" then outputChatBox("You attach "..getVehicleName(hitElement)) triggerServerEvent("attachVehicle", hitElement, vehicle) end end end ) Server: function attachVehicles(vehicle) attachElements(source, vehicle) end addEvent("attachVehicle", true) addEventHandler("attachVehicle", root, attachVehicles)
-
Client: local sx, sy = guiGetScreenSize() function makeGUI() vipGUI = guiCreateWindow((sx / 2) - (694 / 2), (sy / 2) - (526 / 2), 694, 526, "VIPs", false) guiWindowSetSizable(vipGUI , false) guiSetAlpha(vipGUI , 1.00) guiSetVisible(vipGUI, false) nameEdit = guiCreateEdit(9, 22, 152, 30, "", false, vipGUI) list = guiCreateGridList(9, 61, 670, 408, false, vipGUI) guiSetEnabled(nameEdit, false) guiGridListAddColumn(list, "Account", 0.7) guiGridListAddColumn(list, "Time", 0.1) closeBttn = guiCreateButton(11, 483, 668, 33, "Close This Window", false, vipGUI) addEventHandler("onClientGUIClick", closeBttn, function() guiSetVisible(vipGUI, false) showCursor(false) end, false) end addEventHandler("onClientResourceStart", resourceRoot, makeGUI) function showDonateMembers(d) guiSetVisible(vipGUI, true) showCursor(true) guiGridListClear(list) local online = 0 local online = 0 for ind, data in pairs(d) do online = online + 1 local row = guiGridListAddRow(list) local nTime = data - 1 if (nTime > 1) then data = nTime end guiGridListSetItemText(list, row, 1, tostring(ind), false, false) guiGridListSetItemText(list, row, 2, tostring(data), false, false) end guiSetText(nameEdit, "VIP Online: "..online) end addEvent("donate.showDonateMembers", true) addEventHandler("donate.showDonateMembers", root, showDonateMembers) Server: local donate = {} local allTimeDonate = {} local con = dbConnect("sqlite", "db/donate.db") dbExec(con, "CREATE TABLE IF NOT EXISTS donators (account TEXT, time TEXT)") function loadUsers(query) local data = dbPoll(query, 0) if (data) then for ind, d in ipairs(data) do allTimeDonate[d.account] = d.time if (d.account and getAccount(d.account) and getAccountPlayer(getAccount(d.account))) then donate[d.account] = tonumber(d.time) end end end end dbQuery(loadUsers, con, "SELECT * FROM donators") function isPlayerDonator(player) local account = getAccountName(getPlayerAccount(player)) return donate[account] end function addDonatorToDB(player, cmd, account, hours) if (not (hasObjectPermissionTo(player, "function.banPlayer", false))) then return end if (account and hours) then if (not getAccount(account)) then outputChatBox("No account with "..account.." as username", player, 2500, 0, 0) return end if (not tonumber(hours) or tonumber(hours) < 0) then outputChatBox(tostring(hours).." is an invalid hour specific", player, 2500, 0, 0) return end local plr = getAccountPlayer(getAccount(account)) if (not allTimeDonate[getAccount(account)]) then dbExec(con, "INSERT INTO donators (account, time) VALUES (?, ?)", tostring(account), tostring(hours)) donate[account] = tonumber(hours) if (tonumber(hours) == 0) then hours = "infinite" end outputDebugString(getPlayerName(player).. " added "..hours.." VIP hours to "..account) outputChatBox("Added "..hours.." VIP hours to "..account, player, 255, 150, 0) if (plr) then outputChatBox(getPlayerName(player).." added "..hours.." VIP hours to your account ("..account..")", plr, 0, 2500, 0) end end end end addCommandHandler("addvip", addDonatorToDB) function removeOfflineVIP(player, cmd, account) if (not (hasObjectPermissionTo(player, "function.kickPlayer", false))) then return end if (account) then if (not getAccount(account)) then outputChatBox("No account with "..account.." as username", player, 2500, 0, 0) return end if (donate[account]) then donate[account] = nil end if (allTimeDonate[account]) then allTimeDonate[account] = nil end dbExec(con, "DELETE FROM donators WHERE account=?", tostring(account)) outputDebugString(getPlayerName(player).. " removed account "..account.." from database") end end addCommandHandler("removevip", removeOfflineVIP) function makeDonateTick() for ind, d in pairs(donate) do if (ind and getAccount(ind)) then if (getAccountPlayer(getAccount(ind))) then if (donate[ind] and donate[ind] < 1 and donate[ind] ~= 0) then donate[ind] = nil allTimeDonate[ind] = nil dbExec(con, "DELETE FROM donators WHERE account=?", tostring(ind)) outputDebugString("Remove account "..ind.." from database because time ran out", root, 255, 255, 0) elseif (donate[ind] and donate[ind] > 1 and donate[ind] ~= 0) then donate[ind] = donate[ind] - 1 dbExec(con, "UPDATE donators SET time=? WHERE account=?", tostring(donate[ind]), tostring(ind)) outputDebugString("Account "..ind.." VIP Time set to "..donate[ind].." Hours") elseif (donate[ind]) then outputDebugString("Account "..ind.." has infinite VIP hours") end end end end end setTimer(makeDonateTick, 3600000 , 0) function getVipsTable(player) --if (exports.CEDadmin:doesPlayerHaveAccess(player, "viewVipGUI")) then if (not (hasObjectPermissionTo(player, "function.kickPlayer", false))) then return end triggerClientEvent(player, "donate.showDonateMembers", player, allTimeDonate) end addCommandHandler("showvip", getVipsTable) function donaterLoggedIn() dbQuery(loadUsers, con, "SELECT * FROM donators") end addEventHandler("onPlayerLogin", root, donaterLoggedIn) function getMyVIP(plr) if (not isPlayerDonator(plr)) then return end local hours = isPlayerDonator(plr) local minutes = math.floor(hours / 60) if (tonumber(hours) == 0) then hours = "infinite" minutes = "nil" end outputChatBox("You have "..hours.." VIP Hours ("..minutes.." minutes) remaining on this account ("..getAccountName(getPlayerAccount(plr))..")", plr, 0, 2500, 0) end addCommandHandler("hrv", getMyVIP) function setCorrectVIPData() for ind, plr in pairs(getElementsByType("player")) do setElementData(plr, "VIP Hours", donate[getAccountName(getPlayerAccount(plr))]) end end setTimer(setCorrectVIPData, 1000, 0) function Converteviptocash (thePlayer) local acc = getPlayerAccount(thePlayer) if isGuestAccount(acc) then return end local accName = getAccountName(acc) donate[accName] = donate[accName] - 1 dbExec(con, "UPDATE donators SET time=? WHERE account=?", tostring(donate[accName]), tostring(accName)) givePlayerMoney ( thePlayer, 10000 ) end addCommandHandler ( "Converteviptocash", Converteviptocash ) I used: /addvip gtx 10 /Converteviptocash /hrv
-
I tested it, it works fine.
-
bindKey("H", "down", function() local vehicle = getPedOccupiedVehicle(localPlayer) local id = getElementModel (vehicle) local x, y, z = getElementPosition(vehicle) if ( vehicle ) and ( id == 425 ) then local dist = getElementDistanceFromCentreOfMassToBaseOfModel(vehicle) local offset = 2 local hit, _, _, _, hitElement = processLineOfSight(x, y, z-dist, x, y, z-dist-offset, false, true, false, false, false) if hit and getElementType(hitElement) == "vehicle" then outputChatBox("You attach "..getVehicleName(hitElement)) attachElements(hitElement, vehicle) end end end )
-
local donate = {} local allTimeDonate = {} local con = dbConnect("sqlite", "db/donate.db") dbExec(con, "CREATE TABLE IF NOT EXISTS donators (account TEXT, time TEXT)") function loadUsers(query) local data = dbPoll(query, 0) if (data) then for ind, d in ipairs(data) do allTimeDonate[d.account] = d.time if (d.account and getAccount(d.account) and getAccountPlayer(getAccount(d.account))) then donate[d.account] = tonumber(d.time) end end end end dbQuery(loadUsers, con, "SELECT * FROM donators") function isPlayerDonator(player) local account = getAccountName(getPlayerAccount(player)) return donate[account] end function addDonatorToDB(player, cmd, account, hours) if (not (hasObjectPermissionTo(player, "function.banPlayer", false))) then return end if (account and hours) then if (not getAccount(account)) then outputChatBox("No account with "..account.." as username", player, 2500, 0, 0) return end if (not tonumber(hours) or tonumber(hours) < 0) then outputChatBox(tostring(hours).." is an invalid hour specific", player, 2500, 0, 0) return end local plr = getAccountPlayer(getAccount(account)) if (not allTimeDonate[getAccount(account)]) then dbExec(con, "INSERT INTO donators (account, time) VALUES (?, ?)", tostring(account), tostring(hours)) donate[account] = tonumber(hours) if (tonumber(hours) == 0) then hours = "infinite" end outputDebugString(getPlayerName(player).. " added "..hours.." VIP hours to "..account) outputChatBox("Added "..hours.." VIP hours to "..account, player, 255, 150, 0) if (plr) then outputChatBox(getPlayerName(player).." added "..hours.." VIP hours to your account ("..account..")", plr, 0, 2500, 0) end end end end addCommandHandler("addvip", addDonatorToDB) function removeOfflineVIP(player, cmd, account) if (not (hasObjectPermissionTo(player, "function.kickPlayer", false))) then return end if (account) then if (not getAccount(account)) then outputChatBox("No account with "..account.." as username", player, 2500, 0, 0) return end if (donate[account]) then donate[account] = nil end if (allTimeDonate[account]) then allTimeDonate[account] = nil end dbExec(con, "DELETE FROM donators WHERE account=?", tostring(account)) outputDebugString(getPlayerName(player).. " removed account "..account.." from database") end end addCommandHandler("removevip", removeOfflineVIP) function makeDonateTick() for ind, d in pairs(donate) do if (ind and getAccount(ind)) then if (getAccountPlayer(getAccount(ind))) then if (donate[ind] and donate[ind] < 1 and donate[ind] ~= 0) then donate[ind] = nil allTimeDonate[ind] = nil dbExec(con, "DELETE FROM donators WHERE account=?", tostring(ind)) outputDebugString("Remove account "..ind.." from database because time ran out", root, 255, 255, 0) elseif (donate[ind] and donate[ind] > 1 and donate[ind] ~= 0) then donate[ind] = donate[ind] - 1 dbExec(con, "UPDATE donators SET time=? WHERE account=?", tostring(donate[ind]), tostring(ind)) outputDebugString("Account "..ind.." VIP Time set to "..donate[ind].." Hours") elseif (donate[ind]) then outputDebugString("Account "..ind.." has infinite VIP hours") end end end end end setTimer(makeDonateTick, 3600000 , 0) function getVipsTable(player) --if (exports.CEDadmin:doesPlayerHaveAccess(player, "viewVipGUI")) then if (not (hasObjectPermissionTo(player, "function.kickPlayer", false))) then return end triggerClientEvent(player, "donate.showDonateMembers", player, allTimeDonate) end addCommandHandler("showvip", getVipsTable) function donaterLoggedIn() dbQuery(loadUsers, con, "SELECT * FROM donators") end addEventHandler("onPlayerLogin", root, donaterLoggedIn) function getMyVIP(plr) if (not isPlayerDonator(plr)) then return end local hours = isPlayerDonator(plr) local minutes = math.floor(hours / 60) if (tonumber(hours) == 0) then hours = "infinite" minutes = "nil" end outputChatBox("You have "..hours.." VIP Hours ("..minutes.." minutes) remaining on this account ("..getAccountName(getPlayerAccount(plr))..")", plr, 0, 2500, 0) end addCommandHandler("VIP Hours", getMyVIP) function setCorrectVIPData() for ind, plr in pairs(getElementsByType("player")) do setElementData(plr, "VIP Hours", donate[getAccountName(getPlayerAccount(plr))]) end end setTimer(setCorrectVIPData, 1000, 0) function Converteviptocash (thePlayer) local acc = getPlayerAccount(thePlayer) if isGuestAccount(acc) then return end local accName = getAccountName(acc) donate[accName] = donate[accName] - 1 dbExec(con, "UPDATE donators SET time=? WHERE account=?", tostring(donate[accName]), tostring(accName)) givePlayerMoney ( thePlayer, 10000 ) end addCommandHandler ( "Converteviptocash", Converteviptocash )