Jump to content

[HELP] [MISSION SCRIPT]


Recommended Posts

Posted

Hi, i have problems with this script for a mission :

marky = createMarker ( -2642.5, 1375, 6, "cylinder", 1.5, 255, 255, 0, 30 )
 
    function mission ( hitPlayer )
    if (source == marky) then
           my = createMarker ( -1647, 1219, 6, "cylinder" , 4, 255, 255, 0, 30 )
           setElementVisibleTo ( my, hitPlayer , true )
               local MissionVehicle = createVehicle ( 401, -2639, 1371, 8 )
                warpPedIntoVehicle ( hitPlayer , MissionVehicle )
           blip = createBlip ( -1647, 1219, 4, 52, 2, 255, 0, 0, 255, 0, 99999.0, getRootElement() )
           setElementVisibleTo ( blip, hitPlayer, true )
 
     end
   end
 
   function Reward( hitPlayer )
   if (source == my) then
   removePedFromVehicle( hitPlayer)
   destroyElement( MissionVehicle )
   destroyElement( blip )
   destroyElement( my )
     givePlayerMoney(hitPlayer, 100)  
  end
  end
 
 
     addEventHandler ("onMarkerHit" , getRootElement(), mission)

Function "Reward" dont work , plz help (

Posted

Hmmm well i fixed that, but when we hit marker the car dont gets destroyed but u get the money, here is new code

marky = createMarker ( -2642.5, 1375, 6, "cylinder", 1.5, 255, 255, 0, 30 )
 
function mission ( hitPlayer )
if (source == marky) then
           my = createMarker ( -1647, 1219, 6, "cylinder" , 4, 255, 255, 0, 30 )
setElementVisibleTo ( my, hitPlayer , true )
local MissionVehicle = createVehicle ( 401, -2639, 1371, 8 )
warpPedIntoVehicle ( hitPlayer , MissionVehicle )
blip = createBlip ( -1647, 1219, 4, 52, 2, 255, 0, 0, 255, 0, 99999.0, getRootElement() )
setElementVisibleTo ( blip, hitPlayer, true )
addEventHandler ("onMarkerHit", my, Reward)
end
end
function Reward( hitPlayer )
if (source == my) then
setTimer ( destroyElement, 2000, 1, blip )
setTimer ( destroyElement, 2000, 1, my )
setTimer ( destroyElement, 2000, 1, MissionVehicle )
givePlayerMoney(hitPlayer, 100) 
end
end
addEventHandler ("onMarkerHit" , getRootElement(), mission)

Good luck with it :)

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

this wont destroy vehicle, as you created local value,

and if 2 players start the mission, it will be one big fail, as you share global variable "my" and blip, etc etc..

and player can just leave vehicle and go to the marker on foot.. or destroy his car.. even die.. etc etc..

good luck anyway

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
--

EDIT : thx Varez

dont use capital when saying my name :P dunno why, but i want it to be "varez" not "Varez"..

you want to do something like trucking/from A to B mission?

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

varez , plz help fix this script :

--ServerSide
function car(hitPlayer)
    MissionVehicle = createVehicle ( 401, -2639, 1371, 8 )
        setElementData(MissionVehicle, "misson", "yes")
    warpPedIntoVehicle ( hitPlayer , MissionVehicle )
end
addEvent( "car", true )
addEventHandler( "car", getRootElement(), car)   
 
 
function giveMoney(hitPlayer)    
theVehicle = getPedOccupiedVehicle(hitPlayer)
destroyElement(theVehicle)
givePlayerMoney(hitPlayer, 500) 
removePedFromVehicle(hitPlayer)
end
addEvent( "giveMoney", true )
addEventHandler( "giveMoney", getRootElement(), giveMoney)
 
--ClientSide
marky = createMarker ( -2642.5, 1375, 6, "cylinder", 1.5, 255, 255, 0, 30 )
function mission(hitPlayer)
local localPlayer = getLocalPlayer()
if (getElementType(hitPlayer) == "player") and (not isPedInVehicle(hitPlayer)) then
if hitPlayer == localPlayer then
if source == marky then
    triggerServerEvent("car", hitPlayer, hitPlayer)
    my = createMarker ( -1647, 1219, 6, "cylinder" , 4, 255, 255, 0, 30 )
    blip = createBlip ( -1647, 1219, 4, 52, 2, 255, 0, 0, 255, 0, 99999.0, getRootElement() )
        addEventHandler ("onClientMarkerHit" , my, Reward)
        end
end
end
end
addEventHandler ("onClientMarkerHit" , marky, mission)
 
function Reward(hitPlayer)
if source == my then
if getElementData(getPedOccupiedVehicle(hitPlayer), "misson") == "yes" then
destroyElement(my)
destroyElement(blip)
triggerServerEvent("giveMoney", hitPlayer, hitPlayer)
end
end
end

Posted
varez , plz help fix this script :

--ServerSide
function car(hitPlayer)
    MissionVehicle = createVehicle ( 401, -2639, 1371, 8 )
        setElementData(MissionVehicle, "misson", "yes")
    warpPedIntoVehicle ( hitPlayer , MissionVehicle )
end
addEvent( "car", true )
addEventHandler( "car", getRootElement(), car)   
 
 
function giveMoney(hitPlayer)    
theVehicle = getPedOccupiedVehicle(hitPlayer)
destroyElement(theVehicle)
givePlayerMoney(hitPlayer, 500) 
removePedFromVehicle(hitPlayer)
end
addEvent( "giveMoney", true )
addEventHandler( "giveMoney", getRootElement(), giveMoney)
 
--ClientSide
marky = createMarker ( -2642.5, 1375, 6, "cylinder", 1.5, 255, 255, 0, 30 )
function mission(hitPlayer)
local localPlayer = getLocalPlayer()
if (getElementType(hitPlayer) == "player") and (not isPedInVehicle(hitPlayer)) then
if hitPlayer == localPlayer then
if source == marky then
    triggerServerEvent("car", hitPlayer, hitPlayer)
    my = createMarker ( -1647, 1219, 6, "cylinder" , 4, 255, 255, 0, 30 )
    blip = createBlip ( -1647, 1219, 4, 52, 2, 255, 0, 0, 255, 0, 99999.0, getRootElement() )
        addEventHandler ("onClientMarkerHit" , my, Reward)
        end
end
end
end
addEventHandler ("onClientMarkerHit" , marky, mission)
 
function Reward(hitPlayer)
if source == my then
if getElementData(getPedOccupiedVehicle(hitPlayer), "misson") == "yes" then
destroyElement(my)
destroyElement(blip)
triggerServerEvent("giveMoney", hitPlayer, hitPlayer)
end
end
end

Whats the problem with it??

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...