Jump to content

SDK

Members
  • Posts

    635
  • Joined

  • Last visited

Everything posted by SDK

  1. local Police = createTeam("Police", 0, 0, 255) -- this will create the team everytime the script starts local teamMarker = createMarker(1552.33, -1605.37, 12.382, 'cylinder', 2.0, 255, 0, 0, 150 ) function teamMarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then setPlayerTeam ( hitElement, Police) -- source is the marker in this event, hitElement is the player end end addEventHandler( "onMarkerHit", teamMarker , teamMarkerHit )
  2. It seems to be correct if I understand what you need. So what doesn't work? Debug errors, wrong results, ... (show an example) Also, while technically correct, don't use the same variables names capitalized ('x' and 'X'). It's confusing and a bad scripting habit.
  3. That looks pretty hard. setTimer ( controlChopperOff, 750, 0 ) setTimer ( controlChopperOn, 750, 0 ) These timers never get disabled, you probably want to change the 0 to 1. This may be not what you're looking for, but there exists an 'AI' hunter resource for race. I believe it uses setElementPosition but you can take a look in it. https://community.multitheftauto.com/index.php?p= ... ils&id=985
  4. SDK

    Help

    Use [lua] [/lua ] for your code. And my guess is that either you're using a call() or exports function the wrong way or that the resource isn't running (obviously).
  5. SDK

    GetElementData

    tostring -> tonumber and check your element data
  6. SDK

    GetElementData

    You're mixing both player variables and sometimes even use their names (strings) where a player element is needed. function schaden ( attacker, weapon, bodypart, loss ) if attacker then if getElementType ( attacker ) == "vehicle" then cancelEvent() else local victim = source local spielzeit = getElementData(victim, "PlayedH") local mindestzeit = 3 if tostring(spielzeit) < tostring(mindestzeit) then outputChatBox("Du kannst ihn nicht verletzen!", 255, 0, 0, attacker) outputChatBox("Du kannst nicht verletzt werden!", 255, 0, 0, victim) setElementHealth(victim, 100) setElementHealth(attacker, getElementHealth(attacker)-5) end end end end addEventHandler ( "onPlayerDamage", getRootElement(), schaden)
  7. SDK

    Login

    You could try to disallow command.login for the 'Everyone' acl so that nobody would have the rights to use it. The message can't be removed. You can detect it with the client event onClientChatMessage but afaik it can't be canceled.
  8. If you're unhappy with a server using modded vehicles either ask them to add an easy script like qaisjp wrote or go find a better server. MTA shouldn't have an hardcoded option for that since it can be scripted and it is, like ecoxp says, sometimes needed. The bandwidth is indeed a problem, currently all players need to download every file any other player has, with no option to send specific files to a specific player. A function like fileDownload(file, player) would solve that, but I don't know how possible that is.
  9. SDK

    GUI wont show

    In the client file, put the addEventHandler under the function. clickbutton must first be defined before you can assign it to an event In the server file, you're expecting a player variable, but that will just be nil. The source of your event will be the player, so use "source" instead of "player" in setPlayerTeam. Reason: the second argument in triggerServerEvent will be the source. (that class kw6 is a bug in the forum with setPlayerTeam)
  10. Well, that's just a syntax mistake: allowedIDS = {[520] = true, [438] = true}
  11. SDK

    GUI wont show

    The clientside added event must be allowed to get triggered from serverside, set allowRemoteTrigger to true: --client addEvent("showGUI", true) You dont need to add the event serverside btw, you can remove it there.
  12. "engineReplaceCOL: Object models are supported only (no vehicles or players)."
  13. It's important to read the wiki for these engine functions, there's a lot of limitations.
  14. Do what Ryder! said, limit the triggerClientEvent to source only
  15. For SKIN: https://wiki.multitheftauto.com/wiki/EngineLoadDFF For TANKER, I suggest just check your filepath's, cause it seems like loading the files didn't work. (and engineReplaceModel has only two arguments) Replacing paintjobs is not possible
  16. meta.xml is correct? (script must be clientside to use setWaterColor) Any messages from debug? /debugscript 3
  17. I'm sorry but this is a 377 lines paste, no one is going to look through that to help you. Either explain how your script works or/and paste the relevant code
  18. Oops, my bad, I meant to use executeSQLSelect in my post... So it's like ccw says, or using executeSQLSelect: local tableName = "race maptimes Sprint " .. mapInfo.name local result = executeSQLSelect( tableName, "timeMS" )
  19. Well change your getVehicleVelocity function then, it should receive a vehicle element, not a player/ped element.
  20. SDK

    Why not work?

    Offcourse it doesn't work, you need to script the loading part yourself... THIS IS ONLY STORAGE: function onPlayerQuitSaveClothes() local thePlayer = source local playeracc = getPlayerAccount(thePlayer) if playeracc then for i=0,17 do local texture, model = getPedClothe(thePlayer) if texture and model then setAccountData(playeracc, "clothes." .. tostring(i) .. ".texture", texture) setAccountData(playeracc, "clothes." .. tostring(i) .. ".model", model) end end end end addEventHandler("onPlayerQuit", root, onPlayerQuitSaveClothes)
  21. This script doesn't make sense, did you even test while making it? You don't put together a bunch of code and hope it works afterwards ... -- player joined function getAccountData ( playeracc, "data.cash" ) getAccountData ( playeracc, "data.points" ) getAccountData ( playeracc, "data.wins" ) getAccountData ( playeracc, "data.rank" ) This doesnt do anything, you probably want to store them in some variables, or set it as element data on a player -- player leaves function setAccountData ( playeracc, "data.cash", getAccountData ( playeracc, "data.cash" ) ) setAccountData ( playeracc, "data.points", getAccountData ( playeracc, "data.points" ) ) setAccountData ( playeracc, "data.wins", getAccountData ( playeracc, "data.wins" ) ) setAccountData ( playeracc, "data.rank", getAccountData ( playeracc, "data.rank" ) ) And this doesnt do anything either, you're getting the account data and then set the SAME account data again ... Correct your script to use element data and then come back, cause now it's just random.
  22. Could someone fix this please? getPedClothes is bugged as well getPedClothes() getPedClothes" class="kw2">getPedClothes()
  23. well, I took a quick look in race_toptimes and this is how it creates the table names: function SMaptimes:makeDatabaseTableName( raceModeName, mapName ) return 'race maptimes ' .. raceModeName .. ' ' .. mapName end raceModeName and mapName are received from the onMapStarting event from race, so I don't think there are any problems with it (I never had problems with it) The problem you had was with gsub, [ and ] are used in patterns
  24. This should get it, but I'm not sure local name = the_map_name -- fill in this bit local times = executeSQLQuery("race maptimes Sprint " .. name, "timeMS") That should have been executeSQLSelect ^
  25. SDK

    Why not work?

    This could be an example for your clothes saver. local acc = getPlayerAccount(thePlayer) if acc then for i=0,17 do local texture, model = getPedClothe(thePlayer) if texture and model then setAccountData(acc, "clothes." .. tostring(i) .. ".texture", texture) setAccountData(acc, "clothes." .. tostring(i) .. ".model", model) end end end (Rename getPedClothe = getPedClothes) Clothes will be saved like this: clothes.0.texture clothes.0.model clothes.1.texture clothes.1.model ... I didn't do the loader, you can do that one yourself
×
×
  • Create New...