-
Posts
2,973 -
Joined
-
Last visited
-
Days Won
3
Everything posted by 50p
-
How do you want to make him bleed? FX functions will be available from DP3. As they said previously, use player's health and compare the health with those values: -- "This event is triggered when a player is damaged, in any way." addEventHandler( "onPlayerDamage", getRootElement( ), function( ) local health = getElementHealth( source ) -- get player's health if health > 90 and health <= 100 then -- he has more then 90 and less then or equal to 100 hp here elseif health > 70 and health <= 90 then -- his hp is more then 70 and less then or equal to 90 elseif health > 10 and health <= 70 then -- you probably know what this means now... end end )
-
Or if you know the player element, you can use getPlayerOccupiedVehicle and getPlayerOccupiedVehicleSeat (to see if he's driver).
-
http://development.mtasa.com/index.php? ... ayerWasted 2nd example shows you how to script it.
-
It is possible but first, it must be written inside of MTA (otherwise it would be "cheating" because not everyone would see gate moving, I don't know if it's illegal either) and second, you must create a new topic for this and leave this topic alone, it's a bit off-topic.
-
There is this thing: Its called reading the thread Try scrolling up It happens... I replied to the last page question and didn't notice this page exists.
-
There is an event: onMarkerHit and onPlayerMarkerHit.
-
RP Game Mode Help/Progress topic "RPG Server (ALPHA STAGE)"
50p replied to Michael_Sund's topic in Scripting
Or you can use table.concat to make a string out of table. function admAd (player, commandName, ... ) local admtext = table.concat( arg, " " ) outputChatBox ( "Server Security:" .. admtext .. ".", getRootElement(), 255, 0, 0, true ) end -
Players will have to download these objects anyway, so it would be faster if they downloaded the files from a website and placed them in the resource folder. Also, custom objects (such as akina hill) muist be used in client side code.
-
I think he wants to make something like in Need For Speed, you get points for drifting and the one who's got the most points wins. Well, TBH, I've tried to make such a script when MTA was released but I got into trouble with getting scores for drifting North because the angles are like 45 (north-east) and 315 (north-west) and I stopped developing it... but if someone wants to create such script I'll send you a bit buggy script so you can use the code.
-
well atleast the table problem is gone but now this ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value) ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value) ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value) ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value) ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value) ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value) ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value) and it doseent save my cash in the bank so every time i enter its 0$ Have you modified bank.locations.xml file? Try to clear the file and paste this: <banks> <bank name="Western Onion" > <location posX="361.8298" posY="173.6187" posZ="1008.3828" /> <entrance posX="2412.7126" posY="1123.8426" posZ="11.8203" teleX="387.8428" teleY="173.6187" teleZ="1008.3828" teleRot="90" teleInterior="3" /> <exit posX="389.8428" posY="173.6187" posZ="1009.3828" teleX="2414.7126" teleY="1123.0426" teleZ="10.8203" teleRot="270" teleInterior="0" /> </bank> </banks> The error comes up because it was meant to be "Simple Banking System" so I wasn't paying much attention to details. Also, if you could tell me when you get this error? When you enter bank marker, entrance or exit? And about that $0, you will always see it if you won't deposit some money first. I've added ATM thingy to the bank locations file, so you can specify if you want it to be ATM or a bank. Take a look here: http://y50p.50g.com/images/mtasa/mta-screen0051.jpg Great! so when will we be able to use it? As soon as I will add all the features I've planed, it won't take long. I'll think about it... but I don't use MySQL (as a few of you discussed here) and I don't choose db. Anyway, I'll think of an additional parameter for those functions that set/get bank balance. This is probably going to be a larger re-write than you would ever consider doing, but this is basically some notes and pseudo code I wrote over lunch at work, for what would have been a banking system I was going to write, before you posted about the update. This was primarily for my own use with my own resources and mysql table structures, but was going to be written in a way that anyone else could use it, either on it's own, or with other resources, or table structures. It's a bit of a mess, as it's just notes rather than actual code, but it might help plan things? I'm not going to implement MySQL in this resource. It's all supposed to be simple, even those people who come here asking how to start resource should be able to configure. What I'm going to do is add one more parameter (table) in some of the exported functions which will tell bank resource what's SQL table name, what are the names for account and balance fields in their tables. So for example: local bank_resource = getResourceFromName"bank" local bankInSQL = { "bank_accounts", "balance", "username" } call( bank_resource, "withdrawMoney", player, 1000, bankInSQL ) And the money will be withdrawn from table named "bank_accounts" and field named "balance", it will search for user name in field "username".
-
You must first read Lua manual and then read MTA wiki about how the event system works... theMarker = createMarker ( 0, 0, 4, "cylinder", 2.5, 255, 0, 0, 175 ) function markerKill ( sourcePlayer ) if source == theMarker then -- check if marker you enter is theMarker you created, if so, kill the player killPlayer(sourcePlayer) end end addEventHandler( "onMarkerHit", getRootElement(), markerKill )
-
RP Game Mode Help/Progress topic "RPG Server (ALPHA STAGE)"
50p replied to Michael_Sund's topic in Scripting
You have to wait untill dp3 for peds an animations, but you can script a buy/sell house script in dp2. -
I'll surelly add them. I've added ATM thingy to the bank locations file, so you can specify if you want it to be ATM or a bank. Take a look here: http://y50p.50g.com/images/mtasa/mta-screen0051.jpg I'll think about it... but I don't use MySQL (as a few of you discussed here) and I don't choose db. Anyway, I'll think of an additional parameter for those functions that set/get bank balance. scareface1994, ok its done, i opened registry.db, now what? Open that file (registry.db) and create a table, name it "bank_accounts" (if somehow it's not there) and add 2 fields (columns), name them: username (type of field: TEXT) and balance (type of field: NUMERIC)
-
There will be an update soon which will include: - exported functions: getBankID getBankPosition getBankMarkers getBankMarker getBankEntranceMarker getBankExitMarker getBankName setBankName countBanks getBankAccountBalance setBankAccountBalance getPlayersInBank getPlayerBank isPlayerInBank - simple example resource which shows how to use exported functions (just in case if somebody doesn't know how to use them) If you have ideas on new functions just post them here and I'll think of implementing them.
-
You have to check if the marker you hit is teleport marker and which teleport marker. Something like this: local teleport = createMarker ( 2417.1013183594, 1130.9943847656, 10.8203125, "cylinder", 2.5, 0, 255, 0, 175 ) function MarkerHit ( hitPlayer, matchingDimensio ) if getElementType(hitPlayer)=="player" and source == teleport then setElementPosition(hitPlayer,1827.4294433594,594.36029052734,51.134124755859) setPlayerRotation(hitPlayer,90) outputChatBox ( "Welcome to Dr.Philly Blunt's Projectz Island" ) end end addEventHandler("onMarkerHit", getRootElement (), MarkerHit)
-
What is wrong with bank resource? Doesn't that save money for you? It uses SQL database so it's not editable using simple Notepad. Test it and see if your money gets saved (you first need to register and login to save your money in bank).
-
Don't attach onClientPlayerJoin event to local player. Use onClientResourceStart to create the GUI.
-
RP Game Mode Help/Progress topic "RPG Server (ALPHA STAGE)"
50p replied to Michael_Sund's topic in Scripting
You must be doing something wrong. Are you sure the file with command is added to meta.xml? Are you sure the server uses the updated file? Do you get any errors in debug window ("/debugscript 3")? -
Make a new function which hides/shows the window using guiSetVisible, bind F2 to this function (in bindKey, change from initGui to that function) function showHideWindow( key, keyState ) if keyState == "down" then -- change window's visibility: guiSetVisible( MAIN_WINDOW, not guiGetVisible( MAIN_WINDOW ) ) end end -- bindKey( "F2", "down", showHideWindow ) not will change the returned value to opposite, eg. if guiGetVisible returns true (window is visible) the not will make it false (window invisible) and vice versa.
-
Is there any parameter saying you can do so? It's only possible in onClientPlayerDamage.
-
I think I finally know what you're trying to do now. LOL You could do something like this: tab = { apple = 1, banana = 10 } for k, v in pairs( tab ) do loadstring( tostring( k ) .." = " .. tostring( v ) )( ) end --[[ after this loop, you will have variables with names of "cells" from the tab so you can use the names as variables, like: ]] print( apple ) print( banana ) If you have some MTA elements or tables in the tab, you can use similar method: tab = { apple = 1, banana = 10 } for k, v in pairs( tab ) do loadstring( tostring( k ) .." = tab.".. tostring( k ) )( ) end print( apple ) print( banana )
-
You can simply: local tab = { apple = 1, banana = 10 } print( tab.apple ) -- this will print 1 to server console print( tab.banana ) -- and this will print 10 tab.banana = 11 -- let's change value of banana in table print( tab.banana ) -- now it will print 11 To read more about Lua visit their official website: - http://www.lua.org/pil/index.html - http://www.lua.org/manual/5.1/ And some wiki: - http://lua-users.org/wiki/
-
I don't think I know what you're trying to do. If you name a "cell" of table it's not located at index, that is if your table looks like: table[ "one" ], table[ "two" ]... table[ 1 ] does not exist in the table unless you made it. So, for example: local tab = { a = 1, b = 10 } for k, v in pairs( tab ) do print( k, type( k ) ) end -- this will print: -- a string -- b string As you can see a and b are strings. In the 3rd example you can do this: crazies = { getElementPosition( theElement ) }
-
You can change the settings in meta.xml. NOTE: the time set in meta.xml will be restarted for the player that floods your chat, that means he will have to wait that amount of time to be able to chat again, so try not to set that time too heigh. If you find any bugs, please report them immediately, so that you can use a "bug free" script. Download: https://community.multitheftauto.com/index.php?p= ... ils&id=202