Jump to content

Galton

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by Galton

  1. thank you both. I really appreciate your help.
  2. thanks for the answer. it's shorter than mine and it works. your example is a much better way to do it.
  3. edit: I can get it to work with addCommandHandler now. I still don't know how it works with events though. I'd greatly appreciate it if you could explain. fixed code with addEventHandler: function delayedKill (player) setTimer ( function () killPed(player) end, 1500, 1) end addCommandHandler ("test1", delayedKill)
  4. even tho restarting the resource didn't help (apparently), I tried restarting my server and now it works fine. weird. anyway, thanks for your help.
  5. it's server side, uziCheck function is executed by clicking a gui button. it works perfectly fine when I'm holding tec9. I tried replacing 32 with something else and it also works fine.
  6. this is my code: function uziCheck () local uzistat = getPedStat(client,75) if getPedWeapon(client) == 32 or getPedWeapon(client) == 28 then if uzistat == 500 then setPedStat (client, 75, 1000) -- outputChatBox ("test: uzi stat: 1000", client) reloadPedWeapon (client) else -- outputChatBox ("test: uzi stat: 500", client) setPedStat (client, 75, 500) reloadPedWeapon (client) end else outputChatBox ("You must be holding Tec9/Uzi in order to change your Tec9/Uzi stat", client) end end I'm trying to see if I made a mistake, but it looks fine to me.
  7. thanks for replying. sadly it didn't fix the problem.
  8. Hello, I want to check if the player is holding a uzi or tec9; if getPedWeapon(client) == 32 or 28 then everything else works fine, but my code only works if I'm holding tec9, not uzi. ( 32 = tec9, 28 = uzi) sadly google didn't help at all. thanks in advance.
  9. hello, my first question is how can I define local player for a server side script? it's something I cannot understand, is there a way to do it? my second question is I'm trying to make a script that will save your skin on death and give your skin back on spawn. but I cannot make it work. this is my code; function getSkin () local playerSkin = getElementModel(getPlayerFromName(source)) end function setSkin () setElementModel(getPlayerFromName(source),playerSkin) end addEventHandler ("onPlayerWasted",root,getSkin) addEventHandler ("onPlayerSpawn",root,setSkin) if I use "myActualNick" instead of source, it works perfectly fine. I don't know what's the problem, but I'd love to get some help. thanks in advance.
  10. setPedFightingStyle (client,15) works fine. this is how I defined playerMoney: function setstyle7 () local playerMoney = getPlayerMoney(client) local moneyM1000 = playerMoney -1000 local moneyM3000 = playerMoney -3000 if ( playerMoney > 3000 ) then setPedFightingStyle (client,7) setPlayerMoney (client, moneyM3000) outputChatBox ("test") else outputChatBox ("test2") end end I added local playerMoney = getPlayerMoney(client) local moneyM1000 = playerMoney -1000 local moneyM3000 = playerMoney -3000 in all functions. thank you for your help.
  11. Thanks for the reply. This code is from a server-side script, I tried making it client-side but setPedFightingStyle wouldn't work. so I had to use addEvent and triggerServerEvent instead. Even if I can make it work in a client side script, I'd still like to learn how to define local player in a server-side script.
  12. playerMoney = getPlayerMoney(PLAYER*) moneyM1000 = playerMoney -1000 moneyM3000 = playerMoney -3000 localplayer = getPlayerFromName (PLAYER*) addEvent("onBtn1",true) function setstyle15(PLAYER*) setPedFightingStyle (PLAYER*,15) end addEventHandler ("onBtn1", getRootElement(), setstyle15) I'm trying to make a gui which has 5 buttons, if you click them I want them to change your fighting style (they all give you different styles). I need to get the local player who clicks the button on GUI for which I typed "PLAYER*", everything else works without a problem so far. Thanks in advance.
  13. hello, I'm new to scripting and I want to make a drowning sound script, my code works fine but I want the sound to play only once, how can I do it? here's the code; function drowning() getPedOxygenLevel ( localPlayer ) local oxygen = getPedOxygenLevel ( localPlayer ) if oxygen == 0 then local sound = playSound("sounds/drowning_sound.mp3") setSoundVolume (sound, 3.5) end end addEventHandler("onClientPlayerDamage", getLocalPlayer(), drowning)
×
×
  • Create New...