xbenny2506x

Members
  • Content Count

    98
  • Joined

  • Last visited

Community Reputation

0 Neutral

About xbenny2506x

  • Rank
    Punk-@ss B*tch

Details

  • Gang
    yes
  1. THX now my script work! But a i have a little problem with the health number. Sometimes is see 98.599998474121 or other so long health numbers. How can i make it that is see only numbers so long without the " . "????
  2. HI I have a problem with the guiCreateLabel and getElementHealth. I want that the player see his health. So i have make this script ... local client = getLocalPlayer() local healthtext = guiCreateLabel(0.35,0.40,0.94,0.2, getElementHealth ( client ), true) guiSetFont ( healthtext, "sa-header" ) guiLabelSetColor ( healthtextt, 255, 234, 0 ) ... addEventHandler("onClientPlayerJoin", getRootElement(), fullhealth) But i see nothing! Can me someone say, how i can make it that the player see his health?
  3. I have make this now function vehiclekillboom ( thePlayer ) if (getElementType(thePlayer) == "player") then local vehicle = getPedOccupiedVehicle ( thePlayer ) if getPedOccupiedVehicle ( thePlayer ) then if getVehicleOccupant ( vehicle ) then blowVehicle ( vehicle ) else killPed(thePlayer, thePlayer) end else killPed(thePlayer, thePlayer) end end end addCommandHandler ( "kill", vehiclekillboom ) When someone copy this, and the freeroam gui is on this server make the "kill" command in the freeroam gui off! When the player leave the server the vehicle explode: (serverside!) function quitPlayer () local vehiclequite = getPedOccupiedVehicle ( source ) if getPedOccupiedVehicle ( source ) then if getVehicleOccupant ( vehiclequite ) then blowVehicle ( vehiclequite ) end end end addEventHandler ( "onPlayerQuit", getRootElement(), quitPlayer )
  4. ok i have test now that function vehiclekill ( player ) if getElementType ( player ) == "player" then if getPedOccupiedVehicle ( player ) then local vehicle = getPedOccupiedVehicle ( player ) blowVehicle ( vehicle ) end end end addCommandHandler ( "kill", vehiclekill ) but nothing the vehicle dont explode when the player use /kill
  5. HI! I have a problem with the vehicle respawn. When the player use /kill in the vehicle and when the player leave the server in the vehicle the respawn vehicle not work I have all my vehicles in a .map file. Here is the script: xmlRoot = xmlLoadFile("settings.xml"); explRespawn = tonumber( xmlNodeGetAttribute( xmlFindChild(xmlRoot,"explrespawn",0) ,"value") ); idleRespawn = tonumber( xmlNodeGetAttribute( xmlFindChild(xmlRoot,"idlerespawn",0) ,"value") ); idleTimers = {} -- function respawnVehicle(vehicle) if vehicle == nil then return; end; if getElementType(vehicle) ~= "vehicle" then return; end; sx = getElementData(vehicle,"posX"); sy = getElementData(vehicle,"posY"); sz = getElementData(vehicle,"posZ"); rx = getElementData(vehicle,"rotX"); ry = getElementData(vehicle,"rotY"); rz = getElementData(vehicle,"rotZ"); spawnVehicle ( vehicle,sx, sy, sz, rx, ry, rz ) end function ehVehicleEnter() local tmr = idleTimers[source]; if tmr ~= nil and tmr ~= false then killTimer( tmr ); idleTimers[source] = nil; end end; addEventHandler ( "onVehicleEnter", getRootElement(), ehVehicleEnter ); function ehVehicleExit() idleTimers[source] = setTimer ( respawnVehicle, idleRespawn * 1000, 1, source ); end; addEventHandler ( "onVehicleExit", getRootElement(), ehVehicleExit ); function ehVehicleExplode() setTimer ( respawnVehicle, explRespawn * 1000, 1, source ) end; addEventHandler ( "onVehicleExplode", getRootElement(), ehVehicleExplode ); function ehResStart() vehs = getElementsByType ( "vehicle" ) for key,veh in ipairs(vehs) do ProcessVehicle(veh); end end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), ehResStart ) I hope someone can help me with that 2 problems! THX
  6. Nice work! Now work the Mod Shop in MTA 1.0! BIG THX!!!!!
  7. THX 50p i have seen this last night too. You have right so its easy and my script work now THX
  8. HI! I have add in my Spwan menu the Spawn name as a guiCreateStaticImage. But the problem is when the player Spawn from one point to a other one he see the new and the old Image. Here is my script: Client: function HighJump ( HighJumptext ) if ( HighJumptext ) then destroyElement ( HighJumptext ) end HighJumptext = guiCreateStaticImage(0.22,0.88,0.30,0.08,"menupic/HighJump.png",true) setTimer ( destroyElement, 3000, 1, HighJumptext, source ) end addEvent( "HighJumpasend", true ) addEventHandler( "HighJumpasend", getRootElement(), HighJump ) function WaterJump ( WaterJumptext ) if ( WaterJumptext ) then destroyElement ( WaterJumptext ) end WaterJumptext = guiCreateStaticImage(0.22,0.88,0.30,0.08,"menupic/WaterJump.png",true) setTimer ( destroyElement, 3000, 1, WaterJumptext, source ) end addEvent( "WaterJumpsend", true ) addEventHandler( "WaterJumpsend", getRootElement(), WaterJump ) Server: ... if ( check ) == 999 then triggerClientEvent ( source,"HighJumpasend", getRootElement()) ... if ( check ) == 9999 then triggerClientEvent ( source,"WaterJumpsend", getRootElement()) ... Can somone Help me with that problem? THX
  9. THX for the help and all the infos I have work with 50p idea
  10. I have hope that in the new mta all shop, payandspray... and casinos wokring... but nothing. Ok for the most problems i have found a way, but not for the casinos. Is there any way or a script to and this too?
  11. I update my money atm with that: addEventHandler("onPlayerLogin", getRootElement(), function (player) if player then setElementData(source,"Money",getPlayerMoney(source)) end end ) and when the play join and exit a car. But i want that the money all 10sec make a update.
  12. ok i have test now that for update the money: function updatemoneypl (player) if player then setTimer (setElementData, 5000, 0, source,"Money",getPlayerMoney(source)) -- setElementData(source,"Money",getPlayerMoney(source)) end end addEventHandler ( "onResourceStart", getRootElement(), updatemoneypl ) But nothing no error nothing then i have test that: function updatemoneypl (player) if player then -- setTimer (setElementData, 5000, 0, source,"Money",getPlayerMoney(source)) setElementData(source,"Money",getPlayerMoney(source)) end end setTimer ( updatemoneypl, 5000, 0 ) addEventHandler ( "onResourceStart", getRootElement(), updatemoneypl ) Nothing too Can someone help me plz? THX
  13. Ok, i have seen all my faults lol And i have many faults in the script. THX for the Infos and help! I have fix all errors, now i must make a big beta test with the death - kills - money Save. When i say nothing more here the script work
  14. I have now a other problem, i want save the kills and death. My money save work very good, but the kill and death make me many problems. I have use the script http://forum.multitheftauto.com/viewtop ... 32#p293132 and have change it so that i can save the kills and deaths. But i get a error: ERROR: ...rver/mods/deathmatch/resourcecache/scores/scores.lua:14: attempt to get length of local 'player' (a nil value) ERROR: ...rver/mods/deathmatch/resourcecache/scores/scores.lua:169: attempt to perform arithmetic on a nil value this is my script: New add new db: function dbaddkilldeath () executeSQLCreateTable ( "killdeath", "kill INTEGER, death INTEGER, player TEXT" ) end addCommandHandler ("dbaddkill", dbaddkilldeath) Read db: function onjoindbkill (player) local sourcename = getPlayerName (source) killdatalesen = executeSQLQuery("SELECT kill FROM killdeath WHERE player=?", sourcename) if(#player == 0) then executeSQLInsert ( "killdeath", "'1', '1', '" .. sourcename .. "'" ) else killsplayer = killdatalesen[1].kill deathdatalesen = executeSQLQuery("SELECT death FROM killdeath WHERE player=?", sourcename) deathsplayer = deathdatalesen[1].kill end end addEventHandler ( "onPlayerJoin", getRootElement(), onjoindbkill ) Add data from db in Scoreboard: local function resetScores (element) setScoreData(element, "Kills", killsplayer) setScoreData(element, "Deaths", deathsplayer) setScoreData(element, "Self", deathsplayer) setScoreData(element, "Ratio", "-") setScoreData(element, "Money", 0) local status = "" if isPedDead(element) then status = "Dead" end setScoreData(element, "status", status) end Kill and death Counter: addEventHandler("onPlayerWasted", root, function (ammo, killer, weapon) if killer then if killer ~= source then -- killer killed victim setScoreData(killer, "Kills", getElementData(killer, "Kills") + 1) setScoreData(source, "Deaths", getElementData(source, "Deaths") + 1) if isColumnActive["ratio"] then updateRatio(killer) updateRatio(source) end else -- victim killed himself setScoreData(source, "self", getElementData(source, "self") + 1) end else -- victim died setScoreData(source, "Deaths", getElementData(source, "Deaths") + 1) if isColumnActive["ratio"] then updateRatio(source) end end setScoreData(source, "status", "Dead") end ) Save Data when Player leave: function onquitdbkill () local sourcename = getPlayerName ( source ) enddaths = getElementData(source, "Deaths") endkills = getElementData(source, "Kills") executeSQLUpdate ( "killdeath", "kill = '" .. endkills .. "', death = '" .. endkills .. "'", "player = '" .. sourcename .. "'" ) end addEventHandler ( "onPlayerQuit", getRootElement(), onquitdbkill ) And here are my full script: -- Create a new Data function dbaddkilldeath () executeSQLCreateTable ( "killdeath", "kill INTEGER, death INTEGER, player TEXT" ) end addCommandHandler ("dbaddkill", dbaddkilldeath) -- Read the Data function onjoindbkill (player) local sourcename = getPlayerName (source) killdatalesen = executeSQLQuery("SELECT kill FROM killdeath WHERE player=?", sourcename) if(#player == 0) then executeSQLInsert ( "killdeath", "'1', '1', '" .. sourcename .. "'" ) else killsplayer = killdatalesen[1].kill deathdatalesen = executeSQLQuery("SELECT death FROM killdeath WHERE player=?", sourcename) deathsplayer = deathdatalesen[1].kill end end addEventHandler ( "onPlayerJoin", getRootElement(), onjoindbkill ) local root = getRootElement() local scoresRoot = getResourceRootElement(getThisResource()) local scoreboard = getResourceFromName("scoreboard") local scoreColumns = {"Kills", "Deaths", "Self", "Ratio", "Status", "Money"} local isColumnActive = {} local KDR_DECIMAL_PLACES = 2 --http://lua-users.org/wiki/SimpleRound local function round(num, idp) local mult = 10^(idp or 0) return math.floor(num * mult + 0.5) / mult end local function setScoreData (element, column, data) if isColumnActive[column] then setElementData(element, column, data) end end local function resetScores (element) setScoreData(element, "Kills", killsplayer) setScoreData(element, "Deaths", deathsplayer) setScoreData(element, "Self", deathsplayer) setScoreData(element, "Ratio", "-") setScoreData(element, "Money", 0) local status = "" if isPedDead(element) then status = "Dead" end setScoreData(element, "status", status) end function trans (player) setElementData(player,"Money",tostring(getPlayerMoney(player))) end addEventHandler("onPlayerWasted", getRootElement(), function (player) if player then setElementData(source,"Money",getPlayerMoney(source)) -- Set the player's "Money" data to his current money amount. This will automatically update the scoreboard column end end ) addEventHandler("onPlayerLogin", getRootElement(), function (player) if player then setElementData(source,"Money",getPlayerMoney(source)) -- Set the player's "Money" data to his current money amount. This will automatically update the scoreboard column end end ) addEventHandler("onPlayerVehicleEnter", getRootElement(), function (player) if player then setElementData(source,"Money",getPlayerMoney(source)) -- Set the player's "Money" data to his current money amount. This will automatically update the scoreboard column end end ) addEventHandler("onPlayerVehicleExit", getRootElement(), function (player) if player then setElementData(source,"Money",getPlayerMoney(source)) -- Set the player's "Money" data to his current money amount. This will automatically update the scoreboard column end end ) local function updateRatio (element) local Deaths = getElementData(element, "Deaths") if Deaths == 0 then setScoreData(element, "Ratio", "-") else local kdr = round(getElementData(element, "Kills") / Deaths, KDR_DECIMAL_PLACES) setScoreData(element, "ratio", tostring(kdr)) end end function updateActiveColumns () for i, column in ipairs(scoreColumns) do if get(column) then isColumnActive[column] = true call(scoreboard, "addScoreboardColumn", column) elseif isColumnActive[column] then isColumnActive[column] = false call(scoreboard, "removeScoreboardColumn", column) end end end addEventHandler("onResourceStart", scoresRoot, function () updateActiveColumns() for i, player in ipairs(getElementsByType("player")) do resetScores(player) end end ) addEventHandler("onResourceStop", scoresRoot, function () for i, column in ipairs(scoreColumns) do if isColumnActive[column] then call(scoreboard, "removeScoreboardColumn", column) end end end ) addEventHandler("onPlayerJoin", root, function () resetScores(source) end ) addEventHandler("onPlayerWasted", root, function (ammo, killer, weapon) if killer then if killer ~= source then -- killer killed victim setScoreData(killer, "Kills", getElementData(killer, "Kills") + 1) setScoreData(source, "Deaths", getElementData(source, "Deaths") + 1) if isColumnActive["ratio"] then updateRatio(killer) updateRatio(source) end else -- victim killed himself setScoreData(source, "self", getElementData(source, "self") + 1) end else -- victim died setScoreData(source, "Deaths", getElementData(source, "Deaths") + 1) if isColumnActive["ratio"] then updateRatio(source) end end setScoreData(source, "status", "Dead") end ) addEventHandler("onPlayerSpawn", root, function () setScoreData(source, "status", "") end ) addCommandHandler("score", function (player) if player then for i, column in ipairs(scoreColumns) do if column == "status" then break end if isColumnActive[column] then call(scoreboard, "addScoreboardColumn", column) outputConsole(column .. ": " .. getElementData(player, column), player) end end end end ) -- Data Save after logout function onquitdbkill () local sourcename = getPlayerName ( source ) enddaths = getElementData(source, "Deaths") endkills = getElementData(source, "Kills") executeSQLUpdate ( "killdeath", "kill = '" .. endkills .. "', death = '" .. endkills .. "'", "player = '" .. sourcename .. "'" ) end addEventHandler ( "onPlayerQuit", getRootElement(), onquitdbkill ) I have create a the db that is not the problem, I hope someone can help me there too THX!!!!!!!!!!!