Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. If you are using the MTA account system, then you can easily make this with setAccountData/getAccountData.
  2. local MimgW,MimgH = dxGetMaterialSize(mapRadar) Remove the "local" infront of it.
  3. Castillo

    Help!!

    That's the problem, post the content of "freeroam/fr_server.lua".
  4. Castillo

    Help!!

    Are you using the "freeroam" script?
  5. That's already possible to do it with the scripting functions.
  6. Castillo

    Toptimes BUG

    Glad you got it working. You're welcome.
  7. What do you mean by "recovering account"?
  8. Castillo

    Toptimes BUG

    There are no other errors?
  9. Castillo

    Toptimes BUG

    local topsFont = dxCreateFont( "font.ttf") -- -- toptimes_client.lua -- Created = {} CToptimes = {} CToptimes.__index = CToptimes CToptimes.instances = {} g_Settings = {} serverInfo = {} px = 0 sX,sY = guiGetScreenSize() toptimes = { anim = 360, size = {380,160}, mapname = "N/A", label = {"","","","","","","","","","",""}, time = {"","","","","","","","","","",""}, data = {"","","","","","","","","","",""}, country = {"","","","","","","","","","",""}, personal = {false,pos = 9,name="",time="",data="",country=""}, state = false, animState = "closed", tick = getTickCount() } function drawToptimesIntreface() if toptimes.animState == "closed" then local tick = getTickCount() - toptimes.tick local progress = tick/1000 toptimes.anim = interpolateBetween(0,0,0,390,0,0,progress,"InOutBack") else local tick = getTickCount() - toptimes.tick local progress = tick/1000 toptimes.anim = interpolateBetween(390,0,0,0,0,0,progress,"OutBounce") end local clanColor = {220,20,60} if toptimes.state then local sX = sX+toptimes.anim dxDrawRectangle(sX-toptimes.size[1]-10,(sY/2)-(toptimes.size[2]),toptimes.size[1],200/8,tocolor(232,31,31,200)) dxDrawText(toptimes.mapname,sX-toptimes.size[1]-10,(sY/2)-(toptimes.size[2]),sX-10,(sY/2)-(toptimes.size[2])+(200/8),tocolor(255,255,255,255),1,topsFont,"center","center",true) dxDrawRectangle(sX-toptimes.size[1]-10,(sY/2)-(toptimes.size[2])+(200/8),toptimes.size[1],toptimes.size[2],tocolor(15,15,15,150)) for i=1,8 do dxDrawText(i..") "..toptimes.label[i],sX-toptimes.size[1]+(toptimes.size[1]*0.03)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i-1)*20),sX-(toptimes.size[1]*0.1)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i)*20),tocolor(255,255,255,255),1,topsFont,"left","center",true,false,false,true) dxDrawText(toptimes.time[i],sX-toptimes.size[1]+(toptimes.size[1]*0.52)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i-1)*20),sX-(toptimes.size[1]*0.1)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i)*20),tocolor(255,255,255,255),1,topsFont,"left","center",true,false,false,true) dxDrawText(toptimes.data[i],sX-toptimes.size[1]+(toptimes.size[1]*0.75)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i-1)*20),sX-(toptimes.size[1]*0.1)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i)*20),tocolor(255,255,255,255),1,topsFont,"left","center",true,false,false,true) if toptimes.country[i] ~= "" then if fileExists(":admin/client/images/flags/"..toptimes.country[i]..".png") then dxDrawImage(sX-toptimes.size[1]+(toptimes.size[1]*0.93)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i-1)*20)+3,16,11,":admin/client/images/flags/"..toptimes.country[i]..".png",tocolor(255,255,255,255)) end end end if toptimes.personal[1] then dxDrawRectangle(sX-toptimes.size[1]-10,(sY/2)+(200/8),toptimes.size[1],30,tocolor(15,15,15,150)) dxDrawLine(sX-toptimes.size[1],(sY/2)+(200/8),sX-20,(sY/2)+(200/8),tocolor(141,182,205,255)) dxDrawText("#8DB6CD"..toptimes.personal.pos..") #FFFFFF "..toptimes.personal.name,sX-toptimes.size[1]+(toptimes.size[1]*0.03)-10,(sY/2)+(200/8),sX-(toptimes.size[1]*0.1)-10,(sY/2)+(200/8)+30,tocolor(255,255,255,255),1,topsFont,"left","center",true,false,false,true) dxDrawText(toptimes.personal.time,sX-toptimes.size[1]+(toptimes.size[1]*0.52)-10,(sY/2)+(200/8),sX-(toptimes.size[1]*0.1)-10,(sY/2)+(200/8)+30,tocolor(255,255,255,255),1,topsFont,"left","center",true,false,false,true) dxDrawText(toptimes.personal.data,sX-toptimes.size[1]+(toptimes.size[1]*0.75)-10,(sY/2)+(200/8),sX-(toptimes.size[1]*0.1)-10,(sY/2)+(200/8)+30,tocolor(255,255,255,255),1,topsFont,"left","center",true,false,false,true) if toptimes.personal.country ~= "" then if fileExists(":admin/client/images/flags/"..toptimes.personal.country..".png") then dxDrawImage(sX-toptimes.size[1]+(toptimes.size[1]*0.93)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i-1)*20)+3,16,11,":admin/client/images/flags/"..toptimes.personal.country..".png",tocolor(255,255,255,255)) end end end end end addEventHandler("onClientRender",getRootElement(),drawToptimesIntreface) function toggleToptimes() if toptimes.animState == "open" then closeToptimes() else openToptimes() end end bindKey("F5","down",toggleToptimes) function openToptimes() if toptimes.state and toptimes.animState == "closed" then toptimes.tick = getTickCount() toptimes.animState = "open" end end function closeToptimes() if toptimes.state and toptimes.animState == "open" then toptimes.tick = getTickCount() toptimes.animState = "closed" end end --------------------------------------------------------------------------- -- Client -- Handle events from Race -- -- This is the 'interface' from Race -- --------------------------------------------------------------------------- addEventHandler('onClientResourceStart', g_ResRoot, function() triggerServerEvent('onLoadedAtClient_tt', g_Me) topTimePersonalLabel = false chatBlock = false end ) addEvent('onClientMapStarting', true) addEventHandler('onClientMapStarting', getRootElement(), function(mapinfo) outputDebug( 'TOPTIMES', 'onClientMapStarting' ) if g_CToptimes then g_CToptimes:onMapStarting(mapinfo) chatBlock = false end end ) addEvent('onClientMapStopping', true) addEventHandler('onClientMapStopping', getRootElement(), function() outputDebug( 'TOPTIMES', 'onClientMapStopping' ) if g_CToptimes then g_CToptimes:onMapStopping() end end ) addEvent('onClientPlayerFinish', true) addEventHandler('onClientPlayerFinish', getRootElement(), function() outputDebug( 'TOPTIMES', 'onClientPlayerFinish' ) if g_CToptimes then openToptimes() setTimer(closeToptimes,5000,1) end end ) addEvent('onClientSetMapName', true) addEventHandler('onClientSetMapName', getRootElement(), function(manName) if g_CToptimes then g_CToptimes:setWindowTitle(manName) end end ) function updateSettings(settings, playeradmin) end --------------------------------------------------------------------------- -- -- CToptimes:create() -- -- -- --------------------------------------------------------------------------- function CToptimes:create() local id = #CToptimes.instances + 1 CToptimes.instances[id] = setmetatable( { id = id, hasTimes = false }, self ) return CToptimes.instances[id] end function CToptimes:setWindowTitle( mapName ) toptimes.mapname = mapName end function string.findIgnoreCase(haystack,needle) return string.find(string.lower(haystack),string.lower(needle),1,true) end function CToptimes:onMapStarting(mapinfo) self:setWindowTitle( mapinfo.name ) self.hasTimes = false -- table.dump(mapinfo) -- if self.startshow then --if mapinfo.name and string.findIgnoreCase(mapinfo.name,"[DM]") then for _,e in pairs(getElementsByType("racepickup") or {}) do local t = getElementData(e,"type") if t and t == "vehiclechange" then local v = getElementData(e,"vehicle") if v and tonumber(v) == 425 then self.hasTimes = true break end end end --end if self.hasTimes then self:doToggleToptimes( true ) openToptimes() setTimer(closeToptimes,5000,1) else self:doToggleToptimes( false ) closeToptimes() end end function CToptimes:onMapStopping() self:setWindowTitle( '' ) closeToptimes() end function CToptimes:doAutoShow() self.bAutoShow = true self:updateShow() end function CToptimes:updateShow(bOn) self:enableToptimeUpdatesFromServer(bOn) end function CToptimes:enableToptimeUpdatesFromServer( bOn ) triggerServerEvent('onClientRequestToptimesUpdates', g_Me, bOn, self.clientRevision ) end function CToptimes:doOnServerSentToptimes( data, serverRevision, playerPosition ) toptimes.personal[1] = false for i=1,8 do toptimes.label[i] = data[i].playerName local timeText = data[i].timeText if timeText:sub(1,1) == '0' then timeText = ' ' .. timeText:sub(2) end toptimes.time[i] = timeText toptimes.data[i] = string.sub(tostring(data[i].dateRecorded),1,10) toptimes.country[i] = data[i].country
  10. if username:find ( "#%x%x%x%x%x%x" ) then outputChatBox ( "You can't use HEX codes in the account name.", player, 255, 0, 0 ) return end
  11. Castillo

    Lock this

    Post your groups script.
  12. Castillo

    Lock this

    If you are using tables to store groups, then just store the memo content in the same table.
  13. Castillo

    Lock this

    You want the groups to remain once you restart the resource? because if that's so, you'll need to use either SQL, MySQL or XML.
  14. Castillo

    [NEED HELP]

    You can use this script I made long ago. local playerWeapons = { } addEventHandler ( "onPlayerWasted", root, function ( ) if ( not playerWeapons [ source ] ) then playerWeapons [ source ] = { } end for slot = 0, 12 do local weapon = getPedWeapon ( source, slot ) if ( weapon > 0 ) then local ammo = getPedTotalAmmo ( source, slot ) if ( ammo > 0 ) then playerWeapons [ source ] [ weapon ] = ammo end end end end ) addEventHandler ( "onPlayerSpawn", root, function ( ) if ( playerWeapons [ source ] ) then for weapon, ammo in pairs ( playerWeapons [ source ] ) do giveWeapon ( source, tonumber ( weapon ), tonumber ( ammo ) ) end end playerWeapons [ source ] = nil end )
  15. How would that help him? he wants the player to be in that interior.
  16. Castillo

    Toptimes BUG

    Do you get errors in the debugscript? because that may be the problem which is causing the rest not to draw.
  17. And, are you sure the problem is in that code?
  18. Castillo

    [Solved]

    The resource got a function called "getLevelData" which returns: level name, experience required. I believe you can use that to fix your problem.
  19. You didn't copy the end to close the 'if' statement. addEventHandler ( "onClientMarkerHit", resourceRoot, function ( hitElement ) if ( hitElement == localPlayer ) then if ( not getElementData ( source, "isSWATMarker" ) ) then return end -- This
  20. -- server side: for k,swat in ipairs (markersB) do local marker = createMarker(swat[1], swat[2], swat[3], "cylinder", 0.9, 0, 0, 255, 255) setElementData ( marker, "isSWATMarker", true ) createBlip (swat[1], swat[2], swat[3], 58, 2, 255, 0, 0, 255) end -- client side: addEventHandler ( "onClientMarkerHit", resourceRoot, function ( hitElement ) if ( hitElement == localPlayer ) then if ( not getElementData ( source, "isSWATMarker" ) ) then return end
  21. You can either create the markers client side, or you can set a element data value to the markers, and then you can check client side if the marker the player hit has that element data.
×
×
  • Create New...