Jump to content

SpecT

Members
  • Posts

    656
  • Joined

  • Days Won

    9

Everything posted by SpecT

  1. Hello and welcome to the Forums! If you want the ped to shoot with a weapon (if this is what you want) you should use the control named "fire" instead of "Vehicle_fire". Edit: Nevermind... didn't read the whole script. Sorry!
  2. Nah, read carefully the names of the variables - spawnpoint and spawnpoints! The "spawnpoint" variable is used to be sent to the spawnmanager and the "spawnpoints" is to get all the elements of type "spawnpoint". For some reason there are no spawnpoints (maybe the responsible resource for that is not running?) so it says that the interval is empty. To the author: Are you sure you started all the required resources ?
  3. Where did you download it from? I just downloaded the full pack with default resources from https://github.com/multitheftauto/mtasa-resources And when I start hedit it works just fine using both the command and the button.
  4. Did you start the resource ? Also after adding the resource in your server resources directory you will need to run the command refresh to load it up and then start hedit to start it. I'm sorry if those tips seem stupid to you but I don't know what exactly the situation is as you have only asked how to work with it and that it doesn't open.
  5. Hey and welcome to the Forums! In the server side (vis_server.lua) on line 15 is where this can be done. Replace the line with: if (source) and (door) and not (isPedInVehicle(source)) then It should prevent the interactions if the player is in a vehicle.
  6. Hey, I've moved the topic to the Resources section as it is a question regarding the resource "hedit". What exactly do you need to know about the resource? By default you can open the interface by pressing B or by using the command /hedit
  7. Hey, I think that this should be useful enough for you: function ococo() local theVehicle = getPedOccupiedVehicle (localPlayer) if theVehicle then local components = getVehicleComponents(theVehicle) -- get a table with all the components of the vehicle for k in pairs (components) do --outputChatBox(k) -- UNCOMMENT to get all the component names in chat --setVehicleComponentVisible(theVehicle, k, false) -- UNCOMMENT to hide all the vehicle componenets end setVehicleComponentVisible(theVehicle, "chassis", false) -- hide only the "chassis" component end end addEventHandler ( "onClientVehicleEnter", root, ococo )
  8. Hello and welcome to the Forums! I just tested a little bit the maxVelocity handling on most of the sport cars (don't know if it will be the same on the other vehicles) and found out that setting the maxVelocity to 85.5 locks the max speed to exactly 100km/h. It turns out that maxVelocity is not exactly the same as km/h value. So yeah, hope this helps!
  9. SpecT

    IP

    Oh, now I get it. Use the event onPlayerChat. To check whether the message contains an IP address in it use this: string.match(message,"%d+%.%d+%.%d+%.%d+") It will return true if an IP address is presented and false if not.
  10. SpecT

    IP

    Hey, What exactly do you mean ? To get player's IP you need to use the function getPlayerIP. Check the documentation for syntax and an example.
  11. Oh actually I didn't notice a mistake in the triggerServerEvent. Now this should work: triggerServerEvent("onAdminShot", resourceRoot, hitElement)
  12. Wait.. what exactly do you want to do with the vehicle when you shoot it ? From your first post I see you want the weapon to destroy the vehicles it hits. And in the code you posted above has fixVehicle function. Is it a mistake or intentional? You can either use destroyElement or blowVehicle (for explosion effect).
  13. SpecT

    random spam

    This should work for you: local lastNumber function getRandomNumber(from, to) local randNumber = math.random(from, to) -- generate random numbers until randNumber is different than lastNumber while(randNumber == lastNumber) do randNumber = math.random(from, to) end lastNumber = randNumber return randNumber end function testerino() outputChatBox(getRandomNumber(1,5)) end addCommandHandler("ok",testerino)
  14. It doesn't work because probably the vehicle was spawned from server side. This means you should destroy the vehicle from the same side. Use triggerServerEvent, pass the hitElement in it and destroy the vehicle in server side.
  15. Well then the "zomb" element doesn't exist. To prevent the errors you can put a check if "zomb" is an element in both the timer function and the respawnZombieInTime function and stop the execution of the function with "return". Something like this: function respawnZombieInTime ( zomb, immediatly ) if not isElement(zomb) then return end if exports.npc_hlc:isHLCEnabled ( zomb ) then exports.npc_hlc:disableHLCForNPC (zomb) end --if isElement ( getElementData ( zomb, "zombieShape" ) ) then destroyElement ( getElementData ( zomb, "zombieShape" ) ) end --if isElement ( getElementData ( zomb, "shapeFar" ) ) then destroyElement ( getElementData ( zomb, "shapeFar" ) ) end local resptimer = timeToRespawnZombie if immediatly then resptimer = 20000 end setTimer ( function ( shape, zomb ) if not isElement(zomb) then return end local attaches = getAttachedElements ( zomb,1) if attaches then for ElementKey, ElementValue in ipairs ( attaches ) do if isElement ( ElementValue ) then destroyElement ( ElementValue ) end end end destroyElement ( zomb,1) aliveZ = aliveZ - 1 -- this seems to be useless ?? if isElement ( shape ) then setElementData ( shape, "zSpawned", false ) setElementData ( shape, "zombie", false ) end end,resptimer, 1, getElementData ( zomb, "spawnShape" ), zomb ) --setElementData ( root, 'zombiesalive', getElementData ( root, 'zombiesalive' )-1 ) end
  16. setTimer ( function ( shape, zomb ) local attaches = getAttachedElements ( zomb,1) if attaches then for ElementKey, ElementValue in ipairs ( attaches ) do if isElement ( ElementValue ) then destroyElement ( ElementValue ) end end end destroyElement ( zomb,1) aliveZ = aliveZ - 1 if isElement ( shape ) then setElementData ( shape, "zSpawned", false ) setElementData ( shape, "zombie", false ) end end,resptimer, 1, getElementData ( zomb, "spawnShape" ), zomb )
  17. Hey, I think he meant the random nicknames MTA generates when you first join the mod and haven't set a nickname yet. If I am right I don't think you can get a list of those (not 100% sure tho).
  18. Isn't it better in the first timer function to check the sound volume and once it gets to 0 => kill the timer (fadeout) and stop the sound. This way you won't have to create another timer which will kill the first timer. The less timers the better.
  19. More like something like this: function onLogin(username) if isAccountAdmin(username) then givePlayerAdminRights() -- put here the stuff you use to give players admin access end end function isAccountAdmin(username) local admins = {} -- creates the table in which will be added the accounts of "Admin" group local group = aclGetGroup( "Admin" ) if (group) then for _, object in ipairs(aclGroupListObjects(group) or {}) do local objType = gettok( object, 1, string.byte('.') ) -- objType: gets the object type only, which can be either "user" or "resource" if (objType == "user") then -- checks if it's a player account local _name = gettok( object, 2, string.byte('.') ) -- ignores "user." by separating that from the account name table.insert( admins, _name ) -- adds the account name to the "admins" table end end end for i, name in ipairs(admins) do -- loop through the table "admins" if name == username then return true -- we found a match end end return false -- if nothing was found end *used the 2nd example in the wiki BUT if the server is big and there are many players logging in it might cause performance issues. To prevent that you can use the code from the "isAccountAdmin" to store the admin usernames in a table but on resource start so it won't do all the operations every time someone logs in. And when a player logs in use the loop to go through all the admin usernames and check whether the player's account name is one of them or not.
  20. Welcome to the forums! For all the SQL operations you should use executeSQLQuery as you have already noticed. There are many examples in the wiki page which you could use. I will show you an example how your first executeSQLUpdate will be with executeSQLQuery. executeSQLQuery("UPDATE stats SET cash=?, dms=?, wins=?, owner=?, skill=?, pts=? WHERE player=?", statsCash[playerName], statsDms[playerName], statsWins[playerName], statsOwner[playerName], statsSpts[playerName], statsPts[playerName], playerName) I guess now you know how to make the other ones. Don't hesitate to ask if there is a problem!
  21. SpecT

    help object

    Hey, I don't get what exactly "without creating the object using the map posts" means but I guess you want to make all the street lights unbreakable. You will need to find the object IDs of the lamps then do a loop through all the objects and when it finds the street lights object ID use setObjectBreakable.
  22. Hey, Do you have the error code of the BSOD ? There are many things that could cause a BSOD and its more likely to be a problem with your PC (drivers, overheating, etc..). I can try to help you find the cause but you will need to upload the files from C:\Windows\Minidump
  23. Hey, You can check the examples in this AclGroupListObjects function documentation. It loops through all the objects (usernames) in the group Admin. On resource start you can store all the usernames which are in the Admin group in a table and when a player logs in you can check if he is in this table and then set the admin rights.
  24. INSTALLATION Make sure you have Sublime Text installed. It works with both, Sublime Text 2 and 3 (thanks Goonz for confirming it works with Sublime Text 2). Download the 50pMTAEditor.zip from the link below. Extract the .zip to C:\Users\\AppData\Roaming\Sublime Text 3\Packages\User\50pMTAEditor\ Run Sublime Text 3 and create a new file (File -> New) - this is only necessary so that you can see if it works Select the syntax highlighter (View -> Syntax -> Lua (MTA:SA) ) Select color scheme which has colors of MTA function names. Red for client-side, Orange for server-side and Blue for shared functions (Preferences -> Color Scheme -> User -> 50pMTAEditor -> Monokai-MTA-Edit) Source: *PS: Sorry for writing in English in this section. Please use Google Translate so you will understand.
  25. Hello, The problem is from YouTube's side. Loop doesn't work if you don't add playlist ID in the arguments. You can simply put the video ID as playlist ID. Something like this: https://www.youtube.com/embed/{VIDEO_ID}?autoplay=1&showinfo=0&rel=0&controls=0&disablekb=1&mute=1&loop=1&playlist={VIDEO_ID}
×
×
  • Create New...