Morelli
Members-
Posts
69 -
Joined
-
Last visited
Everything posted by Morelli
-
Are you testing it with another player? If you aren't then it's not so much a problem because the script is trying to firstly get the name of the person who is in the driver seat (when there isn't one), then they are trying to crunch this non-existant name and pull out a skin ID number to correlate to it.
-
You'll need this check: local driverskin = getPlayerSkin ( driver ) if ( not driverskin == 14 ) then ... else ... end So, all in all, this should be the complete code: TaxiVehicles = { [420]=true, [438]=true } -- Define what vehicles are taxis. In this case, it's the vehicle ID's 420 and 438. --[[ Made by Morelli]]-- function PayPlayerOnEnter( theVehicle ) -- Create a function which imports the 'theVehicle' from onPlayerVehicleEnter local seat = getPlayerOccupiedVehicleSeat ( source ) -- Find out which seat the person who entered the vehicle is now sitting in. if ( (TaxiVehicles[getVehicleID(theVehicle)]) and ( not (seat == 0) ) ) then -- Find out if the player is not in the driver seat, but in a taxi. local money = getPlayerMoney(source) -- Return a variable value called 'money', which shows how much cash the passenger. if (money > 99) then -- If the passenger has more than (or equal to) 100 dollars, then continue. local driver = getVehicleOccupant ( theVehicle, 0 ) -- Find out the name of the driver of the taxi. local driverskin = getPlayerSkin ( driver ) -- Find out the skin of the taxi driver and name it the variable 'driverskin'. if ( not (driverskin == 14) ) then -- If the driver's skin does not equal to 14... outputChatBox( "The person driving this taxi isn't a registered taxi driver! You haven't paid them.", source) -- Tell the passenger that they haven't paid the driver. else -- Otherwise, if the driver does have skin ID 14.. takePlayerMoney ( source, 100 ) -- Take $100 from the passenger givePlayerMoney ( driver, 100 ) -- Give $100 to the driver outputChatBox( "You paid the $100 fare, to the driver, for using the taxi.", source) -- Tell the passenger that they paid the driver. end else -- If the passenger has 99 or less dollars outputChatBox( "You don't have enough money to pay the taxi driver!", source) -- Tell them they don't have enough money removePlayerFromVehicle ( source ) -- Remove them from the vehicle end end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), PayPlayerOnEnter) -- Define when we want this function to be triggered. I've added some comments to make it more user-friendly for those trying to learn.
-
Check the second post in this thread. I updated the code.
-
TaxiVehicles = { [420]=true, [438]=true } --[[ Made by Morelli]]-- function PayPlayerOnEnter( theVehicle ) local seat = getPlayerOccupiedVehicleSeat ( source ) if ( (TaxiVehicles[getVehicleID(theVehicle)]) and ( not (seat == 0) ) ) then local money = getPlayerMoney(source) if (money > 99) then local driver = getVehicleOccupant ( theVehicle, 0 ) takePlayerMoney ( source, 100 ) givePlayerMoney ( driver, 100 ) outputChatBox( "You paid the $100 fare, to the driver, for using the taxi.", source) else outputChatBox( "You don't have enough money to pay the taxi driver!", source) removePlayerFromVehicle ( source ) end end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), PayPlayerOnEnter)
-
Make a collision shape, when the player 'hits' it, do playSoundFrontEnd ( player , sound ). When they leave the collision shape, just stop the sound playing. Here are some wiki pages you may want to read over. Play sound Collision Shape On Collision Shape hit On Collision Shape leave
-
function DeagleKO ( attacker, attackerweapon, bodypart, loss ) if ( attackerweapon== 14 ) then killPlayer ( source ) end end addEventHandler ( "onPlayerDamage", getRootElement (), DeagleKO ) The above code kills a player if they were hit by a deagle bullet. It is a one-hit kill.
-
Minor bug Night vision goggles (Weapon ID: 44) and Infra-Red goggles (Weapon ID: 45) are not fully synced when a player uses them. When they are used (ie: the player's screen turns a different colour), only the player who activated them see's them on his head. Everyone else will see the goggles in the player's hand. It seems that the sync is delivered clientside, but not serverside.
-
Post a snippet of your code. It seems likely that the problem is hidden within there.
-
What you've just said isn't so much of a bug, but an obvious thing. The default keys for scrolling with weapons is the mouse wheel. If you try to script-wise add new binds to keys that are frequently in use, you're going to have multiple tasks going on. The below example will say 'Hello, I just pressed spacebar and jumped at the same time!". Both the script bind where 'outputChatBox' is performed, and the natural GTA:SA task, where the player jumps is performed. function playerJoin () bindKey ( source, "space", "down", hello ) end addEventHandler ( "onPlayerJoin", root, playerJoin ) function hello( ) outputChatBox ( "Hello, I just pressed spacebar and jumped at the same time!" ) end The same principle applies to what you just posted as a 'bug'. The only proper solution would be to bind it to a different key, that isn't used by default in GTA/MTA. An example is \ or '.
-
Taken from Linux run server. 4000-b7bd6000 rw-p b7bd4000 00:00 0 b7bd6000-b7c46000 r-xp 00000000 03:03 5425 /home/mta/mtasadm/core.so b7c46000-b7c47000 r--p 0006f000 03:03 5425 /home/mta/mtasadm/core.so b7c47000-b7c48000 rw-p 00070000 03:03 5425 /home/mta/mtasadm/core.so b7c48000-b7d0e000 rw-p b7c48000 00:00 0 b7d0e000-b7d31000 r-xp 00000000 03:03 418608 /lib/libm-2.6.1.so b7d31000-b7d32000 r--p 00023000 03:03 418608 /lib/libm-2.6.1.so b7d32000-b7d33000 rw-p 00024000 03:03 418608 /lib/libm-2.6.1.so b7d33000-b7e56000 r-xp 00000000 03:03 418458 /lib/libc-2.6.1.so b7e56000-b7e58000 r--p 00122000 03:03 418458 /lib/libc-2.6.1.so b7e58000-b7e59000 rw-p 00124000 03:03 418458 /lib/libc-2.6.1.so b7e59000-b7e5c000 rw-p b7e59000 00:00 0 b7e5c000-b7e66000 r-xp 00000000 03:03 485983 /usr/local/lib/libgcc_s.so.1 b7e66000-b7e67000 r--p 00009000 03:03 485983 /usr/local/lib/libgcc_s.so.1 b7e67000-b7e68000 rw-p 0000a000 03:03 485983 /usr/local/lib/libgcc_s.so.1 b7e68000-b7f4b000 r-xp 00000000 03:03 486681 /usr/local/lib/libstdc++.so.6.0.9 b7f4b000-b7f4f000 r--p 000e2000 03:03 486681 /usr/local/lib/libstdc++.so.6.0.9 b7f4f000-b7f50000 rw-p 000e6000 03:03 486681 /usr/local/lib/libstdc++.so.6.0.9 b7f50000-b7f56000 rw-p b7f50000 00:00 0 b7f56000-b7f58000 r-xp 00000000 03:03 418612 /lib/libdl-2.6.1.so b7f58000-b7f59000 r--p 00001000 03:03 418612 /lib/libdl-2.6.1.so b7f59000-b7f5a000 rw-p 00002000 03:03 418612 /lib/libdl-2.6.1.so b7f5a000-b7f5b000 rw-p b7f5a000 00:00 0 b7f5f000-b7f60000 rw-p b7f5f000 00:00 0 b7f60000-b7f79000 r-xp 00000000 03:03 418629 /lib/ld-2.6.1.so b7f79000-b7f7a000 r--p 00018000 03:03 418629 /lib/ld-2.6.1.so b7f7a000-b7f7b000 rw-p 00019000 03:03 418629 /lib/ld-2.6.1.so bf9d7000-bf9eb000 rwxp bffeb000 00:00 0 [stack] bf9eb000-bf9ec000 rw-p bffff000 00:00 0 ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso] Aborted ad-2.6.1.so b7c4f000-b7c51000 rw-p b7c4f000 00:00 0 b7c51000-b7cc1000 r-xp 00000000 03:03 5425 /home/mta/mtasadm/core.so b7cc1000-b7cc2000 r--p 0006f000 03:03 5425 /home/mta/mtasadm/core.so b7cc2000-b7cc3000 rw-p 00070000 03:03 5425 /home/mta/mtasadm/core.so b7cc3000-b7d89000 rw-p b7cc3000 00:00 0 b7d89000-b7dac000 r-xp 00000000 03:03 418608 /lib/libm-2.6.1.so b7dac000-b7dad000 r--p 00023000 03:03 418608 /lib/libm-2.6.1.so b7dad000-b7dae000 rw-p 00024000 03:03 418608 /lib/libm-2.6.1.so b7dae000-b7ed1000 r-xp 00000000 03:03 418458 /lib/libc-2.6.1.so b7ed1000-b7ed3000 r--p 00122000 03:03 418458 /lib/libc-2.6.1.so b7ed3000-b7ed4000 rw-p 00124000 03:03 418458 /lib/libc-2.6.1.so b7ed4000-b7ed7000 rw-p b7ed4000 00:00 0 b7ed7000-b7ee1000 r-xp 00000000 03:03 485983 /usr/local/lib/libgcc_s.so.1 b7ee1000-b7ee2000 r--p 00009000 03:03 485983 /usr/local/lib/libgcc_s.so.1 b7ee2000-b7ee3000 rw-p 0000a000 03:03 485983 /usr/local/lib/libgcc_s.so.1 b7ee3000-b7fc6000 r-xp 00000000 03:03 486681 /usr/local/lib/libstdc++.so.6.0.9 b7fc6000-b7fca000 r--p 000e2000 03:03 486681 /usr/local/lib/libstdc++.so.6.0.9 b7fca000-b7fcb000 rw-p 000e6000 03:03 486681 /usr/local/lib/libstdc++.so.6.0.9 b7fcb000-b7fd1000 rw-p b7fcb000 00:00 0 b7fd1000-b7fd3000 r-xp 00000000 03:03 418612 /lib/libdl-2.6.1.so b7fd3000-b7fd4000 r--p 00001000 03:03 418612 /lib/libdl-2.6.1.so b7fd4000-b7fd5000 rw-p 00002000 03:03 418612 /lib/libdl-2.6.1.so b7fd5000-b7fd6000 rw-p b7fd5000 00:00 0 b7fda000-b7fdb000 rw-p b7fda000 00:00 0 b7fdb000-b7ff4000 r-xp 00000000 03:03 418629 /lib/ld-2.6.1.so b7ff4000-b7ff5000 r--p 00018000 03:03 418629 /lib/ld-2.6.1.so b7ff5000-b7ff6000 rw-p 00019000 03:03 418629 /lib/ld-2.6.1.so bff19000-bff2e000 rwxp bffeb000 00:00 0 [stack] ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso] Aborted
-
Is there any way to cancel or forbid the native, hardcoded /login and /register, etc. commands from being used, or if that's not possible, is there any way to restrict it from writing and reading from the native accounts file? I'm coding a register/login system with a MySQL database and for increased security, I'm having my passwords hashed and by letting it also simultaneously create an account the 'regular' way, with an .xml file, it defeats the purpose of hashing passwords, as they'll be viewable, unhashed, in the .xml file. Much luv, Morellay
-
I've experienced no such problems from doing so, and I've used this to fix MTA not working for either MTA: Race or SA: DM. I've been able to use the Race map editor (DP2 doesn't contain the map resource, or I am indeed bugged due to renaming client.dll). Gameplay is fine and I have no problem using the MTA menu. Anyway, I'd be glad to hear if Vista is going to be natively supported in future releases, as it'd stop me from finding dodgy methods.
-
Well, I'll make this short and sweet. We've got a setVehicleEngineState, but no method of retrieving what a vehicle is currently set to. It would be nice for a getVehicleEngineState to be implemented, to coincide with the setting of an engine state. getVehicleEngineState ( vehicle theVehicle ) Required Arguments theVehicle: A handle to the vehicle that you wish to know the light state of. Returns Returns a boolean. 0 is engine state off ; 1 is engine state on. Example:
-
1. Go into your MTA: Race folder. 2. Look for this directory: MTA root directory \ mods \ race \ 3. Rename Client.dll to Client2.dll 4. Start MTA: Race and be amazed at how it works. 5. Stop playing with yourself.
-
When using getElementsWithinColShape to return objects within a collision shape, nothing occurs. Here's a quick test code, for you to try yourself. function Create() -- Just use this to spawn a few objects around the 0,0,0 origin createObject ( 659, 0, 0, 5, 0, 0, 0 ) createObject ( 982, 0, 3, 5, 0, 0, 0 ) createObject ( 765, 3, 0, 5, 0, 0, 0 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), Create) function Join( ) spawnPlayer ( source, 0.0, 0.0, 5.0, 90.0, 0, 0, 0, 0 ) fadeCamera( source, true ) end addEventHandler ( "onPlayerJoin", getRootElement(), Join) function Objects( sourcePlayer, command ) local X, Y, Z = getElementPosition( sourcePlayer ) local tempcol = createColSphere( X, Y, Z, 25.0 ) local allObjectsinCol = getElementsWithinColShape ( tempcol, "object" ) for keyObjects,object in pairs(allObjectsinCol) do local x4,y4,z4 = getElementPosition ( object ) local x1,y1,z1 = getObjectRotation ( object ) local model = getObjectModel( object ) outputDebugString("POS ---- x4: " ..x4.. " y4:" ..y4.. " z4:" ..z4 ) outputDebugString("ROT ---- x1: " ..x1.. " y1:" ..y1.. " z1:" ..z1 ) outputDebugString("MODEL ---- model: " ..model ) outputDebugString("--------------------------------------------------------------" ) end end addCommandHandler("object", Objects) I've only tested this on objects which are spawned via the createObject function.
-
CreateVehicle allows you to set up to 8 characters in the numberplate field. This displays correctly ingame. However, getVehiclePlateText ( vehicle ) can only return a maximum of 7 characters. If it attempts to return 8, mtaserver.exe crashes
-
What's the status with the MySQL module that is offered by the MTA team? On the site, it claims the link is 'pending', however searching back through the history, I found the link. After downloading and installing, it seems to have no effect on the script I'm running. Is the MySQL module working; if not, is there an expected time period for when it will be working, once again? Here is a snippet of the code I'm using to call the access to the MySQL. Is there anything 'wrong' with it, that may be causing it to not work. function onMySQLOpen ( result ) if ( result ) then outputServerLog ( "MySQL connection established." ) outputDebugString ( "MySQL connection established." ) outputChatBox( "MySQL connection established." ) else outputServerLog ( "MySQL connection failed." ) outputDebugString ( "MySQL connection failed." ) outputChatBox( "MySQL connection failed." ) end end function mysqltest () handler = mysqlCreate () MysqlOpen ( handler, "onMySQLOpen", "**MySQL Server weburl goes here**", "** My useraccount **", "** password **", "** database name **", "3306" ) end
