Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. You can use this functions for dx drawing function dxDrawRelativeRectangle( posX, posY, width, height,color,postGUI ) local resolutionX = 1280 local resolutionY = 1024 local sWidth,sHeight = guiGetScreenSize( ) return dxDrawRectangle( ( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( width/resolutionX )*sWidth, ( height/resolutionY )*sHeight, color, postGUI ) end function dxDrawRelativeText( text,posX,posY,right,bottom,color,scale,mixed_font,alignX,alignY,clip,wordBreak,postGUI ) local resolutionX = 1280 local resolutionY = 1024 local sWidth,sHeight = guiGetScreenSize( ) return dxDrawText( tostring(text), ( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( right/resolutionX )*sWidth, ( bottom/resolutionY)*sHeight, color,( sWidth/resolutionX )*scale, mixed_font, alignX, alignY, clip, wordBreak, postGUI ) end function dxDrawRelativeImage( posX, posY, width, height, mixed,rotation,rotationCenterOffsetX,rotationCenterOffsetY,color,postGUI ) local resolutionX = 1280 local resolutionY = 1024 local sWidth,sHeight = guiGetScreenSize( ) return dxDrawImage ( ( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( width/resolutionX )*sWidth, ( height/resolutionY )*sHeight, mixed, rotation, rotationCenterOffsetX, rotationCenterOffsetY, color, postGUI ) end
  2. Kenix

    Need help here...

    function earnMoney( ) local position = getAliveRacePlayers( ) local acc = getPlayerAccount( source ) if not getElementData( source, "state" ) == "dead" then if not isGuestAccount( acc ) then if type( count ) == 'number' then if not position <= 0 then if getPlayerCount( ) >= count then local pAlive = getAliveRacePlayers( ) local pDead = getDeadRacePlayers( ) local maxCash = 21*( pAlive + pDead ) -- Total cash available to earn. local portion = 0 local finalCash = 0 if not position == 1 then portion = math.ceil( maxCash/( pAlive+pDead-1 ) ) -- The amount to multiply by the number of dead players to later return the money value. finalCash = math.ceil( portion*( pDead ) ) -- Calculate the final money value. else finalCash = maxCash end local playerCash = getAccountData( acc,"Cash" ) or 0 outputChatBox("#FFFFFF>> #ff8600You have recieved $" .. tostring( finalCash ) .. "!",source,255,255,255,true) setAccountData( acc,"Cash", tostring( playerCash ) + finalCash ) outputDebugString( "Final cash for player "..getPlayerName( source )..": "..tostring( finalCash ) ) else outputChatBox( "#FFFFFF>> #ff0000Need atleast " .. tostring( count ).. " players to affect the stats!", source, 255, 255, 255, true) return end scoreboardRefresh( source ) end else outputChatBox( 'count variable is not number' ) end end end end addEventHandler( "onPlayerWasted", root, earnMoney ) /debugscript 3 use pls.
  3. https://wiki.multitheftauto.com/wiki/GuiGetScreenSize read it.
  4. Kenix

    Simple help

    GanJaRuleZ,Your code incorrect.
  5. Kenix

    Simple help

    Client side addCommandHandler ( "skin", function( ) outputChatBox ( "Tavo skin id: " ..tostring( getElementModel( localPlayer ) ) ) end ) Use /debugscript 3.
  6. yes local marker = createMarker( 0,0,0 ) local obj = createObject( 1337,0,0,0 ) addCommandHandler( 'detect', function( ) if isElementWithinMarker( obj,marker ) then outputChatBox ( 'object in marker' ) end end )
  7. Orange,Your project OpenBase will thrive. In contrast to the Aspect.( no offense Mate_ )
  8. Server local tTimer addEventHandler( 'onResourceStart',resourceRoot, function( ) if isTimer( tTimer ) then killTimer( tTimer ) end tTimer = setTimer( function( ) triggerClientEvent( 'updateSoundPosition',root ) end, 1000, 0 ) end ) Client addEvent( 'updateSoundPosition',true ) -- Miniatures local url = "http://electroradio.ch/stream.m3u" local px, py, pz = 1296, -1411, 14 local volume = 1.0 local distance = 70 local model = 495 addEventHandler( "onClientResourceStart", resourceRoot, function( ) vehicle = createVehicle( tonumber( model ), tonumber( px ), tonumber( py ), tonumber( pz ) ) setVehicleColor( vehicle, 126, 126, 0, 0 ) setVehicleLocked( vehicle, true ) setVehicleDoorsUndamageable( vehicle, false ) setVehicleDamageProof( vehicle, true ) setElementRotation( vehicle, 0, 0, 90 ) setElementFrozen( vehicle, true ) setElementAlpha( vehicle, 0 ) -- Stream Configuration sound = playSound3D( tostring( url ), tonumber( px ), tonumber( py ), tonumber( pz ), false ) setSoundVolume( sound, tonumber( volume ) ) setSoundMaxDistance( sound, tonumber( distance ) ) end ) addEventHandler( 'updateSoundPosition',root, function( ) if sound then local x,y,z = getElementPosition( vehicle ) setElementPosition( source,x,y,z ) end end ) addCommandHandler("electro", function(cmd) local x, y, z = getElementPosition(localPlayer) setElementPosition(vehicle, x, y, z + 5) end ) addCommandHandler("attachelectro", function(cmd) attachElements(vehicle, localPlayer, 0, 0, 5) end ) addCommandHandler("detachelectro", function(cmd) detachElements(vehicle, localPlayer) end )
  9. In mta bug tracker have issue about this.
  10. Try local vehicle2 = createVehicle( 495, 1296, -1411, 14 ) setVehicleColor( vehicle2, 126, 126, 0, 0 ) setVehicleLocked( vehicle2, true ) setVehicleDoorsUndamageable( vehicle2, false ) setVehicleDamageProof( vehicle2, true ) setElementFrozen( vehicle2, true ) setElementAlpha( vehicle2, 0 ) r2 = playSound3D("http://electroradio.ch/stream.m3u", x,y ,z, false) setSoundVolume( r2, 1.0 ) setSoundMaxDistance( r2, 70 ) setTimer( function( ) local x,y,z = getElementPosition( vehicle2 ) setElementPosition( r2,x,y,z ) end, 100, 0 ) function warpinelectro( ) local x, y, z = getElementPosition(localPlayer) setElementPosition(vehicle2, x, y, z + 5) end addCommandHandler("electro", warpinelectro) function attachelectro( ) attachElements(vehicle2, localPlayer, 0, 0, 5) end addCommandHandler("attachelectro", attachelectro) function detachelectro( ) detachElements( vehicle2 ) end --/electro - teleports the vehicle to you --/attachelectro - attaches the vehicle to you --/detachelectro - detaches the vehicle from you addCommandHandler( "detachelectro", detachelectro ) Code updated. It should work.
  11. function refreshAll( ) local memotext1 = xmlFindChild( memotextxml, "memo1text", 0 ) local memotext2 = xmlFindChild( memotextxml, "memo2text", 0 ) local memotext3 = xmlFindChild( memotextxml, "memo3text", 0 ) local memotext4 = xmlFindChild( memotextxml, "memo4text", 0 ) local text1 = xmlNodeGetAttribute( memotext1, "text" ) local text2 = xmlNodeGetAttribute( memotext2, "text" ) local text3 = xmlNodeGetAttribute( memotext3, "text" ) local text4 = xmlNodeGetAttribute( memotext4, "text" ) local account = getPlayerAccount ( source ) if isGuestAccount ( account ) then outputChatBox("#990000You must login to use this function!", source, 255, 0, 0, true) else local accName = getAccountName ( account ) if isObjectInACLGroup ( "user."..accName, aclGetGroup ( "Admin" ) ) then setTimer( function( ) triggerClientEvent ( "setMemo1Text", root, text1 ) end, 1000 , 1 ) setTimer( function( ) triggerClientEvent ( "setMemo2Text", root, text2 ) end, 1500 , 1 ) setTimer( function( ) triggerClientEvent ( "setMemo3Text", root, text3 ) end, 2000 , 1 ) setTimer( function( ) triggerClientEvent ( "setMemo4Text", root, text4 ) end, 3000 , 1 ) setTimer( function( ) outputChatBox ( "#FF9912Memo's succesfully updated.", root, 255, 255, 255, true ) xmlSaveFile( memotextxml ) outputChatBox ( "#FF9912Memo's succesfully saved.", root, 255, 255, 255, true ) end,4000, 1 ) else outputChatBox( "#990000Just admins can use this function!", source, 99, 0, 0, true ) end end end addEvent( "refreshRights", true ) addEventHandler( "refreshRights", root, refreshAll ) P.S You can tabulate code?
  12. I not understand what you mean. Explain better. Try function enterVehicle ( vehicle, seat, jacked ) --when a player enters a vehicle local occupants = getVehicleOccupants( vehicle ) -- Get all vehicle occupants local seats = getVehicleMaxPassengers( vehicle ) -- Get the amount of passenger seats for seat = 0, seats do local occupant = occupants[ seat ] if occupant and getElementType( occupant ) == "player" then -- If the seat is occupied by a player... outputConsole("Seat "..tostring( seat )..": "..getPlayerName( occupant ),source ) -- Print who's in the seat else warpPedIntoVehicle ( source, vehicle, seat ) end end end addEventHandler ( "onPlayerVehicleEnter", root, enterVehicle )
  13. For 3d labels you can use: dxDrawText getScreenFromWorldPosition getDistanceBetweenPoints3D And update it in onClientRender.
  14. Kenix

    wierd error

    Try with runcode /srun createVehicle( 411,0,0,0 )
  15. Kenix

    Nitro colour.

    https://community.multitheftauto.com/index.php?p= ... ls&id=3119
  16. Через exports или call Код .. ресурса. addCommandHandler( "set_style", function( source,_,num ) exports['cw_hud']:setPedFightingStyle ( source, tonumber( num ) ) end ) Ладно 3 раз ещё раз напишу. addCommandHandler( "set_style", function( source,_,num ) exports['cw_hud']:setPedFightingStyle ( source, tonumber( num ) ) end ) При вызове этой функции ( setPedFightingStyle) будет срабатывать событие , которое сделает игроку дату , которое ты ввёл в команде set_style . Ну и естественно в твоём худе будет виден стиль борьбы. Так что замени: function getPlayerFightStyle ( thePlayer, commandName ) local playerstyle = getPlayerFightingStyle ( thePlayer ) -- store the fighting style in a variable outputChatBox ( tostring(playerstyle), thePlayer ) -- output it to the player end addCommandHandler ( "style", getPlayerFightStyle ) На это: addCommandHandler( "set_style", function( source,_,num ) exports['cw_hud']:setPedFightingStyle ( source, tonumber( num ) ) end ) В том то и дело , что статью ты не читал.
  17. Ты клиентские функции юзаешь на сервере и серверные на клиенте ... Прочти эту тему
  18. First:you need use setElementData or triggerClientEvent/ triggerServerEvent or https://wiki.multitheftauto.com/wiki/CallClientFunction or https://wiki.multitheftauto.com/wiki/CallServerFunction . Second. do local a = 100 do local g = 5 local s = g outputChatBox( '--> '..tostring( g ) ) --> 5 outputChatBox( '--> '..tostring( s ) ) --> 5 local n = 6 local a = 101 outputChatBox( '--> '..tostring( a ) ) --> 101 end outputChatBox( '--> '..tostring( a ) ) -- > 100 outputChatBox( '--> '..tostring( n ) ) --> nil end http://www.lua.org/manual/5.1/manual.html#2.6 You mean it?
  19. https://wiki.multitheftauto.com/wiki/Set ... ting_names We get setting current resource.
  20. Server side. addEvent( "onVehColorChange",true ) addEvent( "onMapStarting",true ) function setTheCarColors( ) for i, car in ipairs( getElementsByType( "vehicle" ) ) do local theplayer = getVehicleOccupant( car ) if isElement( theplayer ) then local nowteam = getPlayerTeam( theplayer ) local endteam = getTeamFromName( "END#" ) if nowteam == endteam then setVehicleColor( car, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) end end end end addEventHandler( "onVehColorChange",root,setTheCarColors ) function timer( ) --Delay it a bit to allow players to warp in their vehicle... setTimer( setTheCarColors,500,0 ) end addEventHandler("onMapStarting",root,timer ) addCommandHandler ( "set_vehicle_color", setTheCarColors )
×
×
  • Create New...