[DooD]Heavyair Posted May 15, 2008 Share Posted May 15, 2008 (edited) EDIT : big apology to vercetti 1010 got the credits for the script wrong i have been playing around with VERCETTI 1010s samsite script and ive got a bit lost this is VERCETTI 1010s script slightly edited by me ( just co ordinates and stuff ) server - side deathSphere = createColSphere ( 354, 2027, 25, 200 ) warningSphere = createColSphere ( 354, 2027, 25, 500 ) function enableSam ( thePlayer ) setElementPosition ( deathSphere, 354, 2027, 25 ) setElementPosition ( warningSphere, 354, 2027, 25 ) outputChatBox ( "You have enabled the SAM sites at AREA 69", thePlayer, 255, 0, 0 ) end function disableSam ( thePlayer ) setElementPosition ( deathSphere, 0, 0, -9999 ) setElementPosition ( warningSphere, 0, 0, -9999 ) outputChatBox ( "You have disabled the SAM sites at AREA 69", thePlayer, 255, 0, 0 ) end function samSite ( thePlayer, matchingDimension ) veh = getPlayerOccupiedVehicle ( thePlayer ) id = getVehicleID ( veh ) if ( id == 592 or id == 577 or id == 511 or id == 548 or id == 512 or id == 593 or id == 417 or id == 487 or id == 553 or id == 488 or id == 497 or id == 563 or id == 476 or id == 447 or id == 519 or id == 460 or id == 469 or id == 513 or id == 464 or id == 501 or id == 465 ) then triggerClientEvent ( thePlayer, "onSamTrigger", getRootElement() ) outputChatBox ( "Surface to air missiles have been fired!", thePlayer, 255, 0, 0 ) end end function samWarn ( thePlayer, matchingDimension ) veh = getPlayerOccupiedVehicle ( thePlayer ) id = getVehicleID ( veh ) if ( id == 592 or id == 577 or id == 511 or id == 548 or id == 512 or id == 593 or id == 417 or id == 487 or id == 553 or id == 488 or id == 497 or id == 563 or id == 476 or id == 447 or id == 519 or id == 460 or id == 469 or id == 513 or id == 464 or id == 501 or id == 465 ) then outputChatBox ( "Warning! AREA 69 has SAM sites activated! Turn back!", thePlayer, 255, 0, 0 ) end end function jetpackTrigger ( thePlayer, matchingDimension ) if ( doesPlayerHaveJetPack ( thePlayer ) ) then outputChatBox ( "Warning! AREA 69 will kill you with telepathy if you go in with a jetpack!", thePlayer, 255, 0, 0 ) end end function jetpackWarn ( thePlayer, matchingDimension ) if ( doesPlayerHaveJetPack ( thePlayer ) ) then triggerClientEvent ( thePlayer, "onSamTrigger", getRootElement() ) outputChatBox ( "I wasn't lying about the telepathy death. Enjoy the fireworks!", thePlayer, 255, 0, 0 ) killPlayer ( thePlayer ) end end addCommandHandler ( "asamon", enableSam ) addCommandHandler ( "asamoff", disableSam ) addEventHandler ( "onColShapeHit", deathSphere, samSite ) addEventHandler ( "onColShapeHit", warningSphere, samWarn ) addEventHandler ( "onColShapeHit", deathSphere, jetpackWarn ) addEventHandler ( "onColShapeHit", warningSphere, jetpackTrigger ) client - side function samTrigger ( thePlayer ) createProjectile ( getLocalPlayer(), 19, 354, 2027, 27, 50, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) end addEvent ( "onSamTrigger", true ) addEventHandler ( "onSamTrigger", getRootElement(), samTrigger ) it gives me errors on getPlayerOccupiedVehicle and getVehicleID in samsite and samwarn and it errors on doesPlayerHaveJetPack but it works just fine what i wanted to do was make placeable and flying samsites so i tried this ( not complete just trying ideas out ) server - side samsphere = createColSphere ( 0, 0, -9999, 100 ) function mysams ( player, commandname ) local pad = createObject ( 3885, -711, 957, 25 ) local sam = createObject ( 3884, -711, 957, 26 ) local thesam = attachElementToElement ( sam, pad ) local x, y, z = getElementPosition ( sam ) setElementPosition ( samsphere, x, y, z ) end function samready ( player, matchingDimension ) veh = getPlayerOccupiedVehicle ( player ) id = getVehicleID ( veh ) if ( id == 511 ) then triggerClientEvent ( player, "blastem", getRootElement() ) outputChatBox ( "here it comes", player, 255, 0, 0 ) end end addCommandHandler ( "sam", mysams ) addEventHandler ( "onColShapeHit", samsphere, samready ) client - side function blastem ( player ) createProjectile ( getLocalPlayer(), 19, -711, 957, 27, 50, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) end addEvent ( "onBlastem", true ) addEventHandler ( "onBlastem", getRootElement(), blastem ) this gives me the same errors sends message but doesnt kill me with VERCETTI 1010s script it kills u almost instantly not sure where im going wrong i have made another samsite for the aircraft carrier in easterbay and that works fine so i thought this would be easy i have tried another client script which made a rocket ( ID 3786 ) did GET ELEMENT POSITION of target player and then did MOVE OBJECT on the missle toward the player and created an explosion with SET TIMER but that woudnt create or move the missle so i dont know what to try now ANY ADVICE REALLY APPRECIATED and if i can figure it out ill post my results as i think this could be quite cool EDIT : the other way i was trying to make the rocket was this client - side function samTrigger ( thePlayer ) local missle1 = createObject ( 3786, -711, 957, 22 ) local hitx, hity, hitz = getElementPosition ( player ) local bangx, bangy, bangz = getElementPosition ( missle1 ) moveObject ( missle1, 10000, hitx, hity, hitz ) setTimer ( createExplosion, 10100, 1, bangx, bangy, bangz, 2 ) setTimer ( destroyElement, missle1, 10150 ) end addEvent ( "onSamTrigger", true ) addEventHandler ( "onSamTrigger", getRootElement(), samTrigger ) once again it almost works ( gives messages , makes rocket , creates explosion ) but the rocket doesnt move so the explosion happens where the sam site is i think what is happening is that this line in above script is getting x,y,z of the samsite rather than the player its supposed to target but i dont know how to make it get the x,y,z of the player i want the rocket to fire at local hitx, hity, hitz = getElementPosition ( player ) once again ANY HELP APPRECIATED but i know u all must be getting tired of me by now Edited May 15, 2008 by Guest Link to comment
[DooD]Heavyair Posted May 15, 2008 Author Share Posted May 15, 2008 (edited) EDIT : big apology to vercetti 1010 got the credits for the script wrong i have been playing around with VERCETTI 1010s samsite script and ive got a bit lost this is VERCETTI 1010s script slightly edited by me ( just co ordinates and stuff ) server - side deathSphere = createColSphere ( 354, 2027, 25, 200 )warningSphere = createColSphere ( 354, 2027, 25, 500 ) function enableSam ( thePlayer ) setElementPosition ( deathSphere, 354, 2027, 25 ) setElementPosition ( warningSphere, 354, 2027, 25 ) outputChatBox ( "You have enabled the SAM sites at AREA 69", thePlayer, 255, 0, 0 )end function disableSam ( thePlayer ) setElementPosition ( deathSphere, 0, 0, -9999 ) setElementPosition ( warningSphere, 0, 0, -9999 ) outputChatBox ( "You have disabled the SAM sites at AREA 69", thePlayer, 255, 0, 0 ) end function samSite ( thePlayer, matchingDimension ) veh = getPlayerOccupiedVehicle ( thePlayer ) id = getVehicleID ( veh ) if ( id == 592 or id == 577 or id == 511 or id == 548 or id == 512 or id == 593 or id == 417 or id == 487 or id == 553 or id == 488 or id == 497 or id == 563 or id == 476 or id == 447 or id == 519 or id == 460 or id == 469 or id == 513 or id == 464 or id == 501 or id == 465 ) then triggerClientEvent ( thePlayer, "onSamTrigger", getRootElement() ) outputChatBox ( "Surface to air missiles have been fired!", thePlayer, 255, 0, 0 ) end end function samWarn ( thePlayer, matchingDimension ) veh = getPlayerOccupiedVehicle ( thePlayer ) id = getVehicleID ( veh ) if ( id == 592 or id == 577 or id == 511 or id == 548 or id == 512 or id == 593 or id == 417 or id == 487 or id == 553 or id == 488 or id == 497 or id == 563 or id == 476 or id == 447 or id == 519 or id == 460 or id == 469 or id == 513 or id == 464 or id == 501 or id == 465 ) then outputChatBox ( "Warning! AREA 69 has SAM sites activated! Turn back!", thePlayer, 255, 0, 0 ) endend function jetpackTrigger ( thePlayer, matchingDimension ) if ( doesPlayerHaveJetPack ( thePlayer ) ) then outputChatBox ( "Warning! AREA 69 will kill you with telepathy if you go in with a jetpack!", thePlayer, 255, 0, 0 ) end end function jetpackWarn ( thePlayer, matchingDimension ) if ( doesPlayerHaveJetPack ( thePlayer ) ) then triggerClientEvent ( thePlayer, "onSamTrigger", getRootElement() ) outputChatBox ( "I wasn't lying about the telepathy death. Enjoy the fireworks!", thePlayer, 255, 0, 0 ) killPlayer ( thePlayer ) end end addCommandHandler ( "asamon", enableSam )addCommandHandler ( "asamoff", disableSam )addEventHandler ( "onColShapeHit", deathSphere, samSite )addEventHandler ( "onColShapeHit", warningSphere, samWarn )addEventHandler ( "onColShapeHit", deathSphere, jetpackWarn )addEventHandler ( "onColShapeHit", warningSphere, jetpackTrigger ) client - side function samTrigger ( thePlayer ) createProjectile ( getLocalPlayer(), 19, 354, 2027, 27, 50, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() )endaddEvent ( "onSamTrigger", true )addEventHandler ( "onSamTrigger", getRootElement(), samTrigger ) it gives me errors on getPlayerOccupiedVehicle and getVehicleID in samsite and samwarn and it errors on doesPlayerHaveJetPack but it works just fine what i wanted to do was make placeable and flying samsites so i tried this ( not complete just trying ideas out ) server - side samsphere = createColSphere ( 0, 0, -9999, 100 ) function mysams ( player, commandname ) local pad = createObject ( 3885, -711, 957, 25 ) local sam = createObject ( 3884, -711, 957, 26 ) local thesam = attachElementToElement ( sam, pad ) local x, y, z = getElementPosition ( sam ) setElementPosition ( samsphere, x, y, z )end function samready ( player, matchingDimension ) veh = getPlayerOccupiedVehicle ( player ) id = getVehicleID ( veh ) if ( id == 511 ) then triggerClientEvent ( player, "blastem", getRootElement() ) outputChatBox ( "here it comes", player, 255, 0, 0 ) endend addCommandHandler ( "sam", mysams )addEventHandler ( "onColShapeHit", samsphere, samready ) client - side function blastem ( player ) createProjectile ( getLocalPlayer(), 19, -711, 957, 27, 50, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() ) createProjectile ( getLocalPlayer(), 19, X, Y, Z, 5, getLocalPlayer() )endaddEvent ( "onBlastem", true )addEventHandler ( "onBlastem", getRootElement(), blastem ) this gives me the same errors sends message but doesnt kill me with VERCETTI 1010s script it kills u almost instantly not sure where im going wrong i have made another samsite for the aircraft carrier in easterbay and that works fine so i thought this would be easy i have tried another client script which made a rocket ( ID 3786 ) did GET ELEMENT POSITION of target player and then did MOVE OBJECT on the missle toward the player and created an explosion with SET TIMER but that woudnt create or move the missle so i dont know what to try now ANY ADVICE REALLY APPRECIATED and if i can figure it out ill post my results as i think this could be quite cool EDIT : the other way i was trying to make the rocket was this client - side function samTrigger ( thePlayer ) local missle1 = createObject ( 3786, -711, 957, 22 ) local hitx, hity, hitz = getElementPosition ( player ) local bangx, bangy, bangz = getElementPosition ( missle1 ) moveObject ( missle1, 10000, hitx, hity, hitz ) setTimer ( createExplosion, 10100, 1, bangx, bangy, bangz, 2 ) setTimer ( destroyElement, missle1, 10150 )endaddEvent ( "onSamTrigger", true )addEventHandler ( "onSamTrigger", getRootElement(), samTrigger ) once again it almost works ( gives messages , makes rocket , creates explosion ) but the rocket doesnt move so the explosion happens where the sam site is i think what is happening is that this line in above script is getting x,y,z of the samsite rather than the player its supposed to target but i dont know how to make it get the x,y,z of the player i want the rocket to fire at local hitx, hity, hitz = getElementPosition ( player ) once again ANY HELP APPRECIATED but i know u all must be getting tired of me by now Edited May 15, 2008 by Guest Link to comment
Ace_Gambit Posted May 15, 2008 Share Posted May 15, 2008 The script above is actually written by Vercetti1010 and not by me . I am kind of busy creating something. But I'll have a look at it when I'm done. Link to comment
Ace_Gambit Posted May 15, 2008 Share Posted May 15, 2008 The script above is actually written by Vercetti1010 and not by me . I am kind of busy creating something. But I'll have a look at it when I'm done. Link to comment
[DooD]Heavyair Posted May 15, 2008 Author Share Posted May 15, 2008 sorry VERCETTI 1010 got a bit confused will make sure i change the name ACE_GAMBIT thanx for lookin Link to comment
[DooD]Heavyair Posted May 15, 2008 Author Share Posted May 15, 2008 sorry VERCETTI 1010 got a bit confused will make sure i change the name ACE_GAMBIT thanx for lookin Link to comment
Ace_Gambit Posted May 15, 2008 Share Posted May 15, 2008 The errors in samsite and samwarn are probably caused because onColShapeHit returns the element that hit the shape as an parameter. This can be a player or a vehicle. When you are in a vehicle the call back does a check on the vehicle as well. This is a better way of scripting it: function samSite ( element, matchingDimension ) if (getElementType(element) == "player") then ... end end function samWarn ( element, matchingDimension ) if (getElementType(element) == "player") then ... end end The second part where you are trying to make a flying samsite is not working because of the reason mentioned above. It will throw an error and stop executing. Instead you should check if the element is indeed a player. function samready ( element, matchingDimension ) if (getElementType(element) == "player") then veh = getPlayerOccupiedVehicle ( element) id = getVehicleID ( veh ) if ( id == 511 ) then triggerClientEvent ( element, "blastem", getRootElement() ) outputChatBox ( "here it comes", element, 255, 0, 0 ) end end end The third part is not working because player is not defined (at least not in your code). function samTrigger ( thePlayer ) ... local hitx, hity, hitz = getElementPosition ( thePlayer ) ... end Link to comment
Ace_Gambit Posted May 15, 2008 Share Posted May 15, 2008 The errors in samsite and samwarn are probably caused because onColShapeHit returns the element that hit the shape as an parameter. This can be a player or a vehicle. When you are in a vehicle the call back does a check on the vehicle as well. This is a better way of scripting it: function samSite ( element, matchingDimension ) if (getElementType(element) == "player") then ... endend function samWarn ( element, matchingDimension ) if (getElementType(element) == "player") then ... endend The second part where you are trying to make a flying samsite is not working because of the reason mentioned above. It will throw an error and stop executing. Instead you should check if the element is indeed a player. function samready ( element, matchingDimension ) if (getElementType(element) == "player") then veh = getPlayerOccupiedVehicle ( element) id = getVehicleID ( veh ) if ( id == 511 ) then triggerClientEvent ( element, "blastem", getRootElement() ) outputChatBox ( "here it comes", element, 255, 0, 0 ) end end end The third part is not working because player is not defined (at least not in your code). function samTrigger ( thePlayer ) ... local hitx, hity, hitz = getElementPosition ( thePlayer ) ... end Link to comment
Vercetti1010 Posted May 15, 2008 Share Posted May 15, 2008 the problem probably is that you put "triggerClientEvent ( "blastem" ). you need to put "onBlastem" since thats what you named it. Link to comment
Vercetti1010 Posted May 15, 2008 Share Posted May 15, 2008 the problem probably is that you put "triggerClientEvent ( "blastem" ). you need to put "onBlastem" since thats what you named it. Link to comment
[DooD]Heavyair Posted May 16, 2008 Author Share Posted May 16, 2008 thanx loads guys sorry about slow reply ( computer went bang / big power surge took out power supply ) i was sure i was not getting the player its supposed to shoot because it was not defined but was unsure how to get the player i wanted but i think i understand now i think i need to get a proof reader half my problems seem to be typing and naming errors thanx again guys hope to post results soon ( Giant mothership flys in and starts launching baby ufos all over the place ) its gonna be awesome EDIT : on slightly different but related note is there any way to edit objects i have seen a sign near the massive satellite dish that is a small UFO spinning on top of a pillar i would really like to have the ufo but i dont know if i can separate it from the pillar i think its for the LIL PROBE INN ( this ones not to important just wondering ) Link to comment
[DooD]Heavyair Posted May 16, 2008 Author Share Posted May 16, 2008 thanx loads guys sorry about slow reply ( computer went bang / big power surge took out power supply ) i was sure i was not getting the player its supposed to shoot because it was not defined but was unsure how to get the player i wanted but i think i understand now i think i need to get a proof reader half my problems seem to be typing and naming errors thanx again guys hope to post results soon ( Giant mothership flys in and starts launching baby ufos all over the place ) its gonna be awesome EDIT : on slightly different but related note is there any way to edit objects i have seen a sign near the massive satellite dish that is a small UFO spinning on top of a pillar i would really like to have the ufo but i dont know if i can separate it from the pillar i think its for the LIL PROBE INN ( this ones not to important just wondering ) 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