-
Posts
667 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Mr.Loki
-
Use loops. It will make scripting multiple items easier. pv = { } local positions = { {1920.96960, -1791.41931, 12.25451}, {1372.22998, -1600.58765, 12.55247}, {1187.37, -1334.88, 12.56}, {1204.98145, -1070.53796, 28.24623}, {652.31482, -1767.81738, 12.55009}, {2455.93091, -1787.65576, 12.54688}, {2154.16821, -1167.59106, 22.82215}, {-20.03092, -278.19138, 4.42969}, {1736.50134, 1877.01477, 9.82031}, {2377.19727, 2019.28247, 9.82031}, {2898.70703, 2454.66870, 9.82031}, {-1454.17456, 1870.05615, 31.63281}, {-2251.42944, 2329.95679, 3.81250}, {-2242.80200, 537.43109, 34.12649}, {-1985.65979, 269.49936, 34.17936}, {-1498.97607, 849.02643, 6.18750}, {1538.96, -1687.7, 12.55}, } for i,pos in pairs(positions) do local mrk = createMarker(pos[1],pos[2],pos[3], "cylinder", 2, 255, 255, 255, 150) createBlipAttachedTo(mrk, 38, 2, 0, 255, 0, 255, 0, 500) addEventHandler("onMarkerHit", mrk,function(hitElement) if(getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "markerHitted", hitElement) end end) addEventHandler("onMarkerLeave", mrk,function(leftElement) if(getElementType(leftElement) == "player") then triggerClientEvent(leftElement, "markerLeaved", hitElement) end end) end function createTheVehicle(id, posx, posy, posz, player) if(isElement(pv[player])) then destroyElement(pv[player]) end pv[player] = createVehicle(id, posx, posy, posz + 1) warpPedIntoVehicle(player, pv[player]) if(getTeamName(getPlayerTeam(player)) == "Staff") then addVehicleUpgrade(pv[player], 1010) end triggerClientEvent(player, "markerLeaved", player) end addEvent("crVeh", true) addEventHandler("crVeh", root, createTheVehicle)
-
projectile How to change a projectile's blip color?
Mr.Loki replied to Lord Henry's topic in Scripting
We tried this already does not work -
[LF] Scripters / Mappers / Modders / Alpha Testers [ Non - Paid]
Mr.Loki replied to Syntrax#'s topic in Looking for staff
Name: Trimel Ingame name: Loki Age: 23 Country of birth: Trinidad nationality: Trinidadian Native language: English Other languages: None About yourself: I've been playing MTA for about 7 years and scripting about 4-5. During that time I've had 4 servers and scripted for 3-4 others. Applying for: Alpha tester What are your specialties: OOP and client sided stuff Media of your creations: https://streamable.com/album/kv5k and some stuff in my forum signature. Did you join our discord channel: ye Do you have a mic: ye Servers played in the past containing the RPG gamemode: CIT, SAUR -
Why create a colSphere and use a colShape hit event when there's a marker hit event? That just makes no sense to me.
-
function coronaa(hitElement) if hitElement == localPlayer then triggerServerEvent ("szoveg", localPlayer) -- set the source of the event as the localPlayer. end end addEventHandler ( "onClientMarkerHit", ajtomegilyenek, coronaa ) addEvent( "szoveg", true ) addEventHandler( "szoveg", root, function() outputChatBox("Sup bruh?", source, r,g,b, true) -- usese the source of the event. end) -- Or jsut keep it client side unless u got other functions... function coronaa() outputChatBox("Sup bruh?", r,g,b, true) end addEventHandler ( "onClientMarkerHit", ajtomegilyenek, coronaa ) \/\/
-
No prob @swedishboy
-
projectile How to change a projectile's blip color?
Mr.Loki replied to Lord Henry's topic in Scripting
Damn... then i have no idea how lol -
local markers={} local spots = { {2488.32886, -1670.63599, 12.33595}, {2490.92886, -1670.63599, 12.33595}, {2495.92886, -1670.63599, 12.33595} } for k,v in ipairs (spots) do local m = createMarker(v[1], v[2], v[3], "cylinder", 1.2, 22, 22, 22) markers[m] = true end function getHp (player) local money = getPlayerMoney(player) local hpp = getElementHealth(player) if markers[source] and money >= 1000 then if hpp < 100 then setElementHealth(player, 100) takePlayerMoney(player, 1000) elseif money >= 1000 and hpp >= 100 then outputChatBox("Your HP is already full", player, 222, 44, 22) end else outputChatBox("You don't have enough money", player, 222, 44, 22) end end addEventHandler("onMarkerHit", resourceRoot, getHp)
-
function spawnDayZPlayer(player) if player and getElementType(player) == "player" then setElementData(player,"killed",false) local number = math.random(table.size(spawnPositions)) local x,y,z = spawnPositions[number][1],spawnPositions[number][2],spawnPositions[number][3] spawnPlayer (player, x,y,z+0.5, math.random(0,360),math.random(71,73), 0, 0) fadeCamera (player, true) setCameraTarget (player, player) playerCol = createColSphere(x,y,z,1.5) setElementData(player,"playerCol",playerCol) attachElements ( playerCol, player, 0, 0, 0 ) setElementData(playerCol,"parent",player) setElementData(playerCol,"player",true) local account = getPlayerAccount(player) setAccountData(account,"isDead",false) setElementData(player,"isDead",false) setElementData(player,"logedin",true) for i,itens in ipairs(playerDataTable) do setElementData(player,itens[1],0) end for _,item in pairs(spawnItems)do setElementData(player,item[1],item[2]) end end end
-
Are you destroying the blip when a player dies?
-
Sorry for late reply, add fadeCamera to the function.
-
how do you spawn the player? Can u show that part of the code please?
-
dxDrawMaterialLine3D dxCreateRenderTarget dxSetRenderTarget onClientClick getCursorPosition it's no simple task unless you are familiar with using matrix in lua.
-
Problem 1: function getInMarker(hitElement, matchingDimension) if getElementType(hitElement) ~= "player" then return end local acc = getPlayerAccount(hitElement) if getAccountData(acc, "green") then -- no need to use "== true" unless you are looking for specific data triggerClientEvent("skin", hitElement) else outputChatBox("You're not with the Special Military Unit!", hitElement, 255, 0, 0) end end addEventHandler("onMarkerHit", marker1, getInMarker) Problem 2: Use debugscript before choosing your team it should show you the error Problem 4: try this --SERVER: function setSelectedSkin(skin) setElementModel(source, skin) end addEvent("onPlayerChooseSkin", true) addEventHandler ( "onPlayerChooseSkin", root, setSelectedSkin ) --CLIENT: addEventHandler("onClientGUIClick",GUIEditor.window[1],function() local skin = 0 if source == GUIEditor.button[1] then --skin = YOUR SKIN ID elseif source == GUIEditor.button[2] then skin = 279 elseif source == GUIEditor.button[3] then --skin = YOUR SKIN ID elseif source == GUIEditor.button[4] then skin = 50 elseif source == GUIEditor.button[5] then skin = 278 elseif source == GUIEditor.button[6] then --skin = YOUR SKIN ID elseif source == GUIEditor.button[7] then --skin = YOUR SKIN ID end showCursor(false) guiSetVisible(GUIEditor.window[1], false) triggerServerEvent("onPlayerChooseSkin", localPlayer) end)
-
Yeah, the rate var would only return text during the weekend. I'm dividing by the modifier because the actual experience value was already altered by the modifier so im returning the value that was altered. The last code I gave still had an error because I forgot to use the rate var instead of modifier so it would have been be: outputChatBox("[INFO]#FFFFFF Você matou: #32FF32"..getPlayerName(source):gsub('#%x%x%x%x%x%x','').."#FFFFFF || Arma: #32FF32"..(weapon or "Unknown").."#FFFFFF || Distância: #32FF32"..tostring(math.floor(Distancia)).."m #FFFFFF || Exp: #32FF32"..experiences/modifier.." "..rate,killer,0,128,255,true) just to clear up what i did lol
-
oops made an error use this instead local rate = modifier == 2 and "x2" or modifier == 3 and "x3" or "" outputChatBox("[INFO]#FFFFFF Você matou: #32FF32"..getPlayerName(source):gsub('#%x%x%x%x%x%x','').."#FFFFFF || Arma: #32FF32"..(weapon or "Unknown").."#FFFFFF || Distância: #32FF32"..tostring(math.floor(Distancia)).."m #FFFFFF || Exp: #32FF32"..experiences/modifier.." "..modifier,killer,0,128,255,true)
-
@DNL291 the rate var is using the day modifier var so if the modifier is 1 the text will be empty if the modifier is 2 the text will be 2x etc...
-
dude at least say what error it gave you...
-
Try this. No need for if statements. local rate = modifier == 2 and "x2" or modifier == 3 and "x3" or "" outputChatBox("[INFO]#FFFFFF Você matou: #32FF32"..getPlayerName(source):gsub('#%x%x%x%x%x%x','').."#FFFFFF || Arma: #32FF32"..(weapon or "Unknown").."#FFFFFF || Distância: #32FF32"..tostring(math.floor(Distancia)).."m #FFFFFF || Exp: #32FF32"..experiences/2.." "..modifier,killer,0,128,255,true)
-
addEventHandler( "onPlayerLogin", root, function ( ) -- check what day it is -- if its weekend outputChatBox( "message that it's 2x???" ) end )
-
projectile How to change a projectile's blip color?
Mr.Loki replied to Lord Henry's topic in Scripting
addCommandHandler only has 2 main args please use /debugscript 3 to debug your code and show errors I just tried the function myself and it seems that the blip isn't attached to the projectile so, i just made a little hack. Not perfect but it works. function attackIntruderA51 () local t={} -- store the projectiles in a table so you can simply loops it and easily add more projectiles. t[#t+1] = createProjectile (localPlayer, 20, 15.49994, 1719.1, 25.5, 5, localPlayer, 0, 0, 0, 0, 0, 1) t[#t+1] = createProjectile (localPlayer, 20, 237.7, 1696.8, 25.5, 5, localPlayer, 0, 0, 0, 0, 0, 1) for _,projectile in pairs (t) do local blip = createBlipAttachedTo( projectile, 0, 1, 255, 0, 0, 255, 1 ) setElementParent( blip, projectile ) -- parent the blip to the projectile so it gets destroyed when the projectile explodes. end end addCommandHandler ("attack", attackIntruderA51)