pejczi Posted July 4, 2013 Share Posted July 4, 2013 (edited) Hello, Recently, I've decided to write script which repairs one bug on DD maps. As somebody from u guys know, when u prees enter , gamemode marks u as "dead" - it puts something like shadow with burn on the middle. Same thing is when u get blown. The problem is how gamemode marks u as dead? What event it uses? function moveVehicle ( ) outputChatBox ( "First part", getRootElement(), 255, 0, 0, true ) local vehicle = getPedOccupiedVehicle ( source ) local x,y,z = getElementPosition( source ) outputChatBox ( "vehicle: " ..tostring ( source ) ) if ( vehicle ) then setElementPosition ( vehicle, x,y,z-100 ) end end addEventHandler ( "onPlayerWasted" , getRootElement() , moveVehicle ) Ok i changed something. Any ideas? Edited July 4, 2013 by Guest Link to comment
Castillo Posted July 4, 2013 Share Posted July 4, 2013 You can use the event onElementDataChange with the dataName: "state". Link to comment
iMr.3a[Z]eF Posted July 4, 2013 Share Posted July 4, 2013 Hello,Recently, I've decided to write script which repairs one bug on DD maps. As somebody from u guys know, when u prees enter , gamemode marks u as "dead" - it puts something like shadow with burn on the middle. Same thing is when u get blown. The problem is how gamemode marks u as dead? What event it uses? I tried to use event onExplode, but it still doesn't work. function moveVehicle ( ) local x,y,z = getElementPosition(source) local vehicle = getPedOccupiedVehicle(source) local veh_health = getElementHealth ( vehicle ) local pl_health = getElementHealth ( source ) if ( vehicle ) then if veh_health == 0 or pl_health == 0 then setElementPosition ( vehicle, x,y,z-100 ) outputChatBox ( "Red #FFFFFFWhite", getRootElement(), 255, 0, 0, true ) addEventHandler ("onVehicleExplode", source, moveVehicle) end end end Any ideas? You put the event inside the function most be like this function moveVehicle ( ) local x,y,z = getElementPosition(source) local vehicle = getPedOccupiedVehicle(source) local veh_health = getElementHealth ( vehicle ) local pl_health = getElementHealth ( source ) if ( vehicle ) then if veh_health == 0 or pl_health == 0 then setElementPosition ( vehicle, x,y,z-100 ) outputChatBox ( "Red #FFFFFFWhite", getRootElement(), 255, 0, 0, true ) end end end addEventHandler ("onVehicleExplode", source, moveVehicle) Link to comment
pejczi Posted July 5, 2013 Author Share Posted July 5, 2013 Ok, I changed event, what about it ? function moveVehicle ( ) outputChatBox ( "First part", getRootElement(), 255, 0, 0, true ) local vehicle = getPedOccupiedVehicle ( source ) local x,y,z = getElementPosition( source ) outputChatBox ( "vehicle: " ..tostring ( source ) ) if ( vehicle ) then setElementPosition ( vehicle, x,y,z-100 ) end end addEventHandler ( "onPlayerWasted" , getRootElement() , moveVehicle ) It still ain't work. Link to comment
Castillo Posted July 5, 2013 Share Posted July 5, 2013 function moveVehicle ( vehicle ) outputChatBox ( "First part", getRootElement(), 255, 0, 0, true ) local vehicle = getPedOccupiedVehicle ( source ) local x, y, z = getElementPosition( source ) outputChatBox ( "vehicle: ".. tostring ( source ) ) if ( vehicle ) then setElementPosition ( vehicle, x, y, z - 100 ) end end addEvent ( "onPlayerRaceWasted", true ) addEventHandler ( "onPlayerRaceWasted" , getRootElement(), moveVehicle ) Link to comment
pejczi Posted July 7, 2013 Author Share Posted July 7, 2013 Still doesn't work @Solidsnake14. Link to comment
iMr.3a[Z]eF Posted July 7, 2013 Share Posted July 7, 2013 do you want to set the vehicle position next to the player Link to comment
Castillo Posted July 7, 2013 Share Posted July 7, 2013 Still doesn't work @Solidsnake14. What does it output to the chatbox? Link to comment
pejczi Posted July 7, 2013 Author Share Posted July 7, 2013 Still doesn't work @Solidsnake14. What does it output to the chatbox? Just wanted to check if script works , that's why I added it. Link to comment
Castillo Posted July 7, 2013 Share Posted July 7, 2013 I didn't ask why you added it, I asked what it outputs to the chatbox. Link to comment
pejczi Posted July 7, 2013 Author Share Posted July 7, 2013 Aaah, sorry, didn't recognize, I was sleepy. It outputs : First part vehicle: userdata: 0x3b5b http://img833.imageshack.us/img833/3918/1wj.png As u can see from the screen. Link to comment
Castillo Posted July 8, 2013 Share Posted July 8, 2013 function moveVehicle ( vehicle ) outputChatBox ( "First part", getRootElement(), 255, 0, 0, true ) local x, y, z = getElementPosition ( vehicle ) outputChatBox ( "vehicle: ".. tostring ( vehicle ) ) if ( vehicle ) then setElementPosition ( vehicle, x, y, z - 100 ) end end addEvent ( "onPlayerRaceWasted", true ) addEventHandler ( "onPlayerRaceWasted" , getRootElement(), moveVehicle ) Link to comment
pejczi Posted July 9, 2013 Author Share Posted July 9, 2013 (edited) Thanks very much, it finally works @BTW: Tell me, how did u find OnPlayerRaceWasted event? Edited July 9, 2013 by Guest Link to comment
pejczi Posted July 17, 2013 Author Share Posted July 17, 2013 Ok, I wanted to protect my script, so I decided to put server name "guard" function blockScript () local serverName = getServerName () if serverName = "Dream Friends CW/FW [email protected], false" then outputChatBox ( "BlablablaTest", getRootElement(), 255, 255, 255, true ) end end addEventHandler ("getServerName", blockScript) I added this to my script (just for look if event works) , but debugscript says that "then expected near '=' in line 21" Link to comment
Castillo Posted July 17, 2013 Share Posted July 17, 2013 function blockScript ( ) local serverName = getServerName ( ) if ( serverName == "Dream Friends CW/FW [email protected], false" ) then outputChatBox ( "BlablablaTest", getRootElement(), 255, 255, 255, true ) end end addEventHandler ( "getServerName", root, blockScript ) To check if something is equal you must use "==" not just "=". Link to comment
pejczi Posted July 17, 2013 Author Share Posted July 17, 2013 Still doesn't work, debug said "WARNING : [..] : Bad argument @ 'addEventHandler' [Expected element at argument 2 , got nil] Link to comment
Castillo Posted July 17, 2013 Share Posted July 17, 2013 That's because you forgot to define second argument. Copy the code again. P.S: When are you triggering "getServerName"? Link to comment
pejczi Posted July 17, 2013 Author Share Posted July 17, 2013 Still doesn't work. At the beginning . Whole script looks : function blockScript ( ) local serverName = getServerName ( ) if ( serverName == "GummyBear, false" ) then outputChatBox ( "BlablablaTest", getRootElement(), 255, 255, 255, true ) end end addEventHandler ( "getServerName", root, blockScript ) function moveVehicle ( vehicle ) local x, y, z = getElementPosition ( vehicle ) if ( vehicle ) then setElementPosition ( vehicle, x, y, z - 100 ) end end addEvent ( "onPlayerRaceWasted", true ) addEventHandler ( "onPlayerRaceWasted" , getRootElement(), moveVehicle ) function greetPlayer ( ) -- we store the player's name local joinedPlayerName = getPlayerName ( source ) local serverName = getServerName( ) -- and send him a greeting outputChatBox ( "Antibug car script #FF0000made by #00BFBFPejczi", getRootElement(), 255, 255, 255, true ) end addEventHandler ( "onPlayerJoin", getRootElement(), greetPlayer ) Btw. u didn't define "root", did you? Link to comment
Castillo Posted July 17, 2013 Share Posted July 17, 2013 This doesn't really make any sense. Link to comment
pejczi Posted July 17, 2013 Author Share Posted July 17, 2013 Ok, so i'll explain u what I wanted to do. I wanted to check if the event works - that's why i put outputchatbox instead of script block. What doesn't make any sense else? Do u have skype or any other messanger? It's hard to write there. Link to comment
Castillo Posted July 17, 2013 Share Posted July 17, 2013 No, what makes no sense is that you are trying to protect a server side script, it can't be stolen, unless you give away your FTP access. Link to comment
pejczi Posted July 17, 2013 Author Share Posted July 17, 2013 I want to give somebody my script ; and I don't want to let this script to be given somebody else. Ok, I've recognized that "getServerName" isn't event ; i added server sided event instead of this and defined one variable local resourceRoot = getResourceRootElement ( getThisResource ( ) ) function blockScript ( ) local serverName = getServerName ( ) if ( serverName == "GummyBear, false" ) then outputChatBox ( "BlablablaTest", 255, 255, 255, true ) end end addEventHandler ( "onResourceStart", resourceRoot, blockScript ) function moveVehicle ( vehicle ) local x, y, z = getElementPosition ( vehicle ) if ( vehicle ) then setElementPosition ( vehicle, x, y, z - 100 ) end end addEvent ( "onPlayerRaceWasted", true ) addEventHandler ( "onPlayerRaceWasted" , getRootElement(), moveVehicle ) function greetPlayer ( ) -- we store the player's name local joinedPlayerName = getPlayerName ( source ) local serverName = getServerName( ) -- and send him a greeting outputChatBox ( "Antibug car script #FF0000made by #00BFBFPejczi", getRootElement(), 255, 255, 255, true ) end addEventHandler ( "onPlayerJoin", getRootElement(), greetPlayer ) Link to comment
denny199 Posted July 17, 2013 Share Posted July 17, 2013 if ( serverName == "GummyBear, false" ) then Doesn't make any sence try: if ( getServerName ( ) == "GummyBear" ) then if the server name is "gummybear" it will trigger the event. if you don't want that ( i guess ). then you will need a NOT statement. if not ( getServerName ( ) == "GummyBear" ) then this will trigger if the server name isn't "gummybear" Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now