
unknooooown
Members-
Posts
259 -
Joined
-
Last visited
Everything posted by unknooooown
-
local theMarker = createMarker ( -1250.1999511719, 463.89999389648, 9.60000014697, "cylinder", 10, 0, 0, 255, 0 ) local subwaygate = createObject (-1250.1999511719, 463.89999389648, 9.60000014697, 0, 0, 0 ) -- Make Marker and Gate function openGate ( hitElement ) if (getElementType(hitElement) == "player" ) then moveObject ( subwaygate , 1500, -1701.7937011719, 689.03674316406, 24.037502288818, 0, 0, 0 ) -- Changed 'gate' to 'subwaygate' end end addEventHandler( "onMarkerHit", theMarker, openGate ) -- Open Gate function closeGate ( leftElement ) if (getElementType(leftElement) == "player" ) then moveObject ( subwaygate, -1250.1999511719, 463.89999389648, 9.60000014697, 0, 0, 0 ) end end addEventHandler( "onMarkerLeave", theMarker, closeGate ) -- Close Gate local theMarker = createMarker ( -1530.3000488281, 482.20001220703, 9.6999998092651, "cylinder", 0, 0, 255, 0) local subwaygate = createObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 255, 0 ) -- Changed 'gate' to 'subwaygate' -- Define Marker and Gate function openGate ( hitElement ) if (getElementType(hitElement) == "player" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end if (getElementType(hitElement) == "vehicle" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end addEventHandler( "onMarkerHit", theMarker, openGate ) -- Open Gate function closeGate ( leftElement ) if (getElementType(leftElement) == "player" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end end addEventHandler( "onMarkerLeave", theMarker, closeGate ) -- Close Gate Try that.. Think it works not. I have commented the changed in the scripts.
-
That doesn't change anything..
-
Try making it work yourself for once.. All I see you do is complain when things dont work.. As people have told you before, you do have potential, but you are so lazy.. Read the wiki and figure you out for yourself.
-
@charly-man Try posting the entire script. Something looks wrong in the scripts you posted earlier, but I have to see the entire script to figure it out.
-
@charly-man What is up with this line? if hasObjectPermissionTo( hitElement, "function.kickPlayer" ) then That could cause some problems
-
Found the problem. Change this line. for _,v in ipairs(getElementsByType("player")) do To this. for i,v in ipairs(getElementsByType("player")) do Just tested it.. Works with no errors
-
Oh yeah Thats because you have to include the file in the acl.xml file It needs to have admin rights to use the kickPlayer() function. Open your acl.xml in C:\Program Files (x86)\MTA San Andreas 1.1\server\mods\deathmatch Replace "NAME-OF-THE-RESOURCE" with your resource name Another thing. When you are scripting, try to use /debugscript 3 - It can help you detect a lot of different problems. If you had used it to test this resource, you would have noticed the error: Access denied @ 'kickPlayer'
-
function weaponSwitchDisableMinigun ( previousWeaponID, currentWeaponID ) if currentWeaponID == 38 or 36 or 35 or 37 then kickPlayer(source) outputChatBox ( getPlayerName(source) .. " was kicked for spawning a " .. getWeaponNameFromID ( currentWeaponID ), getRootElement(), 255,0,0 ) end end addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), weaponSwitchDisableMinigun ) That should work. I changed getClientName -> getPlayerName Also made a change in your if statement: if currentWeaponID == 38 or currentWeaponID == 36 or currentWeaponID == 35 or currentWeaponID == 37 then Changed to this: if currentWeaponID == 38 or 36 or 35 or 37 then
-
Hi again. Thats very simple to solve. function testFunc() local a = "/cmd name value" local cmd = gettok ( a, 1, 32 ) local name = gettok ( a, 2, 32 ) local value = gettok ( a, 3, 32 ) local cmd = string.sub(cmd,2) -- We use this line to remove the '/' from '/cmd'. outputChatBox("Cmd is: "..cmd) outputChatBox("Name is: "..name) outputChatBox("Value is: "..value) end addCommandHandler("result",testFunc) Let me explain what happens on the line: local cmd = gettok ( a, 1, 32 ) a = The string we want to split up, in this case, the string is "/cmd name value" 1 = The first word of that string 32 = The ASCII number representing the character you want to use to separate the word/string. In this case, we want to use SPACE to seperate our string, and space has the value '32' in ASCII. You can read about gettok here: https://wiki.multitheftauto.com/wiki/gettok And ASCII here: https://wiki.multitheftauto.com/wiki/ASCII The example will return: Hope that makes sense UPDATE: There is also https://wiki.multitheftauto.com/wiki/Split Works almost like gettok, but returns a table instead of a string. Look at the example in the link to understand it. But if you don't get, just ask in here
-
You can do something like: function Jail (player, command, name) local thePlayer = getPlayerFromName(name) local theVehicle = getPedOccupiedVehicle(thePlayer) if thePlayer then ---------------------------------------------------- if theVehicle then removePedFromVehicle(thePlayer) end --------------------------------------------------- setElementPosition ( thePlayer, 3, 4, 20 ) setElementData ( thePlayer, "isJailed", true ) outputChatBox (name.." has been jailed", getRootElement(), 255, 255, 255, true ) end end addCommandHandler("jail",Jail) The reason you can't move the player when he is in a vehicle, is that both elements would have to be moved. But since a player wouldn't bring his vehicle to jail, we don't need to move anything other than thePlayer.
-
Could you be a little more specific?
-
I think he is talking about calculating the distance between two objects that have already been attached. I could be wrong, but I am gonna post an example of what I think he wants anyways Maybe someone else can use it if they come across the post x1,y1,z1 = 10,10,10 x2,y2,z2 = 30,30,30 outputChatBox(x1-x2..","..y1-y2..","..z1-z2) That would return: -20,-20,-20 You can also use the function getDistanceBetweenPoints3D https://wiki.multitheftauto.com/wiki/Get ... enPoints3D x1,y1,z1 = getElementPosition(obj1) x2,y2,z2 = getElementPosition(obj2) distance = getDistanceBetweenPoints3D(x1,y1,z1,x2,y2,z2) outputChatBox("Distance between 'obj1' & 'obj2' is: "..distance)
-
http://lua-users.org/wiki/StringLibraryTutorial An example of string.sub that you can use: msg = "/test" testStringSub = string.sub(msg,1,1) print(testStringSub) This will return the "/" of msg. https://wiki.multitheftauto.com/wiki/IsE ... inColShape local circlearea = createColCircle ( 0, 0, 10 ) function ColShapeHit ( thePlayer, matchingDimension ) local detection = isElementWithinColShape ( thePlayer, circlearea ) --A variable called 'detection' stores the result of asking if the player --who entered a colshape is within the specific colshape called 'circlearea'. --The result is either true or false. if detection then outputChatBox ( getPlayerName(thePlayer).." is in the 'circle area' col shape" ) end --if detection was true then the player is in the col shape. Output a --message to confirm this end addEventHandler ( "onColShapeHit", getRootElement(), ColShapeHit )
-
@-=I Blaawee I=- What part of "--RE-DISTRIBUTE NOT ALLOWED" didn't you understand?
-
Which he is gonna have to figure out for himself. As I said, I am not gonna make the resource for him. But I dont mind pointing him in the right direction.
-
Error message:[Not fixed (22November)] Need admin help again
unknooooown replied to davve95's question in Client
Oh. I didn't understand your first post the first time.. My bad. But yeah. Post the warning in here and we will see what we can do to help you -
Hi. Just made an example that should be pretty easy to understand. Please note that this is just one way of doing it. Other people might not do it the same way. Also, this is only a resource to help you learn, so its not very good or optimzed. But the script is tested and works for what you need. If you have any questions, then just ask me. You can also send me a private message if you'd like. Just remember this, I am not gonna make your resources. I only did it this one time because you have to start learning somewhere Feel free to edit this any way you want. Best of luck! PS. Almost forgot to tell you how it works You simply input the ID of the vehicle you want to spawn. You can find all valid IDs here: https://wiki.multitheftauto.com/wiki/Vehicle_IDs META: <meta> <script src="vehClient.lua" type="client" /> <script src="vehServer.lua" /> </meta> CLIENT: --[[The function below is the spawn window itself. If you have any previous experience with scripting, even HTML, some of this should make sense to you.--]] function openVehicleSpawnClient() local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 233, 104 local left = screenWidth/2 - windowWidth/2 local top = screenHeight/2 - windowHeight/2 showCursor(true) vehSpawnWin = guiCreateWindow(left, top, windowWidth, windowHeight, "Vehicle Spawner", false) guiWindowSetSizable(vehSpawnWin, false) sampleLabel = guiCreateLabel(15, 25, 201, 20, "Sample Vehicle Spawner", false, vehSpawnWin) guiLabelSetHorizontalAlign(sampleLabel, "center", false) guiLabelSetVerticalAlign(sampleLabel, "center") -- The lineEdit is where you type the modelID you want to spawn. lineEdit = guiCreateEdit(12, 45, 211, 20, "", false, vehSpawnWin) guiEditSetMaxLength(lineEdit, 32767) -- After entering the modelID you wish to spawn, you press the button "Spawn Vehicle" -- The button triggers the next function we use: spawnVehicleClient spawnBtn = guiCreateButton(14, 75, 211, 23, "Spawn Vehicle", false, vehSpawnWin) addEventHandler("onClientGUIClick", spawnBtn, spawnVehicleClient, false) end addEvent("openVehicleSpawn",true) addEventHandler("openVehicleSpawn",localPlayer,openVehicleSpawnClient) --[[This function gets the modelID you entered in the window, checks if it exists,- - and if the model does exist, it will trigger a serverside event. If the vehicle does not exist, you will get a message with an error warning.--]] function spawnVehicleClient() local id = guiGetText(lineEdit) triggerServerEvent("spawnVehicleServer",localPlayer,id) showCursor(false) guiSetVisible(vehSpawnWin,false) end SERVER: --[[ The first thing we do in our script is create a marker that the player has to enter. When the player enters this marker, it triggers "addEventHandler("onMarkerHit",vehMark,openVehicleSpawnServer)" That line is what triggers our first function. In this case: openVehicleSpawnServer--]] local vehMark = createMarker(-706,966,11.447,"cylinder") function openVehicleSpawnServer(hitElement,matchingDimension) -- Checks if the player is in a vehicle. if getPedOccupiedVehicle(hitElement) == false then -- If the player is not in a vehicle, we will open the spawn window. triggerClientEvent(hitElement,"openVehicleSpawn",hitElement) return true end end addEventHandler("onMarkerHit",vehMark,openVehicleSpawnServer) --[[This function creates the vehicle, if the player is not already in a vehicle.--]] function spawnVehicleServer(id) local x,y,z = getElementPosition(source) local myVeh = createVehicle(id,x+5,y,z) if id == "" then outputChatBox("ERROR: You did not input any value.",source,255,0,0,true) triggerClientEvent(source,"openVehicleSpawn",source) return false end if myVeh then warpPedIntoVehicle(source,myVeh) outputChatBox("You have spawned a "..getVehicleNameFromModel(id).." and have been warped into it",source,0,153,0,true) else outputChatBox("ERROR: The requested ID does not exist.",source,255,0,0,true) triggerClientEvent(source,"openVehicleSpawn",source) end end addEvent("spawnVehicleServer",true) addEventHandler("spawnVehicleServer",root,spawnVehicleServer)
-
Error message:[Not fixed (22November)] Need admin help again
unknooooown replied to davve95's question in Client
Hi. There is another way to take screenshots, you know? Have a look at the picture below. http://www.designadinblogg.se/wp-conten ... screen.jpg 1. Press that button. 2. Open Paint, Photoshop or another image editing software. 3. Press CTRL+V 4. Save the image. Either as Jpg or Png. 5. Upload the image to http://imageshack.com or http://imgur.com After that, post the image in here. OR Write down the error you are getting, and post it in here. It can't be that hard. Its possible that someone can help you without the screenshot, but the info you are giving us is very limited. -
Google: MTA Javascript sdk https://wiki.multitheftauto.com/wiki/Javascript_SDK
-
SA:RPG[News Topic] | Looking for future testers.
unknooooown replied to unknooooown's question in Client
Please send me a private message. -
SA:RPG[News Topic] | Looking for future testers.
unknooooown replied to unknooooown's question in Client
I really am. I am 110% committed to the project I want to work with scripting sometime in the future, so the main reason I do this, is for the learning. But of course also because I know that people and myself can have a lot of fun on the server for years to come Drop me a private line Benxamix2, so I dont forget about you -
SA:RPG[News Topic] | Looking for future testers.
unknooooown replied to unknooooown's question in Client
Moved the topic. I have repoted it and asked if it can be deleted. Use this one now Sorry for the inconvenience. -
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PLEASE USE: http://sarpg.tumblr.com/ FROM NOW ON! Comments in this topic will still be read ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 11/18/2011 - A new chance for the project! I finally got in touch with one of my old friends from my time @ 3DCollege Denmark. After telling him about the project, showing him the work and progress he was willing to offer me some help. The guy is a VERY talented designer/gfx artist, so adding him to the team will be a huge help to us. He is gonna be the guy that designs our final gui and other gfx elements of the server. With him on the team, we can also take the gfx to the next level, so things will look really like. You can have a look at his work below. http://artbyahm.blogspot.com/ Please stay tuned! This topic will be updated everytime there is something new to tell. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 11/17/2011 - Short Server Intro I am currently scripting an RPG server and very soon, I am gonna need some decent testers to help me out. I have been working on this project for a little over 4 months now. And I finally feel like having some people on the server to help me test its performance. I have never had more than 4 players online at a time, because the project has been kinda secret up until now. Almost all of the resources on the server have been created by me, very few resources like realdriveby, scoreboard and adminpanel are official resources that I have used. I am the only person that really works on making the server. So I am behind the scripting, designing of GUI, research, custom sounds and most of the hard work. I am lucky enough to have 2 people to help me with the stuff that really takes a long time, like finding the correct positions around the world, select models, basic testing and so on. If you want to help me out, please send me a private message so we can have a talk. When you have contacted me, we will have a talk, and I will explain what I want you to do, and of course get to know if, and see if I can use you. I dont want to sound like a douche when I say that, but the truth is, there are a lot of retards around ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _____________________________________________________________________ Server Description: Coming soon. The server is still under development! I do not expect it to go online before sometime in march/april next year. _____________________________________________________________________ To do list: Server: - Optimize all existing resources for better server performance. Client: - Make a final version of the custom GUI. - Replace all GUIs with custom GUI. Gameplay: - Add jobs/occupations to all classes. - Rewrite the Wanted System Resource(Scripted in a hurry) - Create Fun Zones*1 for all teams. - Make a custom chatwindow for server/combat/reward messages.*5 - Rewrite Transport Resource*2(Scripted in a hurry) - Optimize Aircraft Passenger Resource*3 - Add interiors. Bank, more Food Stores - Add more Pay N Spray in LV - Add "Owner"*4 icon to properties - Optimize Experience/Level system - Add Talent Point System - Add Perks - Optimize(or)Rewrite Vehicle Dealer Resource. List is not complete! *1Fun Zones - Area where players can relax and have fun with other players from their own team. *2Transport Resource - A resource that lets players with the "Transport" class, earn money if they carry passengers in a vehicle. *3Aircraft Passenger Resource - A resource that lets big planes like, Shamal and AT-400, carry passengers, and give the pilot money in return. *4"Owner" icon - A icon that only the owner of a propery will be able to see. He can use this icon to access control of his property, to set spawnpoint, spawn vehicles, check atm(if there is one at the property) *5 Custom ChatBox - This is currently being developed by Remi-X. Thanks for the support! _____________________________________________________________________ Videos: Property Creator(Admin Tool): https://www.youtube.com/watch?v=H0hLdEH5u0c - Watch from 0:50 Some of the resources at work: https://www.youtube.com/watch?v=JIXcsik4zTk Video Info: I know the videos look very Movie Maker'ish.. And well.. Thats because they are Haven't really got the time to create something that looks really good, because the server is still under development, so there is really no need for it. Better looking videos will be added later. Screenshots: Coming soon. _____________________________________________________________________ Before the end: Thanks to all the people on #mta and #mta.scripting for their help. (Remi-X - You da' man!) I wouldnt have been able to learn this much, this fast, without their help. Started scripting 6 months ago, so I have learned a lot very fast. But it has been worth the effort! _____________________________________________________________________ And even if you dont want to help me test the server, any feedback is still welcome!
-
Ah okay.. I see.. Thanks for the answer. But does anyone know when it happens? Does it happen when the player tabs out or when he enters the game again? Don't you think it would be possible to fix it somehow? Probably cant disable ALT+TAB from working from the game? Or if it only happens when the player tabs back in, he could just be moved out of the interior when ALT+TAB keystrokes are detected..