Jump to content

Mr.Loki

Members
  • Posts

    667
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Mr.Loki

  1. @NeXuS™ Well probably he's new to scripting hence his post count is only 7. so I gave him some instructions to see what he could have done on his own and if not after a few tries, then I'd try to line by line explain it to him. Teach him to fish don't give him 1.
  2. At line 2 make a check (getElementType) for "vehicle" so that it only works when vehicles hit it. remove line 2 and 3 that's commented. Use (getElementsWithinColShape) with "vehicle" as the second arg to return a table of all the vehicles in the colshape. So functionThatChecksVehiclesOnTheBase should look like: #getElementsWithinColShape(colShape,"vehicle") adding a # to a table counts it.
  3. Rather.. what resource are you using to /makeshop?
  4. local serial = { ["your_serial"] = true, ["your_serial"] = true, } function checkConnectingSerial( nick, ip, name, ser, iVersion, sVersion ) if not serial[ser] then cancelEvent( true, "Your serial is not on the whitelist." ) end end addEventHandler( "onPlayerConnect", root, checkConnectingSerial ) Not saying that your method is wrong but you can create the table with the serials already in them and you forgot the username parameter before serial. From the WIKI: string playerNick, string playerIP, string playerUsername, string playerSerial, int playerVersionNumber, string playerVersionString
  5. This is the default admin resource. I suggest redownloading the admin resource from here or post the changes you have made to the resource that may be the cause of the error.
  6. Use the code button for code <> near the smiley face. local items = { {"Banana"}, {"Kiwi"}, {"Pizza"} } function fimdoevento(killer) if getElementType(killer) == "player" and getElementData(source,"eventoblip") == true then -- checks if the killer is a player we dont want cars to get the item ._. and if the player killed has the event blip. local item = items[math.random(#items)][1]-- get random table entry. local quantity = math.random(5) -- generate random quantity between 1-5 destroyElement(blip)-- destroy the blip setElementData(source, "eventoblip",false)-- remove the event data from the admin setElementData(killer, "Sniper Rifle Ammo", 150)-- give the killer(player who killed the admin) Sniper ammo outputChatBox ('#00a5ff==============================================================',root,255,255,255,true) outputChatBox ("#00a5ff Congratulations [#FF0000" ..getPlayerName(killer).."#00a5ff] win a [#ff0000 "..quantity.."x "..item.."#00a5ff]!",root,255,255,255,true)-- output messaage with the killer's name outputChatBox ('#00a5ff==============================================================',root,255,255,255,true) end end addEventHandler("onPlayerWasted", root, fimdoevento)
  7. Mr.Loki

    playSound3D

    Then simply change it from resourceRoot to root... because you are dealing with elements outside of the resource.
  8. Mr.Loki

    playSound3D

    triggerServerEvent triggerClientEvent
  9. Mr.Loki

    CrossHair

    @#BrosS Here.
  10. Mr.Loki

    Zombie

    Give some of them guns lol
  11. Mr.Loki

    Sort table

    That's that I'm trying to understand also.
  12. Mr.Loki

    me chat

    Why not just getDistanceBetweenPoints3D? function inRange(player,x,y,z,range) local isInRange = getDistanceBetweenPoints3D(x,y,z,getElementPosition(player)) <= range and true or false return isInRange end
  13. Mr.Loki

    Teams Tag

    In line 5 getTeamFromName should be getTeamName because getTeamFromName returns a team not the name. I added the color code to the team tag: addEventHandler ("onPlayerChat",root, function ( msg ) if getPlayerTeam ( source ) then cancelEvent () local plrTeam = getPlayerTeam ( source ) local teamName = getTeamName(plrTeam) local r,g,b = getTeamColor( plrTeam ) outputChatBox ("[ "..teamName.." ]#FFFFFF "..getPlayerName ( source ).." : "..msg , root , r, g, b, true ) end end )
  14. Mr.Loki

    Sort table

    Oh then my bad. Sorting the database seems alot more troublesome than just sorting the data when you call it.
  15. Mr.Loki

    Sort table

    searching the forum a bit wont hurt...
  16. Don't modify the slothbot resource, nothing needs to be changed in it. you have to learn about using exported functions. In another resource where you want to spawn the bots use this for example function spawnThePed(plr) local x,y,z = getElementPosition(plr) local radius = 20 local r = math.random(360) x = x - math.sin ( math.rad(r) ) * radius y = y + math.cos ( math.rad(r) ) * radius exports.slothbot:spawnBot(x,y,z,r) end addCommandHandler("spawn",spawnThePed)
  17. Mr.Loki

    Zombie

    If you are spawning the zombies near the player, check their location before spawning them with getZoneName and use the last arg: string getZoneName ( float x, float y, float z, [bool citiesonly=false] )
  18. This isn't the radius you are just adding 100 to the x, y and z positions. 100 z is spawning the peds in the air plus the 100 x and y is adding to that making it spawn really far from the player. This example calculates a random position around the player with a radius of 20 function spawnThePed(plr) local x,y,z = getElementPosition(plr) local radius = 20 local r = math.random(360) x = x - math.sin ( math.rad(r) ) * radius y = y + math.cos ( math.rad(r) ) * radius createPed(211,x,y,z) end addCommandHandler("spawn",spawnThePed)
  19. Mr.Loki

    Teams Tag

    onPlayerChat cancelEvent getPlayerTeam getTeamName getPlayerName outputChatBox
  20. Or simply use a database to save and load items... much much faster.
  21. That's because its triggered by everyone who streamed in the vehicle. Only trigger the event from the driver or the collided element. It's best to choose the latter if the collided element is a player.
  22. Yup i've done this already all you have to do is onClientPlayerDamage check if its a vehicle with the damage types then setPedAnimation and setElementHealth. You might want to multiply the damage based on the vehicle's speed so you can use getElementSpeed.
  23. Add this to your login event local elements = getAttachedElements(source) -- get all elements attached to the player who just logged in for _,blip in pairs(elements)do -- loop through every element if getElementType(blip)=="blip" then -- checks if the element is a blip setBlipColor(blip, teamcolor) -- sets the blip's color end end
×
×
  • Create New...