-
Posts
119 -
Joined
-
Last visited
Everything posted by AlvarO
-
How could I make a dxDrawRectangle a shader for give it rotation? I tried with dxCreateRenderTarget
-
How to get player's screen and use it as a picture ?
AlvarO replied to OnlineCheater's topic in Scripting
ok, you just gave me an idea for a script , anyway, add me in skype for help: lalvariko -
How to get player's screen and use it as a picture ?
AlvarO replied to OnlineCheater's topic in Scripting
If with "several kind of cameras" you mean of a random player just use getRandomPlayer(), otherwise, you can setCameraMatrix where you want the photo of the player(or random player) with a timer and take a screenshot. -
I developed this function into my lobby script, so I'll share it: local x, y = guiGetScreenSize() local npcs = {} function createNPC(name, modelID, x,y,z, rz) rz = rz or 0 local pedElement = createPed(modelID, x,y,z, rz) table.insert(npcs, {name = name, ped = pedElement, isClose = false}) end addEventHandler("onClientResourceStart", resourceRoot, function() dd = createNPC("Destruction Derby", 160, 5282.0478515625, -2192.97265625, 18.072999954224, 180) shooter = createNPC("Shooter", 104, 5281.8583984375, -2210.6875, 18.072999954224, 0) race = createNPC("Race", 30, 5300.0620117188, -2211.4533691406, 18.072999954224, 0) hunter = createNPC("Hunter", 22, 5305.978515625, -2206.55078125, 18.072999954224, 90) dm = createNPC("Deathmatch", 29, 5300.42432, -2192.78345, 18.07300, 180) basketball = createNPC("Soon...", 16, 5305.9091796875, -2197.9853515625, 18.072999954224, 90) end) addEventHandler("onClientRender", root, function() local x,y,z = getElementPosition(localPlayer) for i, npc in ipairs (npcs) do local nx, ny, nz = getElementPosition(npc.ped) local dist = getDistanceBetweenPoints3D(x, y, z, nx, ny, nz) if (dist < 3.5) then local dx, dy = getScreenFromWorldPosition(nx, ny, nz) if (dx) and (dy) then for npcs in ipairs (npcs) do if (npc.name == "Deathmatch") then dxDrawText(npc.name, dx, dy, dx, dy, tocolor(100, 210, 255, 255), 2.25, "arial") dxDrawText("Press 'F'", dx, dy+30, dx, dy, tocolor(255, 255, 255, 255), 2.25, "arial") elseif (npc.name == "Destruction Derby") then dxDrawText(npc.name, dx, dy, dx, dy, tocolor(100, 210, 255, 255), 2.25, "arial") dxDrawText("Press 'F'", dx, dy+30, dx, dy, tocolor(255, 255, 255, 255), 2.25, "arial") elseif (npc.name == "Race") then dxDrawText(npc.name, dx, dy, dx, dy, tocolor(100, 210, 255, 255), 2.25, "arial") dxDrawText("Press 'F'", dx, dy+30, dx, dy, tocolor(255, 255, 255, 255), 2.25, "arial") elseif (npc.name == "Shooter") then dxDrawText(npc.name, dx, dy, dx, dy, tocolor(100, 210, 255, 255), 2.25, "arial") dxDrawText("Press 'F'", dx, dy+30, dx, dy, tocolor(255, 255, 255, 255), 2.25, "arial") elseif (npc.name == "Hunter") then dxDrawText(npc.name, dx, dy, dx, dy, tocolor(100, 210, 255, 255), 2.25, "arial") dxDrawText("Press 'F'", dx, dy+30, dx, dy, tocolor(255, 255, 255, 255), 2.25, "arial") elseif (npc.name == "Soon...") then dxDrawText(npc.name, dx, dy, dx, dy, tocolor(100, 210, 255, 255), 2.25, "arial") dxDrawText("This gamemode will be avaible soon!", dx, dy+30, dx, dy, tocolor(255, 255, 255, 255), 2.25, "arial") end end npc.isClose = true else npc.isClose = false end end end end) bindKey("f", "down", function() for i, npc in ipairs (npcs) do if (npc.isClose) then -- do what you want here, to check a npc by name use the npc.name or a ped element: npc.ped if (npc.name == "Destruction Derby") then outputChatBox("You pressed 'F' at npc: " .. npc.name) setElementDimension(localPlayer, 5) elseif (npc.name == "Shooter") then outputChatBox("You pressed 'F' at npc: " .. npc.name) setElementDimension(localPlayer, 4) elseif (npc.name == "Race") then outputChatBox("You pressed 'F' at npc: " .. npc.name) setElementDimension(localPlayer, 3) elseif (npc.name == "Hunter") then outputChatBox("You pressed 'F' at npc: " .. npc.name) setElementDimension(localPlayer, 2) elseif (npc.name == "Deathmatch") then outputChatBox("You pressed 'F' at npc: " .. npc.name) setElementDimension(localPlayer, 1) elseif (npc.name == "Soon...") then outputChatBox("You pressed 'F' at npc: " .. npc.name) outputChatBox("Soon...") end npc.isClose = false end end end) addEventHandler("onClientPlayerDamage", root, function () cancelEvent() end) function backToLobby() setElementDimension(localPlayer, 0) end bindKey("F2", "down", backToLobby)
-
Any help? Still can't do it, i tried the code by myself but it dosn't works :c
-
I tried that function but it dosn't works
-
Hey, I just made the gui of my login, but I dont know how to let it work with my forum accounts, can anybody tell me how? The version of my forum is IP.Board 3.4.7. Thanks
-
Thanks you a lot dude!
-
So, guys, is there any event for race that works when new map load? I was thinking and tried to search: "onGamemodeMapChange"
-
As I have know, there's no other way, just changing the models of the existing objects.
-
In my opinion, I think that MTA should has this function since it started to work, basically becuase of the lag it cause refresh the whole server, imagine a server that need a lot of scripts (10-20 scripts), I seem better to refresh just one of the all resources inside, and as venad said "This function is perfect to see some automated resources."
-
And how it with work in an auto team? CODE: Names={} Tags={} Colors={} local names ={"Empire Street Riders"} local tags ={"EsR"} local colors ={"#256f5c"} function loadTeams() for i,name in pairs(names) do Names[i]=name end for i,tag in pairs(tags) do Tags[i]=tag end for i,color in pairs(colors) do Colors[i] = color end end addEventHandler("onResourceStart",root,loadTeams) function moveOnStart() for i,player in pairs(getElementsByType("player")) do check(player) end end addEventHandler("onResourceStart",root,moveOnStart) function check (player) setPlayerTeam(player,nil) for i,tag in pairs(tags) do if string.find(getPlayerName(player),tag) then local name = Names[i] local color = Colors[i] if not getTeamFromName(name) then createTeam(name,getColorFromString(color)) end local team = getTeamFromName(name) setPlayerTeam(player,team) end end end function remove() for t,teams in pairs(names) do local team = getTeamFromName(teams) if team then if countPlayersInTeam ( team )==0 then destroyElement(team) end end end end function nick(old,new) setTimer(check,1000,1,source) setTimer(remove,1500,1) end addEventHandler("onPlayerChangeNick",root,nick) function join() setTimer(check,4000,1,source) end addEventHandler("onPlayerJoin",root,join) function quit(player) setTimer(remove,1000,1) end addEventHandler("onPlayerQuit",root,quit)
-
And for a team? Also thanks, the code for vehicle works perfectly
-
Like a color, and that color goes changing from white to black infinite times.
-
Thanks! but not that raimbow, I wanted a rainbow like the car colors ones.
-
Hey, so I was wondering how to pass a r,g,b colorcode to hex one, and if it is possible, how to do it with a raimbow colorcode? Thanks.
-
Try something like function ifIsLocalPlayerVip() if isPlayerVip then setElementData(localPlayer, "vip-vehicle") end function spawnVehicleVip() if getElementData(player, "vip-vehicle") == true then spawnVehicle(vehicleid, x, y, z, rx, ry, rz, plate, rc, gc, bc) end end *I DIDN'T TEST IT*
-
The database "loggedin" doesn't exist, try to create it by yourself.
-
Try to function getPos(player,command,target) x, y, z = getElementPosition(player) tx, ty, tz = getElementPosition(target) if target == nil then outputChatBox(player.." poziciója: "..x..y..z) else outputChatBox(target.." poziciója: "..tx..ty..tz) end end addCommandHandler("pos",getPos)
-
Try to setSoundVolume(sound, 0) Anyway, any debug message?
-
For kills you have to loop for every kill of a player for something1, something2 in ipairs(HERE GOES WHAT WE NEED TO GET) do And for add them in a group just make a variable, and loop it (the thing of up) for get every player kill of the group.
-
Didn't understand, can you give me an example?