LabiVila
Members-
Posts
272 -
Joined
-
Last visited
Everything posted by LabiVila
-
Working perfectly, thank you so much guys, I really appreciate your help
-
Thanks for the answer again, fixed all debugscript until they didn't came anymore :v however, I think this part of the script isn't working: function winner () winner = getPlayerName(source) outputChatBox (winner.." won wthe round") for i, v in pairs ( bets ) do if ( isElement ( i ) ) then if ( source == v.player ) then givePlayerMoney ( i, v.amount * 2 ) outputChatBox ( "You won a bet of $"..v.amount.." placed on "..getPlayerName ( source ), i ) end end end bets = { } end addEvent ("onPlayerWinDD", true) addEventHandler ("OnPlayerWinDD", getRootElement(), winner) it doesn't output the chatbox, nor get the winner or give the price.
-
Thanks for the reply Etwin my dude but sadly that's not the only problem as I see... here's a better explanation: This is a bet system, for DM gamemode, and something is not working on it. Everything works cool but I think I haven't got the winner in the proper way, so he doesn't get the reward if the betted player won the map. Thanks further..
-
bets = {} function bet (source, cmd, betted, amount) betted = getPlayerFromName (betted) amount = tonumber (amount) if (betted and amount) and amount > 0 then local money = getPlayerMoney (source) if money < amount then outputChatBox ("No enough money") else bets [source] = {betted, amount} takePlayerMoney (source, amount) outputChatBox ("BEtted") end end end function removeCmd (state) if (state == "Running") then outputChatBox ("Best closed") removeCommandHandler ("bet", bet) end end addEvent ("onRaceStateChanging") addEventHandler ("onRaceStateChanging", getRootElement(), removeCmd) function addCmd () outputChatBox ("Place bets") addCommandHandler ("bet", bet) end addEventHandler ("onGamemodeMapStart", getRootElement(), addCmd) function winner () winner = getPlayerName(source) outputChatBox (winner.." won wthe round") if winner == betted then outputChatBox ("Great job") givePlayerMoney (source, amount*2) end end addEvent ("onPlayerWinDD", true) addEventHandler ("OnPlayerWinDD", getRootElement(), winner) https://forum.multitheftauto.com/viewtopic.php?f=91&t=31731 - I was actually based on this. But what's not working up there? There's no debugscript 3 message as well... thanks further
-
Both work great but Stranger, the code you helped me with disappears the health bar once I have my HP 0. And as for you Et-Win, it works amazingly great. Thank you so much both
-
local x,y = guiGetScreenSize () addEventHandler ("onClientRender", root, function (source) local pVehicle = getPedOccupiedVehicle (localPlayer) if pVehicle then local vHealth = (getElementHealth (pVehicle)-250)/10 dxDrawLine (x/1.05, y/2.1, x/1.05, y/4, tocolor (255, 255, 255)) -- HOR dxDrawLine (x/1.125, y/2.1, x/1.125, y/4, tocolor (255, 255, 255)) -- HOR dxDrawLine (x/1.05, y/2.1, x/1.125, y/2.1, tocolor (255, 255, 255)) -- VER dxDrawLine (x/1.05, y/3.5, x/1.125, y/3.5, tocolor (255, 255, 255)) -- VER dxDrawRectangle (x/1.124, y/2.1,x/15.795, y/-3.97*vHealth/100, tocolor (0, 255, 0, 200)) -- GREEN ARENA end end ) Here is my full script, it actually works cool but after it reaches 0, which means the Green Arena dissapears, if the car still gets damage, the green arena starts going down and down. I want to make like a border, here are some screens for better explanation: cool = http://www.upload.ee/image/4200435/gta_ ... -34-19.png not cool = http://www.upload.ee/image/4200436/gta_ ... -48-21.png
-
I mean even if I'm in any other car, when I buy that Elegy paintjob or whatever, next time I use Elegy, it has the paintjob. You know what I mean? I need that for Race gamemode
-
Hello my comrades; function wdw () local window = guiCreateWindow (0.25, 0.25, 0.50, 0.50, "Cars Paintjob", true) local preview = guiCreateButton (0.65, 0.10, 0.30, 0.13, "Preview", true, window) local buy = guiCreateButton (0.10, 0.65, 0.30, 0.13, "Buy", true, window) buyLabel = guiCreateLabel (0.10, 0.83, 0.40, 0.15, "Price: 50.000$", true, window) local selectList = guiCreateGridList (0.10, 0.10, 0.40, 0.50, true, window) local id = guiGridListAddColumn (selectList, "Car's ID", 0.80) local row1 = guiGridListAddRow (selectList) local row2 = guiGridListAddRow (selectList) local row3 = guiGridListAddRow (selectList) local row4 = guiGridListAddRow (selectList) local row5 = guiGridListAddRow (selectList) guiGridListSetItemText (selectList, row1, id, "Elegy", false, false) guiGridListSetItemText (selectList, row2, id, "Flash", false, true) guiGridListSetItemText (selectList, row3, id, "Jester", false, true) guiGridListSetItemText (selectList, row4, id, "Sultan", false, true) guiGridListSetItemText (selectList, row5, id, "Uranus", false, true) showCursor (true) guiGridListSetSortingEnabled (selectList, false) function previewClick () if (source == preview) then if (guiGridListGetSelectedItem (selectList) == row1) then local elegy = guiCreateStaticImage (0.65, 0.30, 0.30, 0.30, "elegy.png", true, window) elseif (guiGridListGetSelectedItem (selectList) == row2) then local flash = guiCreateStaticImage (0.65, 0.30, 0.30, 0.30, "flash.png", true, window) elseif (guiGridListGetSelectedItem (selectList) == row3) then local jester = guiCreateStaticImage (0.65, 0.30, 0.30, 0.30, "jester.png", true, window) elseif (guiGridListGetSelectedItem (selectList) == row4) then local sultan = guiCreateStaticImage (0.65, 0.30, 0.30, 0.30, "sultan.png", true, window) elseif (guiGridListGetSelectedItem (selectList) == row5) then local uranus = guiCreateStaticImage (0.65, 0.30, 0.30, 0.30, "uranus.png", true, window) end end end addEventHandler ("onClientGUIClick", getRootElement(), previewClick) function buyClick () if (source == buy) then --??????? end end addEventHandler ("onClientGUIClick", getRootElement(), buyClick) end addEventHandler ("onClientResourceStart", getRootElement(), wdw) here's all my script and it shows this: http://www.upload.ee/image/4198840/gta_ ... -04-47.png I'm stuck here and can't seem to find the solution... How can I set the paintjob at a car once I click buy Button forever? With forever I mean no matter if you disconnect... you still have the same "Elegy paintjob" or other car's painjob. I'd really appreciate any answer, feel free to ask for details if you need them. Thanks further
-
Solved, thank you so much both
-
addEventHandler ("onClientMarkerHit", root, function (player) amount = #getElementsByType ("marker") hitCheckpoints = hitCheckpoints + 1 result = amount - hitCheckpoints outputChatBox (result.. " checkpoints to go") if result == 0 then outputChatBox (getPlayerName (player):gsub("#%x%x%x%x%x%x","").." has won the race.", 255, 255, 255) end end ) There are markers (checkpoints exactly) in my map. And I want to delete or destroy each marker I hit so this way I can't hit it twice. So far the script shows this: Once you hit a marker, it subtracts the hit checkpoins from all checkpoints on the map and outputs it on the chatbox. But there's a bug, I can hit a marker how many times I want, so that's why I'm trying to destroy the hit marker.
-
Doesn't work either, now no marker(checkpoint) appears
-
I tried that already but couldn't succeed. How can I destroy that element when the marker isn't in client-side nor in server-side?
-
Hello, how is it possible to destroy the marker you just hit? I mean once you hit it, it will be destroyed then. And, the marker isn't in the script, it's the marker which is exported from the current map. Thanks further, feel free to ask me for details
-
Tried already, my scripting knowledge isn't very nice so far. I was confused because I haven't created a marker in my script, it's the markers on a map I'm playing. I'll try as you assumed, thank you EDIT: Nah, it's way too difficult for me, I'd appreciate if anyone writes me the approximate script.
-
Hello, my problem is simple and hard I think, how can I output a chatbox everytime I hit a marker with: markers left? Like this: You're running a race map for example and once you hit a marker, you destroy the marker you just hitted and output the number of checkpoints left? Thank you farther
-
Use onClientGUIClick: https://wiki.multitheftauto.com/wiki/OnClientGUIClick If you want some more help, please post all your script here
-
Hello, I'm a DM (race) player and I'm in need of some advices; I've already managed to do my script when map starts, but how can I work something when countdown ends? You know, for example putting an outputChatBox right after countdown? Thanks
-
I've tried with those but I didn't succeed, can you write me the whole script possibly?
-
Here's how gridlist looks like: http://www.upload.ee/image/4181865/asdasdasd.png function wdw () PVPw = guiCreateWindow (0.25, 0.25, 0.50, 0.50, "PVP Window", true) guiWindowSetMovable (PVPw, false) guiWindowSetSizable (PVPw, false) playerList = guiCreateGridList (0.10, 0.10, 0.50, 0.85, true, PVPw) guiGridListAddColumn (playerList, "Player List", 0.85) for id, playeritem in ipairs (getElementsByType ("player")) do local row = guiGridListAddRow (playerList) guiGridListSetItemText (playerList, row, 1, getPlayerName (playeritem), false, false) end guiGridListSetSortingEnabled (playerList, false) amountL = guiCreateLabel (0.65, 0.10, 0.30, 0.10, "Cash ammount:", true, PVPw) amount = guiCreateEdit (0.65, 0.17, 0.30, 0.10, "", true, PVPw) amountLimit = guiCreateLabel (0.65, 0.28, 0.30, 0.10, "Limit: 99999$", true, PVPw) guiLabelSetColor (amountLimit, 0, 255, 0) roundsL = guiCreateLabel (0.65, 0.45, 0.30, 0.10, "Rounds", true, PVPw) rounds = guiCreateEdit (0.65, 0.52, 0.30, 0.10, "", true, PVPw) roundsLimit = guiCreateLabel (0.65, 0.63, 0.30, 0.10, "Limit: 8", true, PVPw) guiLabelSetColor (roundsLimit, 0, 255, 0) challb = guiCreateButton (0.65, 0.80, 0.30, 0.15, "Challenge", true, PVPw) end addEventHandler ("onClientResourceStart", getRootElement(), wdw) How can I do so, when I selected a player from gridlist and click challenge button, an outputChatBox appears with the selected name. I've tried hard for that and even posted a topic a while ago but all I managed to get was only outputing in the chatbox first player's name (row #1). Thanks farther
-
Thank you guys, you helped me a lot. Especially you iAbohanab~>...
-
function wdw () local PVPw = guiCreateWindow (0.25, 0.25, 0.50, 0.50, "PVP Window", true) local playerList = guiCreateGridList (0.10, 0.10, 0.50, 0.85, true, PVPw) guiWindowSetMovable (PVPw, false) guiWindowSetSizable (PVPw, false) amountL = guiCreateLabel (0.65, 0.10, 0.30, 0.10, "Cash ammount:", true, PVPw) amount = guiCreateEdit (0.65, 0.17, 0.30, 0.10, "", true, PVPw) amountLimit = guiCreateLabel (0.65, 0.28, 0.30, 0.10, "Limit: 99999$", true, PVPw) guiLabelSetColor (amountLimit, 0, 255, 0) roundsL = guiCreateLabel (0.65, 0.45, 0.30, 0.10, "Rounds", true, PVPw) rounds = guiCreateEdit (0.65, 0.52, 0.30, 0.10, "", true, PVPw) roundsLimit = guiCreateLabel (0.65, 0.63, 0.30, 0.10, "Limit: 8", true, PVPw) guiLabelSetColor (roundsLimit, 0, 255, 0) challb = guiCreateButton (0.65, 0.80, 0.30, 0.15, "Challenge", true, PVPw) end addEventHandler ("onClientResourceStart", getRootElement(), wdw) function playerListt () local column = guiGridListAddColumn (playerList, "Player", 0.85, playerList) if (column) then for id, playeritem in ipairs (getElementsByType ("player")) do local row = guiGridListAddRow (playerList) guiGridListSetItemText (playerList, row, column, getPlayerName (playeritem), false, false) local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 ) outputChatBox (playerName) end end end addEventHandler ("onClientResourceStart", getRootElement(), playerListt) the outputChatBox doesn't work, what's wrong?
-
Works amazingly, thank you so much, really appreciate it.
-
--server function allW (source) triggerClientEvent (source, "passM") givePlayerMoney (source, 10) end addEventHandler ("onClientResourceStart", getRootElement(), allW) function takeMoney (source) local money = getPlayerMoney (source) if (money > 500) then triggerClientEvent ("parted", true) takePlayeMoney (source, 500) else triggerClientEvent ("notparted", true) end end addCommandHandler ("par", takeMoney) --client function passMessage () setTimer (outputChatBox, 5000, 0, "* 5000$ will be given away randomly, participate by writing /par.", 255, 255, 255, root) end addEvent ("passM", true) addEventHandler ("onClientResourceStart", getRootElement(), passMessage) function participating () triggerServerEvent ("money", true) end addCommandHandler ("par", participating) function participated () outputChatBox ("You participated") end addEvent ("parted", participated) function notParticipated () outputChatBox ("Failed") end addEvent ("notparted", notParticipated) not sure what's not working, can you help me a bit?
-
Yea, it's easy for you but not for beginners like me. However, let's not cry, function playerList () local playerList = guiCreateGridList (0.10, 0.10, 0.50, 0.85, true, PVPw) local column = guiGridListAddColumn (playerList, "Player", 0.85) local asd = guiGridListGetItemText (playerList, column) if (column and asd) then for id, playeritem in ipairs (getElementsByType ("player")) do local row = guiGridListAddRow (playerList) guiGridListSetItemText (playerList, row, column, getPlayerName (playeritem), false, false) outputChatBox (""..asd.."") end end end addEventHandler ("onClientResourceStart", getRootElement(), playerList) The code might be confusing but.. I need a hand on it, what isn't working? The debugscript 3 says that it needs a number at line 22, and there's none.
-
Yea managed to solve that one, thanks, by trying myself is better. What about this one? function playerList () local playerList = guiCreateGridList (0.10, 0.10, 0.50, 0.85, true, PVPw) local column = guiGridListAddColumn (playerList, "Player", 0.85) if (column) then for id, playeritem in ipairs (getElementsByType ("player")) do local row = guiGridListAddRow (playerList) guiGridListSetItemText (playerList, row, column, getPlayerName (playeritem), false, false) end end end addEventHandler ("onClientResourceStart", getRootElement(), playerList) how can I get the clicked player's name and put it to outputChatBox? https://wiki.multitheftauto.com/wiki/Gu ... etItemText I think it's this but it's honestly hard... I'd be grateful for any help (and any explanation)