kikos500
Members-
Posts
125 -
Joined
-
Last visited
Everything posted by kikos500
-
I thought about storing pkiller aandthe player killed in a element data and comparing it with the bounty killer so im wondering if it will work
-
Naah I wantt a command when you write it like /bounty AirFighter. Cash when AirFighter dies the killer of him gets the cash
-
well i have asked this question before but i started now so i finished the kills script but i made the kills to detect any player who kills the other so the problem is i tried a lot of times to make it detect the guy who has bounty on but i failed there is the kills / bounty code ---- server.lua function findPlayer(namepart) for i, player in ipairs(getElementsByType("player")) do local name = getPlayerName(player) if string.find(name:lower(), namepart:lower(), 1, true) then return player, name end end return false end function bounty(source, command, stat, amount) local player, playerName = findPlayer(stat) if player then local test = tonumber(amount) local cash = getElementData(source,"cash") if cash > test then if test >= 10000 then setElementData (source,"cash",cash - test,true) outputChatBox(getPla[size=85][/size]yerName(source).." Put Bounty On "..getPlayerName(player).."("..test.."$)",getRootElement(),255,255,0,true) end end end end addCommandHandler("bounty", bounty) -- kills_s addEvent("onPlayerFinishDD") addEventHandler("onPlayerFinishDD", root, function(pRank) triggerClientEvent(source, "getPlayerKiller", resourceRoot) end) addEvent("onClientPostKiller", true) addEventHandler("onClientPostKiller", resourceRoot, function(pKiller) if (source ~= resourceRoot) then return end local clientName = getPlayerName(client) if ((pKiller) and (getElementType(pKiller) == "player")) then local killerName = getPlayerName(pKiller) outputChatBox(killerName.." has rekt "..clientName) else outputChatBox(clientName.." has died by his own! NOOB!") end end) --- kills_c local pKiller = nil addEventHandler("onClientVehicleCollision", root, function(hitElement) if (source == getPedOccupiedVehicle(localPlayer)) then if (getElementType(hitElement) == "vehicle") then local hitPlayer = getVehicleOccupant(hitElement) if ((hitPlayer) and (getElementType(hitPlayer) == "player")) then pKiller = hitPlayer setTimer(function() pKiller = nil end, 5000,1) end end end end) addEvent("getPlayerKiller", true) addEventHandler("getPlayerKiller", resourceRoot, function() if (source ~= resourceRoot) then return end triggerServerEvent("onClientPostKiller", resourceRoot, pKiller) end) I want the killer of the guy which has bounty on him to get the money
-
Thanks at least I understand how to do it now Would be nice if someone can provide an example with dxDraaImage too
-
Well today I wanted to start to make a userpanel with dx so I wanted to make the panel appear in the same postion on all resolutions I know that I need to use guiGetScreenSize() but idk how to make the calculation after it I mean I want to create a panel using an image and make it open with animation I hope someone can understand me
-
I didn't check all the code but in the 2nd line You should make the db first ? It should be executeSQLQuery("CREATE TABLE IF NOT EXISTS bla bla ) Not sure if what I said is right tho
-
Same! That guy doesn't know anything about scripting and he got such a resource I wonder how
-
So you scripted the buttons already if yes then Use this triggerServerEvent triggerClientEvent
-
So you want to change levels to ur current acl groups? Or the opposite????
-
well so i wanted to make a bounty system what is that supposed to do in race game mode (DD) i want to put a bounty on player ex: /bounty planyername amount(cash) when i do this it sets a bounty with amount of cash on player then whoever kills him takes the cash so the point is idk how to do it i tried to think of alot of things but my mind is always blank so i just want to know what use since idk how to do it
-
well i tried to do that but it didn't work so i decided to use triggering any idea how to do that ? never mind it worked
-
well this example will need you to write a command everytime can i use a timer idk if its possible since i haven't used a one before
-
well it worked and it loaded the dms and wins and cash and ratio but the problem is that it doesn't update meaning now i have 13 dms and 5 wins i won next round > so /st 14dms and 6 wins but the panel still 13 dms and 5 wins any solutions
-
Client addEventHandler("onClientResourceStart", resourceRoot, function ( ) triggerServerEvent ("onGetPlayerRaceStats", resourceRoot) end ) addEvent("onGotRaceStats", true ) addEventHandler("onGotRaceStats", root, function (wins, dms ) guiSetText( GUIEditor.label[1], "Maps Played: "..tostring(dms)) guiSetText( GUIEditor.label[2], "Maps Won: "..tostring(wins)) end ) ----Server addEvent("onGetPlayerRaceStats", true ) addEventHandler("onGetPlayerRaceStats", root, function ( ) for _ ,v in pairs ( getElementsByType("player") ) do local wins = getElementData(source,"wins") local dms = getElementData(source,"played") triggerClientEvent (v, "onGotRaceStats", v, wins, dms) end end ) idk what should i do but it works fine with /st as you can see in the picture
-
To destroy the ramp when map ends
-
soo i made a command adds to u ramp on car but i won't it to be destroyed when map ends so there is the code function ramp ( thePlayer, commandName ) if ( thePlayer ) then local ramp = createObject ( 1634, 0, 0, 0, 0, 0, 0 ) attachElements ( ramp, getPedOccupiedVehicle(thePlayer), 0, 1, 0, 0, 0, 180 ) setObjectScale ( ramp, 0.7) if ( ramp ) then outputChatBox ( "Ramp Added", thePlayer ) end end end addCommandHandler ( "ramp", ramp )
-
Well the script is server side only and it works fine if u write /st name
-
function karim() executeSQLCreateTable("Stats", "serial STRING,Wins INT,DMs INT,Name TEXT") outputChatBox("#ffffff Stats Script By #ff8400AirFighter",getRootElement(),255,132,0,true) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), karim) ---------- function findPlayer(namepart) for i, player in ipairs(getElementsByType("player")) do local name = getPlayerName(player) if string.find(name:lower(), namepart:lower(), 1, true) then return player, name end end return false end ---------- function addPlayer() local serial = getPlayerSerial(source) local playername = getPlayerName(source) CheckPlayer = executeSQLSelect ( "Stats", "*", "serial = '" .. serial .. "'" ) CheckPlayer = executeSQLSelect ( "Stats", "serial", "serial = '" .. serial .. "'" ) if ( type( CheckPlayer ) == "table" and #CheckPlayer == 0 ) or not CheckPlayer then setElementData(source,"Wins",1) setElementData(source,"DMs",1) executeSQLInsert ( "Stats", "'"..serial.."','1','1','1'" ) else outputConsole(playername.." An error Has occurred") end end addEventHandler("onPlayerJoin",getRootElement(), addPlayer) ---- function cControl() local serial = getPlayerSerial(source) local Wins = executeSQLSelect ( "Stats", "Wins","serial = '" .. serial .. "'") local DMs = executeSQLSelect ( "Stats", "DMs","serial = '" .. serial .. "'") setElementData(source, "Wins", tonumber(Wins[1]["Wins"])) setElementData(source, "DMs", tonumber(DMs[1]["DMs"])) end addEventHandler( "onPlayerJoin", getRootElement(), cControl) ------ addEventHandler ("onPlayerJoin",getRootElement(), function() local serial = getPlayerSerial(source) executeSQLUpdate ( "Stats", "Name = '"..string.gsub(getPlayerName (source),"#%x%x%x%x%x%x","").."'","serial = '" .. serial .. "'") end) addEventHandler ("onPlayerChangeNick",getRootElement(), function(olnick,newnick) local serial = getPlayerSerial(source) executeSQLUpdate ( "Stats", "Name = '"..string.gsub(newnick,"#%x%x%x%x%x%x","").."'","serial = '" .. serial .. "'") end) ----------- addEventHandler ( "onResourceStart", getRootElement(), function() for k,v in ipairs(getElementsByType ( "player" )) do local serial = getPlayerSerial(v) local Wins = executeSQLSelect ( "Stats", "Wins","serial = '" .. serial .. "'") setElementData(v, "Wins", tonumber(Wins[1]["Wins"])) end end) addEventHandler ( "onResourceStart", getRootElement(), function() for k,v in ipairs(getElementsByType ( "player" )) do local serial = getPlayerSerial(v) local DMs = executeSQLSelect ( "Stats", "DMs","serial = '" .. serial .. "'") setElementData(v, "DMs", tonumber(DMs[1]["DMs"])) end end) -------- function countingDMs() local players = getElementsByType("player") for k,v in ipairs(players) do local serial = getPlayerSerial(v) local DMs = executeSQLSelect ( "Stats", "DMs","serial = '" .. serial .. "'") DMs = tonumber(DMs[1]["DMs"]) + 1 setElementData(v, "DMs", DMs) executeSQLUpdate ( "Stats", "DMs = '"..DMs.."'","serial = '" .. serial .. "'") end end addEventHandler( "onMapStarting", getRootElement(), countingDMs ) ----- addEvent("onPlayerDestructionDerbyWin",true) addEventHandler("onPlayerDestructionDerbyWin",getRootElement(), function (winner) local serial = getPlayerSerial(winner) local Wins = executeSQLSelect ( "Stats", "Wins","serial = '" .. serial .. "'") Wins = tonumber(Wins[1]["Wins"]) + 1 setElementData(winner, "Wins", Wins) executeSQLUpdate ( "Stats", "Wins = '"..Wins.."'","serial = '" .. serial .. "'") outputChatBox("#ffffff"..string.gsub(getPlayerName (winner),"#%x%x%x%x%x%x","").." #ff8400Has Won This Map And Got ",getRootElement(),255,132,0,true) end) -------- function stats(source, command, stat) local player, playerName = findPlayer(stat) if player then local win = getElementData(player,"Wins") local karim12 = getElementData(player,"DMs") outputChatBox(" #ffffff"..string.gsub(getPlayerName (player),"#%x%x%x%x%x%x","").. ":#ff8400 DMs:#ffffff " ..karim12.. " - #ff8400Wins:#ffffff " ..win.. " -#ff8400 Ratio:#ffffff %"..string.format("%.3f", win / karim12)*(100),getRootElement(),255,132,0,true) end end addCommandHandler("st", stats) addCommandHandler("sts", stats) addCommandHandler("stats", stats) ------- function stats(source) local serial = getPlayerSerial(source) executeSQLUpdate ( "Stats", "Dms = '1'","serial = '" .. serial .. "'") executeSQLUpdate ( "Stats", "Wins = '1'","serial = '" .. serial .. "'") setElementData(source,"Wins",1) setElementData(source,"DMs",1) outputChatBox("#ffffffStats got reseted",source,255,255,255,true) end addCommandHandler("resetst", stats)
-
Bump
-
Well so I made a stats script and it works fine but I want to add a panel to it when you open it u find dms and wins and ratio I know how to make the panel by gui but how to make the rest :< as I said the stats works fine already help a noob people Sad