Jump to content

Agon

Members
  • Posts

    151
  • Joined

  • Last visited

Everything posted by Agon

  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. 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. 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
  13. Damn It is working how stupid i am. Btw how can i spawnPlayer a little bit later? When i die, it immediately spawns me. I want to see my body lying on the floor when the camera going up while shaking. I mean a little bit later
  14. seriously, what? scripters won't edit or make scripts for you they just give you tips or the correct form of the script. Try making it yourself.
  15. thank you guys it works edit: btw why this? function fGiveVehicle(source, command, ...) local id = table.concat(arg," ") I mean what do table.concat(arg, " ") and ... do?
  16. Thank you it works but i have a problem. when i type /vehicle blista compact, it sees the command as /vehicle blista. so i found this id:gsub(' ', ' ') but it doesn't work (on the 5th line) function fGiveVehicle(source, command, id) if id then local id = tonumber(id) or getVehicleModelFromName(id) if isModelInTable(id) then id:gsub(' ', ' ') if not isPedInVehicle(source) then x, y, z = getElementPosition(source) xr, yr, zr = getElementRotation(source) veh = createVehicle(id, x, y, z, xr, yr, zr) warpPedIntoVehicle(source, veh) outputChatBox("You spawned a "..getVehicleNameFromModel(id),source,0,255,255) else ocVeh = getPedOccupiedVehicle(source) setElementModel(ocVeh, id) end else outputChatBox("Invalid vehicle name/id",source,255, 0, 0) end else outputChatBox("Please use: /vehicle [id or name]",source,0,255,255) end end addCommandHandler("vehicle", fGiveVehicle)
  17. no errors and i can't get the powers I think it doesn't make anything when i get into marker or the problem is in the powers
  18. i know getVehicleNameFromModel but don't know how to place it in the script made the vehicle table now what? btw can i make something that when i type either car name or id and it will see it as the vehicle's id and spawn the vehicle? i'm not good at tables but i think it was something like that: vehicleTable = { [429] = "Banshee", [500] = "Mesa"} . when i type mesa, it will find the id in the table and spawn the vehicle by it's id not name. that can be very easy if you tell me how can i make this. vehicleIDS = { 602, 545, 496, 517, 401, 410, 518, 600, 527, 436, 589, 580, 419, 439, 533, 549, 526, 491, 474, 445, 467, 604, 426, 507, 547, 585, 405, 587, 409, 466, 550, 492, 566, 546, 540, 551, 421, 516, 529, 592, 553, 577, 488, 511, 497, 548, 563, 512, 476, 593, 447, 425, 519, 520, 460, 417, 469, 487, 513, 581, 510, 509, 522, 481, 461, 462, 448, 521, 468, 463, 586, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 485, 552, 431, 438, 437, 574, 420, 525, 408, 416, 596, 433, 597, 427, 599, 490, 432, 528, 601, 407, 428, 544, 523, 470, 598, 499, 588, 609, 403, 498, 514, 524, 423, 532, 414, 578, 443, 486, 515, 406, 531, 573, 456, 455, 459, 543, 422, 583, 482, 478, 605, 554, 530, 418, 572, 582, 413, 440, 536, 575, 534, 567, 535, 576, 412, 402, 542, 603, 475, 449, 537, 538, 441, 464, 501, 465, 564, 568, 557, 424, 471, 504, 495, 457, 539, 483, 508, 571, 500, 444, 556, 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503, 579, 400, 404, 489, 505, 479, 442, 458, 606, 607, 610, 590, 569, 611, 584, 608, 435, 450, 591, 594 } vehicleNames = { alpha, blista compact, bravura, buccaneer, cadrona, club, esperanto, feltzer, fortune, hermes, hustler, majestic, manana, picador, previon, stafford, stallion, tampa, virgo, admiral, damaged glendale, elegant, emperor, euros, glendale, greenwood, intruder, merit, nebula, oceanic, premier, primo, sentinel, stretch, sunrise, tahoma, vincent, washington, willard, andromada, at-400, beagle, cargobob, cropduster, dodo, hunter, hydra, leviathan, maverick, nevada, news chopper, police maverick, raindance, rustler, seasparrow, shamal, skimmer, sparrow, stuntplane, bf-400, bike, bmx, faggio, fcr-900, freeway, mountain bike, nrg-500, pcj-600, pizza boy, sanchez, wayfarer, coastguard, dinghy, jetmax, launch, marquis, predator, reefer, speeder, squalo, tropic, baggage, utility van, bus, cabbie, coach, sweeper, taxi, towtruck, trashmaster, ambulance, barracks, enforcer, fbi rancher, fbi truck, fire truck, hpv1000, patriot, police car, police ranger, S.W.A.T., securicar, benson, black boxville, boxville, cement truck, combine harvester, dft-30, dozer, dumper, dune, flatbed, hotdog, linerunner, mr. whoopee, mule, packer, roadtrain, tractor, yankee, berkley's rc van, bobcat, burrito, damaged sadler, forklift, moonbeam, mower, news van, pony, rumpo, sadler, tug, walton, yosemite, blade, broadway, remington, savanna, slamvan, tornado, voodoo, buffalo, clover, phoenix, sabre, tram, freight, brown streak, flat freight, box freight, rc bandit, rc baron, rc goblin, rc raider, rc tiger, bandito, bf injection, bloodring banger, caddy, camper, journey, kart, mesa, monster, monster 2, monster 3, quadbike, sandking, vortex, banshee, bullet, cheetah, comet, elegy, flash, hotknife, hotring racer, hotring racer 2 ,hotring racer 3, infernus, jester, stratum, sultan, super gt, turismo, uranus, windsor, zr-350, huntley, landstalker, perennial, rancher, regina, romero, solair, baggaga trailer, farm trailer, street clean trailer, stairs, trailer 1, trailer 2, trailer 3, rc cam} function isModelInTable ( theModel ) local found = false for _, model in ipairs ( vehicleIDS ) do if ( model == theModel ) then found = true break end end return found end function fGiveVehicle(source, command, id) if isModelInTable ( tonumber ( id ) ) then if not isPedInVehicle(source) then x, y, z = getElementPosition(source) xr, yr, zr = getElementRotation(source) veh = createVehicle(id, x, y, z, xr, yr, zr) warpPedIntoVehicle(source, veh) else ocVeh = getPedOccupiedVehicle(source) setElementModel(ocVeh, id) end else outputChatBox("Invalid vehicle id",source,255, 0, 0) end end addCommandHandler("vehicle", fGiveVehicle)
  19. This is the code (I defined them in marker functions as well and hope did it right ) and I also defined powerAccount in makeMePowerless function function createEverything() local nukeMarker = createMarker(-345.10000610352, 1612.8000488281, 74.599998474121, "cylinder", 2, 255, 0, 0, 170) local boltMarker = createMarker(-2368, 1550.8000488281, 1.1000000238419, "cylinder", 2, 255, 255, 0, 170) local invisibleMarker = createMarker(585.09997558594, 870.20001220703, -43.5, "cylinder", 2, 255, 255, 255, 170) speed = getGameSpeed() addEventHandler("onMarkerHit", nukeMarker, nukeMarkerHit) addEventHandler("onMarkerHit", nukeMarker, BoltMarkerHit) addEventHandler("onMarkerHit", nukeMarker, invisibleMarkerHit) end addEventHandler("onResourceStart", resourceRoot, createEverything) function bindTheKeys(source, commandName) bindKey ( source, "R", "down", togglePowers ) end addEventHandler( "onPlayerLogin", getRootElement(), bindTheKeys ) function makeMePowerless(powerAccount) setAccountData(powerAccount, "player.nuke", 0) setAccountData(powerAccount, "player.bolt", 0) setAccountData(powerAccount, "player.invisible", 0) end addEventHandler("onPlayerLogin", getRootElement(), makeMePowerless) function nukeMarkerHit(source, matchingDimension, myNukePower, myBoltPower, myInvisiblePower, powerAccount) if (myNukePower == 0) then if (myBoltPower == 1) or (myBoltPower == 0) then if (myInvisiblePower == 1) or (myInvisiblePower == 0) then setAccountData(powerAccount, "player.nuke", 1) setAccountData(powerAccount, "player.bolt", 0) setAccountData(powerAccount, "player.invisible", 0) outputChatBox("Nuke Marker", source, 0, 255, 0) end end end end function BoltMarkerHit(source, matchingDimension, myNukePower, myBoltPower, myInvisiblePower, powerAccount) if (myBoltPower == 0) then if (myNukePower == 1) or (myNukePower == 0) then if (myInvisiblePower == 1) or (myInvisiblePower == 0) then setAccountData(powerAccount, "player.nuke", 0) setAccountData(powerAccount, "player.bolt", 1) setAccountData(powerAccount, "player.invisible", 0) outputChatBox("Bolt Marker", source, 0, 255, 0) end end end end function invisibleMarkerHit(source, matchingDimension, myNukePower, myBoltPower, myInvisiblePower, powerAccount) if (myInvisiblePower == 0) then if (myBoltPower == 1) or (myBoltPower == 0) then if (myNukePower == 1) or (myNukePower == 0) then setAccountData(powerAccount, "player.nuke", 0) setAccountData(powerAccount, "player.bolt", 0) setAccountData(powerAccount, "player.invisible", 1) outputChatBox("Invisible Marker", source, 0, 255, 0) end end end end function togglePowers(source, myNukePower, myBoltPower, myInvisiblePower, powerAccount) local powerAccount = getPlayerAccount(source) local myNukePower = getAccountData(powerAccount, "player.nuke") local myBoltPower = getAccountData(powerAccount, "player.bolt") local myInvisiblePower = getAccountData(powerAccount, "player.invisible") if (myBoltPower == 1) and (speed == 1) then setGameSpeed(3) else setGameSpeed(1) end if (myNukePower == 1) then local blowMarker = createMarker(0, 0, 0, "corona", 1, 255, 255, 0, 255) attachElements(blowMarker, source, 0, 0, 0, 0, 0, 0) function setTheAnim(source) setPedAnimation(source, "BOMBER", "BOM_Plant_Loop", 1000, false, false, false, true) x, y, z = getElementPosition(source) createExplosion(x+x, y-y, z, 10) end setTimer(setTheAnim, 2000, 1) end if (myInvisiblePower == 1) and isPlayerNametagShowing(source) then setPlayerNametagShowing(source, false) setElementAlpha(source, 0) else setPlayerNametagShowing(source, true) setElementAlpha(source, 255) end end I defined them (imo) but when i log in it says: WARNING: powers\power.lua:13: Bad 'player' pointer @ 'bindKey'(1)
  20. oh thanks now how can i make it both vehicle id's and names? should i make vehicle names' table?
  21. but they are in togglePowers function. do i have to define them? if so, how?
  22. damn. i should have make it client side i tried other markers but there is neither powers nor messages...
×
×
  • Create New...