Jump to content

xbenny2506x

Members
  • Posts

    98
  • Joined

  • Last visited

Everything posted by xbenny2506x

  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!!!!!!!!!!!
  15. ok i see it is not so eays But use now: 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 outputChatBox("Datasend work",source,0,255,0) -- Output a message, for pointlessness' sake end end ) The Player money Update when the player is death, its not all the time but for the first time i think its ok, i work on that what 50p have say. But for that i must read a lot in wiki, and test this idea later When somone found a bug, error or something else or i have make something wrong plz say me this THX
  16. I use now the script from mta 1.0 "scores.zip" and i have add some new things but i have problems with add the money. I have test many things but nothing work Can someone say me how i can add the player money? Here is the original script not that what i have use atm, but i must only know how i can add the money... 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", 0) setScoreData(element, "Deaths", 0) setScoreData(element, "Self", 0) setScoreData(element, "Ratio", "-") setScoreData(element, "Money", "0") local status = "" if isPedDead(element) then status = "Dead" end setScoreData(element, "status", status) 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 )
  17. yh its not a so good script But with your help i have fix something and now the script work! THX for the help!!
  18. HI! I have make a script when the ped is death the ped respawn in 5000 ms. But the problem is, when i start the server and come in the server all 5000ms is see a new ped And when i restart the resource "pedfun" the script work! The server create then only one ped and not all 5sec a new one. Can someone help me with that problem!? function pedspawn ( thePlayer ) function pedcreate () ped1 = createPed(56, -2225.376953125, 2333.6584472656, 7.546875) setTimer ( setPedAnimation, 5000, 0, ped1, "ped", "SEAT_idle" ) end setTimer ( pedcreate, 5000, 1 ) function peddestroy ( thePlayer ) if ( isPedDead (ped1) ) then outputChatBox ( "Ped is death", thePlayer ) setTimer ( destroyElement, 5000, 1, ped1) end end addEventHandler("onPedWasted", getRootElement(), peddestroy ) function pednewadeath( thePlayer ) if ( isPedDead (ped1) ) then function pedrespawnafterdeath () ped1 = createPed(56, -2225.376953125, 2333.6584472656, 7.546875) setTimer ( setPedAnimation, 5000, 0, ped1, "ped", "SEAT_idle" ) end setTimer ( pedrespawnafterdeath, 5000, 1 ) outputChatBox ( "Ped Respawn work!", thePlayer ) end end addEventHandler("onPedWasted", getRootElement(), pednewadeath ) end addEventHandler("onResourceStart", getRootElement(), pedspawn )
  19. can i add on a ped a anim too? dance,piss... ?
  20. Hi I have a problem with the Map warp. When a Player is in not in the ElementInterior 0 and warp over the Map back from 1,2,3... to 0 is he not in ElementInterior 0. With setElementInterior and getElementInterior i can fix that i think lol But can me say someone where is the place in the Freeroam GUI (MTA 1.0) script for the warp on the map. THX for the help!
  21. I have this one. I have change many things, but for the start is that good. http://community.mtasa.com/index.php?p= ... ils&id=174
  22. 50p has right! You find here a lot help but you must learn how work a script. I am not the best in making scripts, but the people here help me a lot and i have learn a lot in the last month since i have start the work on my Stunt server. So i can say you read what the people say here and work with that! I have not so much time for help you to add in all "function" the "bindKey" but its easy! You have for "lock" a bindKey in the script: function initCarLocks () -- Initilize Player Element Data local players = getElementsByType ( "player" ) for k,p in ipairs(players) do removeElementData ( p, "cl_ownedvehicle" ) bindKey ( p, "l", "down", doToggleLocked ) -- change with bindKey ( p, "3", "down", doToggleLocked ) end and here too -- player joins function cl_PlayerJoin ( ) bindKey ( source, "l", "down", doToggleLocked ) end addEventHandler ( "onPlayerJoin", getRootElement(), cl_PlayerJoin ) -- change with bindKey ( p, "3", "down", doToggleLocked ) and for the rest you have here the answer addCommandHandler ( "engine", doToggleEngine ) addCommandHandler ( "lights", doToggleLights, false) addCommandHandler ( "lock", doLockVehicle ) addCommandHandler ( "unlock", doUnlockVehicle ) Search the "function" (doToggleEngine...) and add "bindKey" More can i help you not... i have many things to do with my scripts and server.
  23. this map was in mta 1.0 and i have this error with all race maps from mta 1.0
  24. I have now a other problem. When the player die all people see the text "Respawn in 10 Seconds" Here is my script: server: function deathHandler( playerSource ) local zufalldeath = math.random(1, 4) local zufallskin = math.random(7, 288) triggerClientEvent ( "onGreeting", getRootElement()) if (zufalldeath == 1) then local x = -2225.376953125 local y = 2333.6584472656 local z = 7.546875 setTimer ( spawnPlayer, 10000, 1, source, x, y, z) setTimer(setElementModel, 10000, 1, source, zufallskin) setTimer(giveWeapon, 10000, 1, source, 33, 50 ) setTimer(giveWeapon, 10000, 1, source, 31, 50 ) setTimer(giveWeapon, 10000, 1, source, 10 ) end .... end addEventHandler("onPlayerWasted", getRootElement(), deathHandler) client: function specialEventHandler ( spawntext ) if ( spawntext ) then destroyElement ( spawntext ) end local spawntext = guiCreateLabel(0.35,0.40,0.94,0.2,"Respawn in 10 Seconds",true) guiSetFont ( spawntext, "sa-header" ) guiLabelSetColor ( spawntext, 255, 234, 0 ) setTimer ( destroyElement, 10000, 1, spawntext, source ) end addEvent( "onGreeting", true ) addEventHandler( "onGreeting", getRootElement(), specialEventHandler ) I hope someone can say me how i can make it that only the player where die see the respawn text!? THX
×
×
  • Create New...