Sign in to follow this  
MRmihailZH

Как правильно триггерить?

Recommended Posts

Как правильно триггерить на сервер?
У меня есть вот такая функция
 

function ClickSclad(botao, state)
 if botao == "left" and state == "down" then
 if sklad.visible then
  if cursorPosition(570, 274, 227, 27) then
  triggerServerEvent("GiveWeaponeAndArmor", getLocalPlayer(), "Nightstick")
  elseif cursorPosition(570, 311, 227, 27) then
  triggerServerEvent("GiveWeaponeAndArmor", getLocalPlayer(), "Deagle")
  elseif cursorPosition(570, 348, 227, 27) then
  triggerServerEvent("GiveWeaponeAndArmor", getLocalPlayer(), "Shotgun")
  elseif cursorPosition(570, 385, 227, 27) then
  triggerServerEvent("GiveWeaponeAndArmor", getLocalPlayer(), "MP5")
  elseif cursorPosition(570, 422, 227, 27) then
  triggerServerEvent("GiveWeaponeAndArmor", getLocalPlayer(), "M4")
  elseif cursorPosition(570, 459, 227, 27) then
  triggerServerEvent("GiveWeaponeAndArmor", getLocalPlayer(), "Armor")
  elseif cursorPosition(707, 508, 85, 23) then
  showCursor(false)
  removeEventHandler("onClientRender", root, wnd_sklad)
  sklad.visible = false
end
end
end
end
addEventHandler("onClientClick", getRootElement(), ClickSclad)

и вот
 

function GiveWeaponeSklad (source, inf)
  if inf == Deagle then
  giveWeapon( source, 24 )
  setWeaponAmmo( source, 24, 100 )
  setPedWeaponSlot ( source, 2 )
  elseif inf == Nightstick then
  giveWeapon( source, 3 )
  setPedWeaponSlot ( source, 1 )
  elseif inf == Shotgun then
  giveWeapon( source, 25 )
  setWeaponAmmo( source, 25, 100 )
  setPedWeaponSlot ( source, 3 )
  elseif inf == MP5 then
  giveWeapon( source, 29 )
  setWeaponAmmo( source, 29, 300 )
  setPedWeaponSlot ( source, 7 )
  elseif inf == M4 then
  giveWeapon( source, 31 )
  setWeaponAmmo( source, 31, 300 )
  setPedWeaponSlot ( source, 7 )
  elseif inf == Armor then
  setPedArmor( source, 100 )
 end
end
addEvent("GiveWeaponeAndArmor", true)
addEventHandler("GiveWeaponeAndArmor", getRootElement(), GiveWeaponeSklad)

И у меня в дебаге пишет, что 1 аргумент, допустим в Armor,  got string 'Armor'.
То есть у меня не получается правильно триггернуть на сервер.
Заранее спасибо, надеюсь объяснил понятно :)

Share this post


Link to post
function GiveWeaponeSklad (inf)
  if inf == "Deagle" then
  giveWeapon( source, 24 )
  setWeaponAmmo( source, 24, 100 )
  setPedWeaponSlot ( source, 2 )
  elseif inf == "Nightstick" then
  giveWeapon( source, 3 )
  setPedWeaponSlot ( source, 1 )
  elseif inf == "Shotgun" then
  giveWeapon( source, 25 )
  setWeaponAmmo( source, 25, 100 )
  setPedWeaponSlot ( source, 3 )
  elseif inf == "MP5" then
  giveWeapon( source, 29 )
  setWeaponAmmo( source, 29, 300 )
  setPedWeaponSlot ( source, 7 )
  elseif inf == "M4" then
  giveWeapon( source, 31 )
  setWeaponAmmo( source, 31, 300 )
  setPedWeaponSlot ( source, 7 )
  elseif inf == "Armor" then
  setPedArmor( source, 100 )
 end
end
addEvent("GiveWeaponeAndArmor", true)
addEventHandler("GiveWeaponeAndArmor", getRootElement(), GiveWeaponeSklad)

 

  • Like 1

Share this post


Link to post
28 minutes ago, K1parik said:

function GiveWeaponeSklad (inf)  if inf == "Deagle" then  giveWeapon( source, 24 )  setWeaponAmmo( source, 24, 100 )  setPedWeaponSlot ( source, 2 )  elseif inf == "Nightstick" then  giveWeapon( source, 3 )  setPedWeaponSlot ( source, 1 )  elseif inf == "Shotgun" then  giveWeapon( source, 25 )  setWeaponAmmo( source, 25, 100 )  setPedWeaponSlot ( source, 3 )  elseif inf == "MP5" then  giveWeapon( source, 29 )  setWeaponAmmo( source, 29, 300 )  setPedWeaponSlot ( source, 7 )  elseif inf == "M4" then  giveWeapon( source, 31 )  setWeaponAmmo( source, 31, 300 )  setPedWeaponSlot ( source, 7 )  elseif inf == "Armor" then  setPedArmor( source, 100 ) endendaddEvent("GiveWeaponeAndArmor", true)addEventHandler("GiveWeaponeAndArmor", getRootElement(), GiveWeaponeSklad)

 

Большое спасибо :)

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.