Agon

Members
  • Content Count

    151
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Agon

  • Rank
    Busta
  • Birthday 04/05/1995

Details

  • Gang
    none
  1. function justTesting() myPlayer = getRandomPlayer() givePlayerMoney(myPlayer, 1000) giveWeapon(myPlayer, 31, 200) outputChatBox("You are the choosen one!", myPlayer, 255, 0, 0) end addCommandHandler("justtest", justTesting) For example there are 4 players in my server. A = 1st player B = 2nd player C = 3rd player D = 4th player. myPlayer = getRandomPlayer() will get a random player i.e B. but will "givePlayerMoney(myPlayer, 1000)" line give the player named "B" money and weapon or get another random player? ----------------------------------------------------------------- Second question. How can i get a player's death reason? i tried this but didn't work function playerWasted ( ammo, attacker, weapon, bodypart ) if (attacker == 53) then --- if the player drowned outputChatBox("You are drowned", source) end end --- lol forgot this addEventHandler("onPlayerWasted", getRootElement(), playerWasted)
  2. Agon

    [QUESTION]Tables

    Thank you it works
  3. Agon

    [QUESTION]Tables

    thank you ernst and karthik_184 but i have a problem now t = { lol = "duck" bastard = "***" } --- this code works BUT t = { lol = "duck" bastard = "***" #%x%x%x%x%x%x = "" } --- this code doesn't work I tried making even this: t = { "lol" = "duck" "bastard" = "***" "#%x%x%x%x%x%x" = "" } --- but this code doesn't work either so is there any way of disabling color codes on messages or do you have an idea about this problem?
  4. Agon

    [QUESTION]Tables

    wow it works thank you guys and karthik_184 thank you for explaining the script and 1 more question. How can i detect player's message? I want to make a bot system. for example when i say hello, the bot will say hello. I know how to make a bot talk but don't know how to detect a message
  5. Agon

    [QUESTION]Tables

    Hi guys. This is my chat script (in freeroam/fr_server.lua). addEventHandler('onPlayerChat', g_Root, function(msg, type) if type == 0 then cancelEvent() local r, g, b = getPlayerNametagColor(source) local accName = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Owner" ) ) then outputChatBox("#00A6FF[Owner]" .. getPlayerName(source) .. ': #FFFFFF' .. msg:gsub('#%x%x%x%x%x%x', ''), g_Root, r, g, b, true) outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. msg ) else if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then outputChatBox("#FF0000[Admin]" .. getPlayerName(source) .. ': #FFFFFF' .. msg:gsub('#%x%x%x%x%x%x', ''), g_Root, r, g, b, true) outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. msg ) else if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Moderator" ) ) then outputChatBox("#FFCC00[Moderator]" .. getPlayerName(source) .. ': #FFFFFF' .. msg:gsub('#%x%x%x%x%x%x', ''), g_Root, r, g, b, true) outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. msg ) else outputChatBox( getPlayerName(source) .. ': #FFFFFF' .. msg:gsub('#%x%x%x%x%x%x', ''), g_Root, r, g, b, true) outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. msg ) end end end end end ) as you know this thingy changes hex codes to space => msg:gsub('#%x%x%x%x%x%x', '') for example when I type #FF0000Hello #00FF00World, it should output Hello World but it outputs, Hello World. I want to change some words to anothers. For example when someone types "lol", it should change it to "duck", "bastard" to "***" and "account" to "123". How can i make this with tables? i tried this but I don't think it will work: originalMessages = {lol, bastard, account} newMessages = {duck, ***, 123} msg:gsub(tostring(originalMessages), tostring(newMessages)) or should I make it like this? originalMessages = {[lol], [bastard], [account]} newMessages = {[duck], [***], [123]} I don't know tables very well so i need your helps. Thanks in advance.
  6. OnVehicleStartEnter cancelEvent outputChatBox I think these can help you
  7. ShowPlayerHudComponent this will help
  8. Agon

    [HELP] minigame

    But if i use source instead of victim, should i be able to detach the element? because it is attached to "victim" not source and btw I have 2 questions: 1) How can i make a timer? I mean for example I want the killer to kill victim in 5 minutes. 2)Will this work? I mean will the money and points be seen on the scoreboard? I'm not good at scoreboard function scoreBoard() scoreboardAddColumn("Points") scoreboardAddColumn("Money") end addEventHandler("onResourceStart", getResourceName(getThisResource()), scoreBoard)
  9. Agon

    [HELP] minigame

    It works fine until you kill the victim. WARNING: ktv\ktv.lua:38: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got boolean] WARNING: ktv\ktv.lua:39: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got boolean] WARNING: ktv\ktv.lua:40: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] WARNING: ktv\ktv.lua:41: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean]
  10. Agon

    [HELP] minigame

    I tried to make something like this but it doesn't work. It gives errors. Here is the code: function setKillerAndVictim(source, command, killer, victim) if killer and victim then local sAccount = getPlayerAccount(source) local kAccount = getPlayerAccount(killer) local vAccount = getPlayerAccount(victim) local vx, vy, vz = getElementPosition(victim) if isObjectInACLGroup("user."..getAccountName(sAccount), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(sAccount), aclGetGroup("Owner")) then setAccountData(kAccount, "is.killer", true) setAccountData(vAccount, "is.victim", true) local vMarker = createMarker(vx, vy, vz, "arrow", 0.5, 255, 0, 0, 170, killer) attachElements(vMarker, victim, 0, 0, 1.5) else outputChatBox("[ERROR]: You don't have permission to use this command!", source, 255, 0, 0) end else outputChatBox("[ERROR]: The syntax is: /ktv [killername] [victimname]", source, 255, 0, 0) end end addCommandHandler("ktv", setKillerAndVictim) function giveCredits(ammo, killer, weapon, bodypart, victim, vMarker) local kAccount = getPlayerAccount(killer) local vAccount = getPlayerAccount(victim) local isKiller = getAccountData(kAccount, "is.killer") local isVictim = getAccountData(vAccount, "is.victim") if isKiller and isVictim then setAccountData(kAccount, "is.killer", false) setAccountData(vAccount, "is.victim", false) detachElements(vMarker, victim) givePlayerMoney(killer, 1000) setAccountData(kAccount, "game.points", getAccountData(kAccount, "game.points") +10) outputChatBox("[Mini Game]" .. getPlayerName(killer) .. "get 1000$ and 10 points by killing" .. getPlayerName(victim) .. "!", getRootElement(), 0, 120, 0) end end addEventHandler("onPlayerWasted", getRootElement(), giveCredits) and the errors: WARNING: ktv\ktv.lua:4: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got string 'agon'] WARNING: ktv\ktv.lua:5: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got string 'mahmut'] WARNING: ktv\ktv.lua:6: Bad argument @ 'getElementPosition' [Expected element at argument 1, got string 'mahmut'] WARNING: ktv\ktv.lua:8: Bad argument @ 'setAccountData' [Expected account at argument 1, got boolean] [WARNING: ktv\ktv.lua:9: Bad argument @ 'setAccountData' [Expected account at argument 1, got boolean] WARNING: ktv\ktv.lua:10: Bad argument @ 'createMarker' WARNING: ktv\ktv.lua:11: Bad argument @ 'attachElements' [Expected element at argument 1, got boolean] I defined them but ..
  11. Agon

    [HELP] Smoke tires

    there are some "Third Party GTA Mods" which make those smokes invisible. I don't think you can make it with script. Edit: Try deleting gta_sa.set file from the User Files. Edit 2: Try installing "GTA SA Ruckelfreier Mod v1.2" if deleting gta_sa.set doesn't work.
  12. Agon

    [HELP] skin system

    Sorry it was working. my fault btw i have a new question. i edited my first post