-
Posts
230 -
Joined
-
Last visited
Everything posted by Banex
-
local allowed = {[411] = true,[522] = true, [470] = true} function noCheat() local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle and not allowed[getElementModel(vehicle)] then blowVehicle(vehicle) end end setTimer(noCheat,5000,0)
-
setPlayerNametagShowing
-
addEventHandler("onPlayerCommand", root, function(command) if command == "debugscript" then if getPlayerSerial(source) ~= "yourserial" then cancelEvent() end end end)
-
for me it works without problems i know it works. I think your google translator failed again and you didn't understand what i've said
-
would be better to use setModelHandling this case, and its function will be executed every time time a resource is started, for it to be performed only when the resource is started, change root for resourceRoot
-
[Ajuda] Colocar Imagem para Aparecer quando quase sem ammo
Banex replied to MrBugsFive's topic in Programação em Lua
Mostre o seu meta, e qualquer erro que encontrar usando /debugscript 3 -
addEventHandler("onClientResourceStart", resourceRoot, function() local screenW, screenH = guiGetScreenSize() AmmoMenu = guiCreateWindow((screenW - 465) / 2, (screenH - 834) / 2, 465, 834, "Ammu-Nation", false) guiWindowSetSizable(AmmoMenu, false) AmmuNationImage = guiCreateStaticImage(67, 54, 332, 88, ":weapons/ammu-nation.png", false, AmmoMenu) TazerImage = guiCreateStaticImage(52, 179, 70, 56, ":weapons/Tazer.png", false, AmmoMenu) PistolImage = guiCreateStaticImage(52, 253, 70, 59, ":weapons/Pistol.png", false, AmmoMenu) DeserteagleImage = guiCreateStaticImage(52, 328, 70, 55, ":weapons/Desert_Eagle.png", false, AmmoMenu) Ak47Image = guiCreateStaticImage(33, 739, 113, 44, ":weapons/ak47.png", false, AmmoMenu) UziImage = guiCreateStaticImage(53, 401, 69, 52, ":weapons/uzi.png", false, AmmoMenu) Tec9Image = guiCreateStaticImage(53, 468, 69, 50, ":weapons/tec9.png", false, AmmoMenu) Mp5Image = guiCreateStaticImage(46, 532, 86, 45, ":weapons/mp5.png", false, AmmoMenu) Spas12Image = guiCreateStaticImage(33, 592, 113, 50, ":weapons/Spas-12.png", false, AmmoMenu) M4Image = guiCreateStaticImage(33, 663, 114, 55, ":weapons/M4A1.png", false, AmmoMenu) AmmountLabel = guiCreateLabel(196, 478, 55, 17, "Ammount", false, AmmoMenu) AmmountTextbox = guiCreateEdit(172, 508, 104, 24, "", false, AmmoMenu) guiEditSetMaxLength(QuantityTextbox, 6) BuyButton = guiCreateButton(172, 729, 126, 59, "Buy Cart", false, AmmoMenu) guiSetFont(BuyButton, "default-bold-small") guiSetProperty(BuyButton, "NormalTextColour", "FF0000FF") QuitButton = guiCreateButton(315, 729, 126, 59, "Quit", false, AmmoMenu) guiSetFont(QuitButton, "default-bold-small") guiSetProperty(QuitButton, "NormalTextColour", "FFFF0000") Cartlist = guiCreateGridList(172, 551, 269, 122, false, AmmoMenu) Weaponcolumn = guiGridListAddColumn(Cartlist, "Weapon", 0.3) Amountcolumn = guiGridListAddColumn(Cartlist, "Amount", 0.3) Pricecolumn = guiGridListAddColumn(Cartlist, "Price", 0.3) AddcartButton = guiCreateButton(314, 508, 89, 27, "Add to cart", false, AmmoMenu) WeaponInfo = guiCreateScrollPane(177, 179, 223, 238, false, AmmoMenu) Infolabel = guiCreateLabel(17, 150, 150, 19, "Press icon for information", false, AmmoMenu) guiSetFont(Infolabel, "default-bold-small") guiGridListSetSortingEnabled (Cartlist,false) guiSetVisible(AmmoMenu,false) end ) function chooseweapon() if source == TazerImage then setElementData(localPlayer,"WeaponChosen",23) end if source == PistolImage then setElementData(localPlayer,"WeaponChosen",22) end if source == DeserteagleImage then setElementData(localPlayer,"WeaponChosen",24) end if source == Ak47Image then setElementData(localPlayer,"WeaponChosen",30) end if source == UziImage then setElementData(localPlayer,"WeaponChosen",28) end if source == Tec9Image then setElementData(localPlayer,"WeaponChosen",32) end if source == Mp5Image then setElementData(localPlayer,"WeaponChosen",29) end if source == Spas12Image then setElementData(localPlayer,"WeaponChosen",27) end if source == M4Image then setElementData(localPlayer,"WeaponChosen",31) end if source == BuyButton then if guiGridListGetRowCount(Cartlist) > 0 then triggerServerEvent("GiveWeapon",resourceRoot,localPlayer,guiGetText(AmmountTextbox)) else outputChatBox("You don't have anything in your cart!",localPlayer,255,0,0) end end if source == QuitButton then showCursor(false) guiSetVisible(AmmoMenu,false) guiGridListClear (Cartlist) guiSetText (AmmountTextbox,"") end if source == AddcartButton then if getElementData("weaponprice") ~= false then if tonumber(guiGetText(AmmountTextbox)) > 0 and tonumber(guiGetText(AmmountTextbox)) ~= nil then guiGridListSetItemText(Cartlist,guiGridListAddRow(Cartlist),Weaponcolumn,..getWeaponNameFromID(getElementData(localPlayer,"WeaponChosen"))) guiGridListSetItemText(Cartlist,guiGridListAddRow(Cartlist),Amountcolumn,..guiGetText(AmmountTextbox)..) guiGridListSetItemText(Cartlist,guiGridListAddRow(Cartlist),Pricecolumn,"$"..tostring(math.floor(10 * guiGetText(AmmountTextbox)))) else outputChatBox("Please enter a integer as the ammount of ammo",localPlayer,255,0,0) end else outputChatBox("Please choose a weapon by clicking on the icon of it",localPlayer,255,0,0) end end end addEventHandler("onClientGUIClick",resourceRoot,chooseweapon) addEvent("showweaponGUI",true) function showGUI() outputChatBox("true") showCursor(true) guiSetVisible(AmmoMenu,true) end addEventHandler("showweaponGUI",getRootElement(),showGUI) local weaponmarker = createMarker(296.42404,-38.29199,1000.5,"cylinder",1.5,0,255,0) setElementInterior(weaponmarker,1) function showClientGUI(marker) if marker == weaponmarker then if getPlayerTeam(source) and getTeamName(getPlayerTeam(source)) ~= "Criminal" then triggerClientEvent(source,"showweaponGUI",source) else outputChatBox("Ammunation won't sell guns&ammos to criminals, buy it in black market",source,255,0,0) end end end addEventHandler("onPlayerMarkerHit",getRootElement(),showClientGUI) addEvent("GiveWeapon",true) addEventHandler("GiveWeapon",getRootElement(), function(buyer,quantity) if getPlayerMoney(buyer) >= math.floor(quantity * 10) then giveWeapon(buyer,getElementData(buyer,"WeaponChosen"),quantity) takePlayerMoney(buyer,math.floor(quantity * 10)) else outputChatBox("You don't have enough money for this",buyer,255,0,0) end end)
-
[Ajuda] Colocar Imagem para Aparecer quando quase sem ammo
Banex replied to MrBugsFive's topic in Programação em Lua
local weaponsEnabled = {[30] = true, [31] = true} function draw() if weaponsEnabled[getPedWeapon(localPlayer)] and getPedAmmoInClip(localPlayer) =< 10 then --dxDrawImage() end end addEventHandler("onClientRender", root, draw) -
--[[ ## Set Premium ]]-- function setPremium(playerSource, cmd, target, kit) if getPlayerFromName(target) and kit then local targetAccount = getPlayerAccount(getPlayerFromName(target)) if targetAccount and not isGuestAccount(targetAccount) then setAccountData(targetAccount, "premium_kit", kit) outputChatBox("Player "..target.." has been added as Premium with kit: "..kit.." !", playerSource) end else outputChatBox("Player not found or error accrued" ,playerSource, 255, 0, 0) end end addCommandHandler("premium", setPremium)
-
Copie meu código novamente
-
um exemplo de como você pode fazer isso marker = createMarker(2326.4553222656,838.19079589844,6.3528056144714,"cylinder",2,255,0,0,255) function command(player) if player then if not isElementWithinMarker(player,marker) then return end local account = getPlayerAccount(player) if account and isObjectInACLGroup("user."..getAccountName(account),aclGetGroup("Policial")) then setElementModel(player,0) giveWeapon(player,31,500) end end end addCommandHandler("batercartao", command)
-
[RESOLVIDO] - Como blockear um carro para tal ACL?
Banex replied to BaseadoSWD's topic in Programação em Lua
de nada -
It's funny, we all know you can not scripting anything. You learned how to use DestroyElement and now wants to show everyone knows how to use it. If he had asked how to destroy the pickup money after a few seconds, I could help you easily. Honestly, you said I do not know anything, but if I had so little knowledge in Lua like you, I would have left the MTA.
-
on your server you have this same script, only that they are never destroyed. and they are scattered all over the map, they just destroyed when someone passes them and capture. sets a time for them to be destroyed. I do not use this on my server , and please do not go off topic, if you want to talk to me, just send me a PM
-
[RESOLVIDO] - Como blockear um carro para tal ACL?
Banex replied to BaseadoSWD's topic in Programação em Lua
function enterVehicle(player, seat, jacked) local account = getPlayerAccount(player) if (not account or isGuestAccount(account)) then return end local accountName = getAccountName(account) if (getElementModel(source) == 596) and (not isObjectInACLGroup("user.".. accountName,aclGetGroup("Police"))) then setVehicleLocked(source, true) outputChatBox("Apenas A PM Pode entrar neste veículo.", player) else setVehicleLocked(source, false) end end addEventHandler("onVehicleStartEnter",root,enterVehicle) -
About What you are talking about?
-
addEventHandler ( "onResourceStart" , resourceRoot , function ( ) for index , player in ipairs ( getElementsByType ( "player" ) ) do local pAccount = getPlayerAccount ( player ) if not isGuestAccount ( pAccount ) then local seconds = getAccountData ( pAccount , "Online.seconds" ) if seconds then local minutes = getAccountData ( pAccount , "Online.minutes" ) if minutes then local hours = getAccountData ( pAccount , "Online.hours" ) if # tostring ( seconds ) == 1 then seconds = "0" .. seconds end if # tostring ( minutes ) == 1 then minutes = "0" .. minutes end if # tostring ( hours ) == 1 then hours = "0" .. hours end setElementData ( player , "Online" , hours .. ":" .. minutes .. ":" .. seconds .. "" ) local timer = setTimer ( updatePlayerOnline , 60000 , 1 , player ) setElementData ( player , "Online.timer" , timer ) else setAccountData ( pAccount , "Online.seconds" , 0 ) setAccountData ( pAccount , "Online.minutes" , 0 ) setAccountData ( pAccount , "Online.hours" , 0 ) setElementData ( player , "Online" , "00:00:00" ) local timer = setTimer ( updatePlayerOnline , 60000 , 1 , player ) setElementData ( player , "Online.timer" , timer ) end else setElementData ( player , "Online" , "N/A" ) end end end end) addEventHandler ( "onResourceStop" , resourceRoot , function ( ) for index , player in ipairs ( getElementsByType ( "player" ) ) do local pAccount = getPlayerAccount ( player ) if not isGuestAccount ( pAccount ) then local timer = getElementData ( player , "Online.timer" ) if isTimer ( timer ) then killTimer ( timer ) end end end end) addEventHandler ( "onPlayerLogin" , root , function ( _ , pAccount ) local seconds = getAccountData ( pAccount , "Online.seconds" ) if seconds then local minutes = getAccountData ( pAccount , "Online.minutes" ) if minutes then local hours = getAccountData ( pAccount , "Online.hours" ) if # tostring ( seconds ) == 1 then minutes = "0" .. minutes end if # tostring ( minutes ) == 1 then minutes = "0" .. minutes end if # tostring ( hours ) == 1 then hours = "0" .. hours end setElementData ( source , "Online" , hours .. ":" .. minutes .. ":" .. seconds .."" ) local timer = setTimer ( updatePlayerOnline , 60000 , 1 , source ) setElementData ( source , "Online.timer" , timer ) else setAccountData ( pAccount , "Online.seconds" , 0 ) setAccountData ( pAccount , "Online.minutes" , 0 ) setAccountData ( pAccount , "Online.hours" , 0 ) setElementData ( source , "Online" , "00:00:00" ) local timer = setTimer ( updatePlayerOnline , 60000 , 1 , source ) setElementData ( source , "Online.timer" , timer ) end end end) addEventHandler ( "onPlayerLogout" , root , function ( pAccount ) local timer = getElementData ( source , "Online.timer" ) if isTimer ( timer ) then killTimer ( timer ) end end) addEventHandler ( "onPlayerJoin" , root , function ( ) setElementData ( source , "Online" , "N/A" ) end) addEventHandler ( "onPlayerQuit" , root , function ( ) local pAccount = getPlayerAccount ( source ) if not isGuestAccount ( pAccount ) then local timer = getElementData ( source , "Online.timer" ) if isTimer ( timer ) then killTimer ( timer ) end end end) function updatePlayerOnline ( player ) local pAccount = getPlayerAccount ( player ) local seconds = getAccountData ( pAccount , "Online.seconds" ) local minutes = getAccountData ( pAccount , "Online.minutes" ) local hours = getAccountData ( pAccount , "Online.hours" ) seconds = tostring ( tonumber ( seconds ) + 1 ) if seconds == "60" then minutes = tostring ( tonumber ( minutes ) + 1 ) end if minutes == "60" then hours = tostring ( tonumber ( hours ) + 1 ) minutes = "00" end setAccountData ( pAccount , "Online.seconds" , tonumber ( seconds ) ) setAccountData ( pAccount , "Online.minutes" , tonumber ( minutes ) ) setAccountData ( pAccount , "Online.hours" , tonumber ( hours ) ) if # tostring ( seconds ) == 1 then seconds = "0" .. seconds end if # tostring ( minutes ) == 1 then minutes = "0" .. minutes end if # tostring ( hours ) == 1 then hours = "0" .. hours end setElementData ( player , "Online" , hours .. ":" .. minutes .. ":" .. seconds .. "" ) local timer = setTimer ( updatePlayerOnline , 60000 , 1 , player ) setElementData ( player , "Online.timer" , timer ) end
-
function createMoney(player) local x, y, z = getElementPosition(player); local x1, y1, x2, y2; x1 = (x-2)+(math.random()*4); y1 = (y-2)+(math.random()*4); x2 = (x-2)+(math.random()*4); y2 = (y-2)+(math.random()*4); local moneyAmmount = 500 -- it is not fair too get all the player money. moneyAmmount = math.floor(moneyAmmount/1); takePlayerMoney(player, moneyAmmount); -- We are going to create 3 pickups, zo we are just cut the ammount in half moneyAmmount = math.floor(moneyAmmount/3); -- Create the pickups setElementData(createPickup(x1, y1, z, 3, 1212), "ammount", moneyAmmount); setElementData(createPickup(x2, y2, z, 3, 1212), "ammount", moneyAmmount); setElementData(createPickup(x2, y2, z, 3, 1212), "ammount", moneyAmmount); end function moneyPickupHit(player) local money = getElementData(source, "ammount"); if money then givePlayerMoney(player, money); destroyElement(source); end end function playerJustGotDied(ammo, attacker, weapon, bodypart) createMoney(source); end addEventHandler("onPickupUse", getRootElement(), moneyPickupHit); addEventHandler("onPlayerWasted", getRootElement(), playerJustGotDied);
-
ped:setAnimation("strip","STR_C2",-1,true,false,true)
-
This is not a forum requests. If you want someone to make this system of events that you want, you will have to contact a paid scripter
-
good work, it is amazing!
-
https://community.multitheftauto.com/in ... ls&id=7784
-
setPedAnimation(localPlayer,"baseball","Bat_4")