Jump to content

Scooby

MTA Contributors
  • Posts

    976
  • Joined

  • Last visited

Everything posted by Scooby

  1. Yeah ive tried the obvious, i thought maybe someone like u might know of some other way tho basically, i have a dm server, but it seems just lately people are getting touchy about dying and gaining that 1 extra death, so they bind /reconnect to a key so that when theyre on low health, they press it to reconnect and no life is lost... they can then respawn again.... and play on.
  2. does anyone know if its possible to disable the /reconnect command ? or if its not possible, can anyone think of a way to detect when a player types it, so i can take the relative action when they rejoin. ive tried onClientConsole but it seems it doesnt show for /reconect.
  3. Scooby

    OnMarkerHit

    u have server and client functions messed up, decide which it will be... onMarkerHit - server side, onClientMarkerHit - clientside getLocalPlayer - clientside, source - server side u have the right idea, u just need to work out which u wanna use then swap the above^ also, line 3 needs to be called: function jobmarker1 like in ur handler because of the marker variable above with the same name. and remember MarkerHit passes the element that hit the marker to the function, so if u use 'thePlayer' this may also be a vehicle, if the player is in a car at the time he hits the marker. so u should include if getElementType(element) == "player" then..... this will prevent it from giving errors when it tries to get player info from a vehicle.
  4. just a quick reply.. sorry u shouldnt use triggerServerEvent in onClientRender, that would be too extreme... update the data in a function on a timer to update it every second or two if u need it that often. also, u will need 2 triggers 1 server and 1 client, because: ItemDes = triggerServerEvent("getItemDes", _root ,itemid) will return true/false if it was triggered, it cant be used to retrieve data, for this u need to request the info with your first trigger, then once it triggers that function, to trigger back to the client with the itemid. so something like: client: triggerServerEvent("requestItemUpdate",getRootElement(),getLocalPlayer()) -- use this to request the data addEvent("receiveItemUpdate,true") function receiveUpdate(itemID) --update variable here end addEventHandler("receiveItemUpdate",getRootElement(),receiveUpdate) server: addEvent("requestItemUpdate",true) function requestUpdate() triggerClientEvent(source,"receiveItemUpdate",source,itemID) end there are other ways too, u could also use setElementData(.... then retrieve it clientside with getElementData(... sorry i dont have time to write it for u... dinner break (im sure kenix will help u out )
  5. well he doesnt need a loop just to get the health of 1 vehicle and 1 trailer, also, getting the health in onClientRender, rounding it etc... is less efficient than using a variable which can be updated when the vehicle health changes.. either by using setElementData or triggerClientEvent with an onVehicleDamage Event handler set to that vehicle. while using scripts... try to think how they would work with 100 of the same running... also on server with a lot of people. a working script is not the same as a script working efficiently.
  6. once again... bombarded with so many choices of fix... (kenix... u should work on ur efficiency - i must admit tho... u do give me the odd giggle reading thru ur code) another thing to look into once u have it working is, ur triggering all client events when u trigger, im not sure if theres a reason for this but im guessing not... im guessing that ur testing alone so this might not be an issue yet. but basically: triggerClientEvent("HP",root,mVehicle,mTrailer) will be triggered for ALL clients... u should be using: triggerClientEvent(thePlayerOnTheJob,"HP",root,mVehicle,mTrailer) which will only trigger for the player on the job.
  7. i suppose for the markers, u could just make them work if the player is on foot, since ur spawning them a car anyway. anyway... good luck, let me know how u get on.
  8. hmm at a glance it looks ok (a few random variable names for players tho - playa, player, source, localPlayer), the only thing i can see is... if ur in a vehicle when u hit the marker, that too will be detected as hitting it. the parameters for are: giveVehicle(hitElement,matchingDimension), so in yours, the element hitting the marker is 'source' which could be a vehicle if ur in one. so in: function giveVehicle( source ), below this u should add: if getElementType(source) == "player" then give that a try. i dont think u need the colsphere either.. u can do this with just the 1 marker and 1 blip, i dont see why u need a colsphere too. just create ur marker and use "onClientMarkerHit". anyway... ive rambled on enough i think lol. check out what ive said and post back if ur still having problems.
  9. csmit195 posted to u what i made (with some extras from kenix, he added a timer to show when ur unmuted ) which had a few lines added that arent needed and a function missing... but as long as ur version is working for u and ur happy with it.... then thats ok.
  10. no, thats what 'I' made, which now has a few extra lines added by various people along the way... some lines of which arent even needed and some which could be written better and as i said previously, some of which are now missing. The final post of the script is incomplete.. so anyone wanting to use this, cant, unless they look back at the previous posts and try to work out which is the full working version.... which they probably wont know. i would help more people on these forums but it seems 1 person cant help.... 5 people have to reply with their idea of help, which wouldnt be so bad but most of the time what people post back with doesnt work... or isnt what people have asked for and people just end up getting more confused. anyway... glad u have what u needed and its working how u want now.
  11. still, the warning message will be wrong, since the script doesnt work with a counter like that... it counts for spam (chatting 3 times) over 2 seconds then decreases it by 1 each time. which was why the original warning message doesnt have a counter. i guess as long as ur happy with it then thats all ok.
  12. u all removed a function so this wont even work now.... well done.
  13. I know this isnt exactly what youve asked for evil, but this is close, i used it on my server for a long time and it seemed to work pretty well for me. give it a try and see what u think. dont forget to give rights for the script to kick/mute in the acl. (im sure u wouldnt but ) local spam = {} local setting = get("kick") -- true = kick, false = mute function loseSpam(player) if spam[player] > 0 then spam[player] = spam[player] - 1 end end function onChat ( message, messageType ) --if messageType == 0 then -- this will work for all chat, remove the -- to change to just normal chat. spam[source] = spam[source] or 0 spam[source] = spam[source] + 1 if spam[source] == 3 then outputChatBox("Warning - Do Not Spam! ",source,255,0,0) else if spam[source] > 3 then if setting then outputChatBox("Kicking " .. getPlayerName(source) .. " For Flooding The Chat!",getRootElement(),255,0,0) kickPlayer(source,"You Have Been Kicked For Flooding!") else setPlayerMuted(source,true) outputChatBox(getPlayerName(source) .. " Has Been Auto Muted [3 mins]",getRootElement(),255,0,0) setTimer(setPlayerMuted,180000,1,source,false) end end end setTimer(loseSpam,2000,1,source) --end end addEventHandler ( "onPlayerChat", getRootElement(), onChat) function quitPlayer() spam[source] = nil end addEventHandler ( "onPlayerQuit", getRootElement(), quitPlayer )
  14. clearly that will give all the warnings in one go and is nothing like what hes after.. he asked for: after 3 lines of spam to give a warning 1/3 + msg , then warning 2/3 + msg and finally warning 3/3 + msg + kick the script posted is nothing like what he needs, its more like a function with a load of outputchatbox lines sorry i dont have time right now to help tho
  15. Scooby

    sethp to me

    what u have wont flip the car, it'll just lift it by 5. to flip it use: local x,y,z = getElementRotation(vehicle) setElementRotation (vehicle,x,y + 180,z)
  16. Scooby

    help

    the image is too small...
  17. if u want the player and vehicle to be teleported: function teleport_areabase_gate2(element,dim) if getElementType(element) == "player" and dim then local skin = getElementModel (element) if ( skin == 130 or skin == 160 ) then local vehicle = getPedOccupiedVehicle(element) if vehicle then setElementPosition (vehicle, 2485.6999511719, 2773.5, 11,false) end end end end u can do the same for the other function.
  18. this will add a column to the scoreboard named 'HUNTER' addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function() call(getResourceFromName("scoreboard"),"scoreboardAddColumn","hunterkills",nil,70,"HUNTER") end ) then use this below in a function when a player joins. (hint: you need to put it in "onPlayerJoin") setElementData(source,"hunterkills","0") then u need a similar line adding in onPlayerWasted to update the kills amount. i wont do all the work for u... have a go and see if u can finish it. when u get stuck, post back what u have and we will help u fix it. good luck.
  19. u cant just add the commands and expect them to work, u need to add the functions that go with the commands to make them do what u want. theres no command to open gates/barriers... this has to be scripted. the same goes for everything really.
  20. 1300 is a lot to search through but i would think u should be able to manage a loop of that size unless ur trying to run this function on few people at the same time (ie: get the locations of all players at once) then its never gonna work. u can of course slow the loop down with various methods but then the string returned will be delayed. have u thought about having a look how its done in the admin resource? since country flags are shown there too. theres definitely a better way than looping through all these ip's in the table.
  21. I understand better now thx.. ok if ur still having problems.. try this: function getPlayerCountry(player) local IPStart,IPEnd,IPS,IPE local IP = getCodedIP(getPlayerIP(player)) for k,v in pairs(IPList) do IPStart = tostring(gettok(k, 1, 45)) IPEnd = tostring(gettok(k, 2, 45)) IPS = getCodedIP(IPStart) IPE = getCodedIP(IPEnd) if IP >= IPS and IP <= IPE then return v end end return "N/A" end function getCodedIP(ip) local temp1,temp2 = "","" for a = 1,4 do temp1 = tonumber(gettok(ip, a, 46)) if temp1 < 10 then temp1 = "00" .. temp1 else if temp1 < 100 then temp1 = "0" .. temp1 end end temp2 = temp2 .. temp1 end return temp2 end ive made a function to do what u said urs did since u didnt provide one. this should work however i dont have 1300 ip's to test it on, so ul have to let me know. this converts a normal ip into a 12 digit number like u said, and then compares it with the ips in the table. then returns the flag string from the table if the number is between start and end numbers, or returns the string N/A if nothing is found.
  22. Scooby

    Help

    its possible the server script triggers the client event before the files are downloaded to the client... but the script should work ok tho once the inital start up is complete. edit: just noticed ur warning msg: onServerCallsClientFunction i dont see this in ur post... are u sure this error is related to this script?
  23. wow all that just to remove the dots... u do know thats what gettok does? so really the function isnt needed. if u havent resolved this by tonight, i'll fix it for u. but i have to go out for a couple of hours now and ul have probably sorted it by then. good luck... i'll check back in a bit.
  24. well the efficiency of ur whole loop needs improving... is there anything in ur math.adjust function u can improve on to make more efficient? im not really sure of the purpose of this... what do u adjust it to?
  25. ok so it works ok then with less lines??? say 300?
×
×
  • Create New...