Jump to content

Dre-+-

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by Dre-+-

  1. function makeleader(thePlayer, command, tempPlayer, frakid) local invPlayer = getPlayerFromName(tempPlayer) local adminPlayer = getElementData(thePlayer, "AdminLevel") if (tempPlayer) and (frakid) then if tonumber(adminPlayer) == 3 then if (tonumber(frakid) > 0) and (tonumber(frakid) <= 12) then outputChatBox("Du hast den Spieler erfolgreich zum Leader gemacht", thePlayer, 0,255,0) outputChatBox("Du wurdest erfolgreich zum Leader gemacht", tempPlayer, 0,255,0) setElementData(tempPlayer, "Fraktion", tonumber(frakid)) setElementData(tempPlayer, "Rank", 5) else outputChatBox("Die Fraktion muss zwischen 0 und 12 liegen", thePlayer,255,0,0) end else outputChatBox("Du bist kein Admin Level 3", thePlayer,255,0,0) end else outputChatBox("Ungultige Eingaben", thePlayer, 255,0,0) end end addCommandHandler("makeleader", makeleader)
  2. Use this: function myCash ( thePlayer ) if not isGuestAccount ( getPlayerAccount ( thePlayer ) ) then account = getPlayerAccount(thePlayer) local cash = getAccountData ( account, "data.cash" ) outputChatBox ( "Your cash is: " .. tostring ( cash ) .. " $ ", thePlayer ) end end addCommandHandler ( "cash", myCash ) function setCash ( sourcePlayer,cmd,givedname,amount) local gived = getPlayerFromName ( givedname ) if not isGuestAccount ( getPlayerAccount ( gived ) ) then account = getPlayerAccount(gived) local getPlayerCash = getAccountData ( account, "data.cash" ) setAccountData ( account, "data.cash", tonumber(getPlayerCash) + tonumber(amount) or 100 ) outputChatBox ( "Your cash has been setted.", gived ) outputChatBox ( "You've setted his cash.", sourcePlayer ) end end addCommandHandler ( "setcash", setCash )
  3. function onShoot ( weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) triggerServerEvent ( "addOneMore",getLocalPlayer(), weapon ) end addEventHandler("onClientPlayerWeaponFire", getLocalPlayer(), onShoot)
  4. Dre-+-

    New hud

    I was glad to help)
  5. This script have alot of errors: Line 362,363: outputChatBox( "Top time"..placeText.." from " .. tostring(row.playerName) .. " deleted by " .. getPlayerName(player), 255,55,00 ) outputServerLog( "INFO: Top time"..placeText.." from " ..tostring(row.playerName).. " (" ..tostring(row.timeText).. " in " ..mapName.. ") deleted by " .. getAdminNameForLog(player) ) Line 388: addEventHandler("onSettingChange", g_ResRoot, Line 399: end) BTW: Full debugged script: -- -- toptimes_server.lua -- SToptimesManager = {} SToptimesManager.__index = SToptimesManager SToptimesManager.instances = {} --------------------------------------------------------------------------- -- Server -- Handle events from Race -- -- This is the 'interface' from Race -- --------------------------------------------------------------------------- addEvent("onMapStarting") addEventHandler("onMapStarting", g_Root, function(mapInfo, mapOptions, gameOptions) if g_SToptimesManager then g_SToptimesManager:setModeAndMap( mapInfo.modename, mapInfo.name, gameOptions.statsKey ) end end ) addEvent( "onPlayerPickUpRacePickup", true ) function onPlayerPickUpRacePickup(pickupID,pickupType,vehicleModel) if pickupType == "vehiclechange" and vehicleModel == 425 then outputChatBox("#0000ff*#ffffff"..getPlayerName(source).." Has got a new Toptime #ff000 Rank: " .. newPos .. " #ff6600 | Time:"..msToTimeStr(newTime)) setTimer(gmoff, 10000, 1) g_SToptimesManager:playerFinished( source, exports.race:getTimePassed()) end end addEventHandler( "onPlayerPickUpRacePickup", getRootElement(), onPlayerPickUpRacePickup) addEvent("onPlayerFinish") addEventHandler("onPlayerFinish", g_Root, function(rank, time) if g_SToptimesManager then g_SToptimesManager:playerFinished( source, time) end end ) addEventHandler("onResourceStop", g_ResRoot, function() if g_SToptimesManager then g_SToptimesManager:unloadingMap() end end ) addEventHandler("onPlayerQuit", g_Root, function() if g_SToptimesManager then g_SToptimesManager:removePlayerFromUpdateList(source) g_SToptimesManager:unqueueUpdate(source) end end ) addEventHandler("onResourceStart", g_ResRoot, function() local raceInfo = getRaceInfo() if raceInfo and g_SToptimesManager then g_SToptimesManager:setModeAndMap( raceInfo.mapInfo.modename, raceInfo.mapInfo.name, raceInfo.gameOptions.statsKey ) end end ) function getRaceInfo() local raceResRoot = getResourceRootElement( getResourceFromName( "race" ) ) return raceResRoot and getElementData( raceResRoot, "info" ) end --------------------------------------------------------------------------- -- -- Events fired from here -- --------------------------------------------------------------------------- addEvent("onPlayerToptimeImprovement") --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- -- SToptimesManager:create() -- -- Create a SToptimesManager instance -- --------------------------------------------------------------------------- function SToptimesManager:create() local id = #SToptimesManager.instances + 1 SToptimesManager.instances[id] = setmetatable( { id = id, playersWhoWantUpdates = {}, updateQueue = {}, serviceQueueTimer = nil, displayTopCount = 12, -- Top number of times to display mapTimes = nil, -- SMaptimes:create() serverRevision = 0, -- To prevent redundant updating to clients }, self ) SToptimesManager.instances[id]:postCreate() return SToptimesManager.instances[id] end --------------------------------------------------------------------------- -- -- SToptimesManager:destroy() -- -- Destroy a SToptimesManager instance -- --------------------------------------------------------------------------- function SToptimesManager:destroy() SToptimesManager.instances[self.id] = nil self.id = 0 end --------------------------------------------------------------------------- -- -- SToptimesManager:postCreate() -- -- -- --------------------------------------------------------------------------- function SToptimesManager:postCreate() cacheSettings() self.displayTopCount = g_Settings.numtimes end --------------------------------------------------------------------------- -- -- SToptimesManager:setModeAndMap() -- -- Called when a new map has been loaded -- --------------------------------------------------------------------------- function SToptimesManager:setModeAndMap( raceModeName, mapName, statsKey ) outputDebug( "TOPTIMES", "SToptimesManager:setModeAndMap " .. raceModeName .. "<>" .. mapName ) -- Reset updatings from the previous map self.playersWhoWantUpdates = {} self.updateQueue = {} if self.serviceQueueTimer then killTimer(self.serviceQueueTimer) end self.serviceQueueTimer = nil -- Remove old map times if self.mapTimes then self.mapTimes:flush() -- Ensure last stuff is saved self.mapTimes:destroy() end -- Get map times for this map self.mapTimes = SMaptimes:create( raceModeName, mapName, statsKey ) self.mapTimes:load() -- Get the toptimes data ready to send self:updateTopText() end --------------------------------------------------------------------------- -- -- SToptimesManager:unloadingMap() -- -- Called when unloading -- --------------------------------------------------------------------------- function SToptimesManager:unloadingMap() if self.mapTimes then self.mapTimes:flush() -- Ensure last stuff is saved end end --------------------------------------------------------------------------- -- -- SToptimesManager:playerFinished() -- -- If time is good enough, insert into database -- --------------------------------------------------------------------------- function SToptimesManager:playerFinished( player, newTime, dateRecorded ) -- Check if top time recording is disabled for this player if getElementData ( player, "toptimes" ) == "off" then return end if not self.mapTimes then outputDebug( "TOPTIMES", "SToptimesManager:playerFinished - self.mapTimes == nil" ) return end dateRecorded = dateRecorded or getRealDateTimeNowString() local oldTime = self.mapTimes:getTimeForPlayer( player ) -- Can be false if no previous time local newPos = self.mapTimes:getPositionForTime( newTime, dateRecorded ) -- See if time is an improvement for this player if not oldTime or newTime < oldTime then local oldPos = self.mapTimes:getIndexForPlayer( player ) triggerEvent("onPlayerToptimeImprovement", player, newPos, newTime, oldPos, oldTime, self.displayTopCount, self.mapTimes:getValidEntryCount() ) -- See if its in the top display if newPos <= self.displayTopCount then outputDebug( "TOPTIMES", getPlayerName(player) .. " got toptime position " .. newPos ) end if oldTime then outputDebug( "TOPTIMES", getPlayerName(player) .. " new personal best " .. newTime .. " " .. oldTime - newTime ) end self.mapTimes:setTimeForPlayer( player, newTime, dateRecorded ) -- updateTopText if database was changed if newPos <= self.displayTopCount then self:updateTopText() end end outputDebug( "TOPTIMES", "++ SToptimesManager:playerFinished " .. tostring(getPlayerName(player)) .. " time:" .. tostring(newTime) ) end --------------------------------------------------------------------------- -- -- SToptimesManager:updateTopText() -- -- Update the toptimes client data for the current map -- --------------------------------------------------------------------------- function SToptimesManager:updateTopText() if not self.mapTimes then return end -- Update data -- Read top rows from map toptimes table and send to all players who want to know self.toptimesDataForMap = self.mapTimes:getToptimes( self.displayTopCount ) self.serverRevision = self.serverRevision +
  6. Dre-+-

    New hud

    UPDATED: If you have 0 armour, then health moved to top, and armour move to bottom)
  7. i like this way: local sWidth,sHeight = guiGetScreenSize() local nW,nH = sWidth/1024,sHeight/768 dxDrawText("LEVEL:",sWidth-270*nW, sHeight-1080/2*nH, sWidth-292*nW, sHeight-2/2*nH,tocolor(255,255,0,255),1.5,"default","left","top",false,false,false)
  8. getPedWeapon(player,slot) For all weapons: function giveAllPedWeaposn(player) local playerWeapons = {} for sl = 0,12 do local weap = getPedWeapon(player,sl) if weap == 0 then else table.insert(playerWeapons,weap) end end return playerWeapons end Its function returns all ped weapons in table
  9. Dre-+-

    New hud

    Thanks for the advice, now clock changed. And about the function, i will be glad to be helpful)
  10. Dre-+-

    New hud

    Most of icons from GTA 4, and the rest i create in Photoshop.
  11. Dre-+-

    New hud

    This script replace old GTA SA hud to new. This resource can handle from Client side and Server side (like a original hud). For this must call showNewHudComponent(component,show) from Client side or showNewServerHudComponent([player],component,show) from Server side. Component names: "armour" - player armour level "clock" - current in-game time "health" - player health level "money" - player money "weapon" - current player weapon and ammo "wanted" - current wanted level "all" - armour,clock,health,money,weapon and wanted. Show: "true",or "false". For example: call(getResourceFromName("new_hud"),"showNewHudComponent","weapon" , "false") If you want move this hud to top change: hudtopposition = 1 to hudtopposition = 0 in hud.lua Download:https://community.multitheftauto.com/index.php?p=resources&s=details&id=1627 BTW: If you found any bugs or you have suggestions post it in MTA Community or here.
×
×
  • Create New...