Galactix
Members-
Posts
121 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Galactix
-
@Mr.Loki I didn't meant it for message color, but for the nametags color set up with the setPlayerNametagColor function. It doesn't appear in chat, only in scoreboard and under the player's health. By the way, how to use the account name for display instead to prevent players from using hexacode colors?
-
Up because problem not solved
-
Hello, I have used the function setPlayerNametagColor to set the color of the player's nametag according to his ACL rank, but I would also like the color in chat to be changed as to grant more visibility to both staff and vip players. The problem is that I have been searching for similar topics but found nothing usable to start scripting such a function, so I would like someone to give me an idea of what to use in order to make that possible.
-
I guess Mr.Loki’s solution also work.
-
The wiki says getWeaponClipAmmo is used for custom weapons, but doesn't seem to work with weapons from GTA:SA. I suggest you make a table with all the weapon IDs and their clip with a variable that would get the clip number and show it on the screen. The wiki says getWeaponClipAmmo is used for custom weapons, but doesn't seem to work with weapons from GTA:SA. I suggest you make a table with all the weapon IDs and their clip with a variable that would get the clip number and show it on the screen. To get an idea of this, it would look like: local weaponClip = { [22] = {17}, --colt [23] = {17}, --silenced [24] = {7}, --deagle [25] = {1}, --shotgun [26] = {2}, --sawed-off [27] = {7}, --spaz [28] = {50}, --uzi [29] = {30}, --mp5 [30] = {30}, --ak47 [31] = {50}, --m4 [32] = {50}, --tec9 [33] = {1}, --rifle [34] = {1}, --sniper rifle [37] = {50} --flamethrower [38] = {500} --minigun [41] = {500} --spraycan [41] = {500} --spraycan [42] = {500} --fire extinguisher [43] = {36} --camera } --And the variable you would put to replace your current clip one would be: local clip = weaponClip [ getPedWeapon (source)] You would also have to specify the rest of the weapons but I've normally stated all the weapons that do have a clip, the others are like explosives and others so you'd have to add them to the table or also you could just use a if statement that would check if the weapon clip displayed is from a weapon from the table or if it's not (which means it would be melee or throwable) then just display 1 for the clip. I can't seem to be able to edit my previous post for some reasons, but I just wanna say that I forgot some "," in the table which would get you an error, so dont forget to add them for the lines that do miss one except for the last one.
-
Well, try Mr.Loki's solution and I'll help you if it doesn't work, but it seems good for me.
-
I would gladly provide you a working script but unfortunately I wouldn't be able to test it as a second player is required for that. All I can say is that you need to make a if statement that includes your table and would make the event trigger when a player is piloting an hydra and gets hit by one of the 3 explosive id from the table which would then trigger the kill function.
-
From my understanding, your script basically kills the attacker when he hits an hydra because you set the triggerServerEvent element to attacker, whereas it should be source because the event is triggered when a vehicle gets damaged. By changing your "attacker" at line 13 to "source", the event should trigger for the person being hit, and not the opposite. But what you should also fix is that by the way your script is, it triggers by any type of damage, as you don't use the explosiveWeaponIDS table at all.
-
I'm really unsure if that would work, but you could try: If it doesn't work, try with local theWeapon = getPlayerWeapon ( source ) function ammoRender () local ammo = getWeaponAmmo(theWeapon) local clip = getWeaponClipAmmo(theWeapon) dxDrawText(''..ammo .. '|' ..clip..'', 1600/oX*x, 100/oY*y, _, _, _, 2/oX*x, "pricedown", "left", "top") end addEventHandler("onClientRender", root, ammoRender
-
You're welcome
-
There is no such weapon ID in MTA. M4 ID would be 31.
-
Yeah, I managed to solve that myself but thanks
-
Thanks Pirulax, but now it says at line 6 that I am trying to compare a boolean with a number, so why isn't the oldHeroinCount variable acquired properly?
-
Yes, that's pretty obvious thanks, but then what do I put instead?
-
Hello, I'm trying to get my GUI to trigger a server event but I can't manage to find how to send the actual player element needed by the function to work. --HEROIN DRUG EFFECT ON function heroinDrugOn(player) local oldHeroinCount = getElementData ( player, "Heroin" ) local heroinStatus = getElementData (player, "heroinStatus") if heroinStatus ~= true then if oldHeroinCount ~= false then setElementData(player, "heroinStatus", true) setElementData ( player, "Heroin", oldHeroinCount-1 ) setPedStat ( player, 24, 1000) setElementHealth(player, 200) setTimer(heroinDrugOff, 60000, 1, player) triggerClientEvent ( player, "heroinOnMessage", root) else triggerClientEvent ( player, "heroinNotEnough", root) return end else triggerClientEvent (player, "heroinCooldownMessage", root) end end addCommandHandler("useheroin", heroinDrugOn) addEvent("useHeroin", true) addEventHandler("useHeroin", root, heroinDrugOn) And I use: triggerServerEvent ( "useHeroin", localPlayer)
-
Is your problem solved already? As Dimos7 said, you could just use a createMarker function that would use a time based variable in order to define the marker radius and it would update at a specific frequency using setTimer
-
Hello, it's been a while since I tried to use the extrahealth resource made by Solidsnake14, but I can't manage to get it working. addEvent( "onZombieSpawn", true ) function RanSpawn_Z ( gx, gy, gz, rot) local safezone = 0 local allradars = getElementsByType("radararea") if getElementData(theRadar, "zombieProof") == true then for theKey,theRadar in ipairs(allradars) do if isInsideRadarArea ( theRadar, gx, gy ) then safezone = 1 end end end if safezone == 0 then if table.getn ( everyZombie ) < newZombieLimit then if not rot then rot = math.random (1,359) end randomZskin = math.random ( 1, table.getn ( ZombiePedSkins ) ) local zomb = createPed( tonumber( ZombiePedSkins[randomZskin] ), gx, gy, gz ) if zomb ~= false then setElementData ( zomb, "zombie", true ) exports.extrahealth:setElementExtraHealth(zomb, 10000) table.insert( everyZombie, zomb ) setTimer ( function (zomb, rot) if ( isElement ( zomb ) ) then setPedRotation ( zomb, rot ) end end, 500, 1, zomb, rot ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setPedAnimation ( zomb, "ped", chaseanim, -1, true, true, true ) end end, 1000, 1, zomb ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setElementData ( zomb, "status", "idle" ) end end, 2000, 1, zomb ) triggerClientEvent ( "Zomb_STFU", getRootElement(), zomb ) end end end end addEventHandler( "onZombieSpawn", getRootElement(), RanSpawn_Z ) I don't get any error from the script, but the zombies keep having 100 hp. If someone knows what I'm doing wrong I'd gladly apreciate to know what it is. For those who wonder, the function is exported in the meta file properly.
-
Thanks, that worked!
-
You didn't have to post the whole script, you could've just posted the function that causes the errors and the functions working along with it. With that being said, it is a bit too complicated for me being able to help you, sorry about that. Hopefully now that you posted the script someone else can help you fixing it.
-
If you want someone to be able to help you, you need to post the scripts that are causing the error first, otherwise we don't have the possibility to understand the issue.
-
Hello everyone, I am using a damage multiplying table for my server and I just modified the script so that it works on both players and zombies, but I noticed a weird bug: I added an outputchatbox function and saw that the function triggers itself 1-3 times for a single shot, which results in ridiculous damage dealt (you almost oneshot a player using colt shooting him in the torso). How can I avoid that? CLIENT SIDE function playerdamaged ( attacker, weapon, bodypart ) if getElementType ( source ) == "player" then if (getElementData (source, "zombie") == false) then triggerServerEvent ("multiplierplr", source, source, attacker, weapon, bodypart ) end end end addEventHandler ( "onClientPlayerDamage", getRootElement(), playerdamaged ) SERVER SIDE local weaponTable = { -- populate this list by adding weapons: -- [weap_id] = { torso, ass, left_arm, right_arm, left_leg, right_leg, head } [1] = { 1.00, 0.80, 0.80, 0.80, 0.80, 0.80, 1.25}, [22] = { 1.00, 0.80, 0.80, 0.80, 0.80, 0.80, 1.25}, [23] = { 1.00, 0.80, 0.80, 0.80, 0.80, 0.80, 1.25}, [24] = { 1.00, 0.80, 0.80, 0.80, 0.80, 0.80, 1.25}, [25] = { 1.00, 0.80, 0.80, 0.80, 0.80, 0.80, 1.25}, [26] = { 1.00, 0.80, 0.80, 0.80, 0.80, 0.80, 1.25}, [27] = { 1.00, 0.80, 0.80, 0.80, 0.80, 0.80, 1.25}, [28] = { 1.00, 0.80, 0.80, 0.80, 0.80, 0.80, 1.25}, [29] = { 1.00, 0.80, 0.80, 0.80, 0.80, 0.80, 1.25}, [30] = { 1.00, 0.80, 0.80, 0.80, 0.80, 0.80, 1.25}, [31] = { 1.00, 0.80, 0.80, 0.80, 0.80, 0.80, 1.25}, [32] = { 1.00, 0.80, 0.80, 0.80, 0.80, 0.80, 1.25}, [33] = { 1.00, 0.80, 0.80, 0.80, 0.80, 0.80, 1.25}, [34] = { 1.00, 0.80, 0.80, 0.80, 0.80, 0.80, 1.25}, [38] = { 1.00, 0.80, 0.80, 0.80, 0.80, 0.80, 1.25} } local weaponDmg = { [1] = {999999}, --brassknuckles [22] = {25}, --colt [23] = {40}, --silenced [24] = {70}, --deagle [25] = {10}, --shotgun [26] = {10}, --sawed-off [27] = {15}, --spaz [28] = {20}, --uzi [29] = {25}, --mp5 [30] = {30}, --ak47 [31] = {30}, --m4 [32] = {20}, --tec9 [33] = {75}, --rifle [34] = {125}, --sniper rifle [38] = {140} --minigun } addEvent( "multiplierplr", true ) function Pheadhit ( player,attacker, weapon, bodypart) if not (getElementData (attacker, "zombie") == true) then local bodyPartsDamageTable = weaponTable[ getPedWeapon (attacker) ] local weaponDmgTable = weaponDmg [ getPedWeapon (attacker)] local damageMultiplier = bodyPartsDamageTable [ bodypart - 2] if ((damageMultiplier * weaponDmgTable [1]) > getElementHealth(player)) then killPed(player, attacker) outputChatBox("Hit!") else outputChatBox("Hit!") setElementHealth ( player, getElementHealth(player) - (damageMultiplier * weaponDmgTable [1] ) ) return end end end addEventHandler( "multiplierplr", getRootElement(), Pheadhit )
-
Hello! I have scripted a pay command but I dont want guest accounts to be able to use it because they can send infinite amounts of money. I tried to put a condition with if that would make a guest account unable to use the command, but I get an error stating that condition is missing an "end". I tried to put dozens of end after or even just one but the result is always the same. addCommandHandler( 'pay', function( source,_,player,amount ) local find = findPlayer( player ) if find then local sourceAccount = getPlayerAccount ( playerSource ) local guestAccount = getPlayerAccount ( playerSource ) if (guestAccount == guest) then return else if amount then givePlayerMoney( find,tonumber( amount ) ) takePlayerMoney ( source, tonumber(amount) ) outputChatBox( '[Pay]:You transfered '..amount..'$ to '..getPlayerName( find ),source,255,0,0 ) outputChatBox( '[Pay]:You received '..amount..'$ from '..getPlayerName( source ),find,0,255,0 ) else outputChatBox( '[Pay]:/pay [playername][amount]!',source,255,0,0 ) end else outputChatBox( '[Pay]: You are not logged in!',source,255,0,0 ) end else outputChatBox( '[Pay]:Player not found!',source,255,0,0 ) end end end )