Jump to content

Blips and pickups won't show


Blueman

Recommended Posts

I'm making an rpg game mode but the blips and pickups for this specific code won't show it seems.

My code:

  
function main() 
medicblip = createBlip ( 2036, -1408, 17, 22, 0, 0, 0, 255 ) 
medicpickup = createPickup (2036, -1408, 17, 3, 1277, 100) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), displayLoadedRes ) 
  
addEventHandler ("onPickupUse", getRootElement(),  
function (playerWhoUses) 
  if (source == medicpickup) then 
    giveWeapon (playerWhoUses, 14, 1, true) 
    setElementData (playerWhoUses, "job", "medic") 
  else 
  end 
end) 
  
addEventHandler ("onPlayerDamage", getRootElement(),  
function(attacker, weapon, bodypart, loss) 
  if (weapon == 15) and getElementData ( attacker, "job" == "medic" )then 
      setElementHealth ( targetPlayer, getElementHealth(targetPlayer) + 10 ) 
      givePlayerMoney ( attacker, 450 ) 
      cancelEvent() 
  else 
 end 
end 
  

Link to comment
function main() 
medicblip = createBlip ( 2036, -1408, 17, 22, 0, 0, 0, 255 ) 
medicpickup = createPickup (2036, -1408, 17, 3, 1277, 100) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), main) -- why is here displayLoadedRes, in ur script is no such function.  
  
addEventHandler ("onPickupUse", getRootElement(),  
function (playerWhoUses) 
  if (source == medicpickup) then 
    giveWeapon (playerWhoUses, 14, 1, true) 
    setElementData (playerWhoUses, "job", "medic") 
  else 
  end 
end) 
  
addEventHandler ("onPlayerDamage", getRootElement(),  
function(attacker, weapon, bodypart, loss) 
  if (weapon == 15) and getElementData ( attacker, "job" == "medic" )then 
      setElementHealth ( targetPlayer, getElementHealth(targetPlayer) + 10 ) 
      givePlayerMoney ( attacker, 450 ) 
      cancelEvent() 
  else 
 end 
end  

Edited by Guest
Link to comment
function main() 
medicblip = createBlip ( 2036, -1408, 17, 22, 0, 0, 0, 255 ) 
medicpickup = createPickup (2036, -1408, 17, 3, 1277, 100) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), main) 
  
addEventHandler ("onPickupUse", getRootElement(), 
function (playerWhoUses) 
  if (source == medicpickup) then 
    giveWeapon (playerWhoUses, 14, 1, true) 
    setElementData (playerWhoUses, "job", "medic") 
  else 
  end 
end) 
  
addEventHandler ("onPlayerDamage", getRootElement(), 
function(attacker, weapon, bodypart, loss) 
  if (weapon == 15) and getElementData ( attacker, "job" == "medic" )then 
      setElementHealth ( targetPlayer, getElementHealth(targetPlayer) + 10 ) 
      givePlayerMoney ( attacker, 450 ) 
      cancelEvent() 
  else 
 end 
end 

Link to comment

Why targetPlayer ? Is nil in event onPlayerDamage :) server side

function main() 
medicblip = createBlip ( 2036, -1408, 17, 22, 0, 0, 0, 255 ) 
medicpickup = createPickup (2036, -1408, 17, 3, 1277, 100) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), main) 
  
addEventHandler ("onPickupUse", getRootElement(), 
function (playerWhoUses) 
  if source == medicpickup then 
    giveWeapon (playerWhoUses, 14, 1, true) 
    setElementData (playerWhoUses, "job", "medic") 
  end 
end) 
  

client side

  
addEventHandler ("onClientPlayerDamage", getRootElement(), 
function(attacker, weapon, bodypart, loss) 
  if (weapon == 15) and getElementData ( attacker, "job" == "medic" )then 
      setElementHealth ( source, getElementHealth(source) + 10 ) 
      givePlayerMoney ( attacker, 450 ) 
      cancelEvent() 
 end 
end) 

Edited by Guest
Link to comment

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...