Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. RainyLawyer,So it working? Problem solved?
  2. Kenix

    Stats System

    You have 'end' in line 29.
  3. Kenix

    Stats System

    viewtopic.php?f=91&t=40807 ?
  4. local sText = '' local uTimer 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 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 fDraw( quitReason ) sText = sText..string.format( '#FFFFFFServer: #FFFFFF%s has %s the server %s \n', getPlayerName( source ), eventName == 'onClientPlayerQuit' and 'left' or eventName == 'onClientPlayerJoin' and 'join', eventName == 'onClientPlayerQuit' and '(' .. quitReason .. ')' or '' ) if isTimer( uTimer ) then killTimer( uTimer ) end uTimer = setTimer( function( ) sText = '' end, 5000, 1 ) end addEventHandler( 'onClientRender', root, function( ) if sText ~= '' then dxDrawRelativeText( sText,388.0,134.0,558.0,163.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) dxDrawRelativeRectangle( 631.0,7.0,160.0,20.0,tocolor( 0,0,0,150 ),false ) end end ) addEventHandler ( 'onClientPlayerQuit', root, fDraw ) addEventHandler ( 'onClientPlayerJoin', root, fDraw ) Updated. Because you not have this functions in code Learn lua please! viewtopic.php?f=91&t=40809
  5. Kenix

    dxDrawText

    addEvent( 'new', true ) addEvent( "yanas", true ) local sMessage = '' function fStart( sText ) sMessage = sText end function fDraw( ) if sMessage ~= '' then dxDrawText ( "Admin :", 17.0, 189.0, 61.0, 206.0, tocolor( 255,0,0,255 ), 1.0, "default-bold", "left", "top", false, false, false ) dxDrawText ( sMessage, 61.0, 189.0, 264.0, 226.0, tocolor( 255,225,225,255 ), 1.0, "default-bold", "left", "top", false, false, false ) end end function fNa( msgmsg ) outputChatBox( msgmsg,255,0,0,true ) end bindKey( "u", "down", "chatbox","AM" ) addEventHandler( 'new', root, fStart ) addEventHandler( 'onClientRender', root, fDraw ) addEventHandler( "yanas", root, fNa ) Because you use 9 argument in function dxDrawText 'top', but it argument not exists.
  6. local sText = '' local uTimer function fDraw( quitReason ) sText = sText..string.format( '#FFFFFFServer: #FFFFFF%s has %s the server %s \n', getPlayerName( source ), eventName == 'onClientPlayerQuit' and 'left' or eventName == 'onClientPlayerJoin' and 'join', eventName == 'onClientPlayerQuit' and '(' .. quitReason .. ')' or '' ) if isTimer( uTimer ) then killTimer( uTimer ) end uTimer = setTimer( function( ) sText = '' end, 5000, 1 ) end addEventHandler( 'onClientRender', root, function( ) if sText ~= '' then dxDrawText( sText,388.0,134.0,558.0,163.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) dxDrawRectangle( 631.0,7.0,160.0,20.0,tocolor( 0,0,0,150 ),false ) end end ) addEventHandler ( 'onClientPlayerQuit', root, fDraw ) addEventHandler ( 'onClientPlayerJoin', root, fDraw ) My bad. I forgot add argument quitReason to function fDraw. It should work.
  7. Kenix

    dxDrawText

    Show meta.xml Please use /debugscript 3. Read this too please viewtopic.php?f=91&t=40807
  8. Very easy local sText = '' local uTimer function fDraw( ) sText = sText..string.format( '#FFFFFFServer: #FFFFFF%s has %s the server %s \n', getPlayerName( source ), eventName == 'onClientPlayerQuit' and 'left' or eventName == 'onClientPlayerJoin' and 'join', eventName == 'onClientPlayerQuit' and '(' .. quitReason .. ')' or '' ) if isTimer( uTimer ) then killTimer( uTimer ) end uTimer = setTimer( function( ) sText = '' end, 5000, 1 ) end addEventHandler( 'onClientRender', root, function( ) if sText ~= '' then dxDrawText( sText,388.0,134.0,558.0,163.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) dxDrawRectangle( 631.0,7.0,160.0,20.0,tocolor( 0,0,0,150 ),false ) end end ) addEventHandler ( 'onClientPlayerQuit', root, fDraw ) addEventHandler ( 'onClientPlayerJoin', root, fDraw ) Updated. eventName is predefined variable.
  9. Yes, because you change it. sText = sText..string.format( '#FFFFFFServer: #FFFFFF%s has left the server (%s) \n',getPlayerName( source ), quitReason ) Example: print( string.format( "I am %s. I going %s",'Kenix','finish my votemanager.' ) ) Output: I am Kenix. I going finish my votemanager. You use Example print( string.format( "I am %s, going %s",'Kenix' ) ) Output: bad argument #3 to 'format' (no value) Because you not use 2 regular expression. Read it please ! viewtopic.php?f=91&t=40809
  10. Kenix

    dxDrawText

    Client addEvent( 'new', true ) addEvent( "yanas", true ) local sMessage = '' function fStart( sText ) sMessage = sText end function fDraw( ) if sMessage ~= '' then dxDrawText( "Admin :",17.0,189.0,61.0,206.0,tocolor( 255,0,0,255 ),1.0,"default-bold","top","left",false,false,false ) dxDrawText( sMessage,61.0,189.0,264.0,226.0,tocolor( 255,255,255,255 ),1.0,"default-bold","top","left",false,false,false ) end end function fNa( msgmsg ) outputChatBox( msgmsg,255,0,0,true ) end bindKey( "u", "down", "chatbox","AM" ) addEventHandler( 'new', root, fStart ) addEventHandler( 'onClientRender', root, fDraw ) addEventHandler( "yanas", root, fNa )
  11. Upload resource with my code.I test it.
  12. Just use my function. 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 The arguments are the same as in dxDrawText.
  13. Use my code Which one you posted two & what's the difference between those two? This.
  14. local uTimers = { } function changeTheSkin( source ) local playerAccount = getPlayerAccount( source ) if playerAccount and not isGuestAccount( playerAccount ) then for i = 0,17 do local arg1,arg2 = getPedClothes( source, i ) setAccountData( playerAccount, "player.clothes."..tostring( i ),tostring( arg1 )..","..tostring( arg2 ) ) end setAccountData( playerAccount, "player.skin", getElementModel( source ) ) outputChatBox("#FF0000*INFO: #0095FFYour skin was successfully saved!", source, 0, 255, 0, true) end end function fLogout ( uLastAccount ) local playerAccount = uLastAccount and type( uLastAccount ) == "userdata" and uLastAccount or getPlayerAccount( source ) if playerAccount and not isGuestAccount( playerAccount ) then local playerMoney = getPlayerMoney( source ) --local nSkin = getElementModel( source ) setAccountData( playerAccount, "player.money", playerMoney ) --setAccountData( playerAccount, "player.skin", nSkin ) for i = 1,12 do setAccountData ( playerAccount, "player.weaponID" .. tostring( i ), getPedWeapon ( source, i ) ) setAccountData ( playerAccount, "player.weaponAmmo" .. tostring( i ), getPedTotalAmmo ( source, i ) ) end end uTimers[ source ] = nil end addEventHandler( 'onPlayerLogout', root, fLogout ) addEventHandler( 'onPlayerQuit', root, fLogout ) addCommandHandler( "skinsave", changeTheSkin ) addEventHandler( "onPlayerWasted", root, function( ) local playerAccount = getPlayerAccount( source ) if playerAccount and not isGuestAccount( playerAccount ) then local playerSkin = getAccountData( playerAccount, "player.skin" ) if playerSkin then spawnPlayer( 2155, -99, 3, 0, math.random( 0, 258 ),tonumber( playerSkin ) ) else spawnPlayer( 2155, -99, 3, 0, math.random( 0, 258 ) ) end end end ) addEventHandler( 'onPlayerSpawn', root, function( ) local playerAccount = getPlayerAccount( source ) if playerAccount and not isGuestAccount( playerAccount ) then if isTimer( uTimers[ source ] ) then killTimer( uTimers[ source ] ) end uTimers[ source ] = setTimer( function( source, playerAccount ) for i = 1,12 do local nWeapon = getAccountData ( playerAccount, "player.weaponID" ..tostring( i ) ) local nAmmo = getAccountData ( playerAccount, "player.weaponAmmo" ..tostring( i ) ) giveWeapon( source, tonumber( nWeapon ), tonumber( nAmmo ), tonumber ( nWeapon ) == 1 ) end end, 1000, 1, source, playerAccount ) end end ) addEventHandler( "onPlayerLogin", root, function( ) local playerAccount = getPlayerAccount( source ) if playerAccount then for i = 1,12 do local nWeapon = getAccountData ( playerAccount, "player.weaponID" ..tostring( i ) ) local nAmmo = getAccountData ( playerAccount, "player.weaponAmmo" ..tostring( i ) ) giveWeapon( source, tonumber( nWeapon ), tonumber( nAmmo ), tonumber ( nWeapon ) == 1 ) end local playerMoney = getAccountData( playerAccount, "player.money" ) setPlayerMoney( source, playerMoney ) local playerSkin = getAccountData( playerAccount, "player.skin" ) if playerSkin then setElementModel( source, playerSkin ) for i = 0,17 do local acc = getAccountData( playerAccount, 'player.clothes.'..i ) if not acc:find 'false' then addPedClothes( source,acc:sub( 1,acc:find( ',' ) - 1 ),acc:sub( acc:find( ',' ) + 1,acc:len( ) ),i ) end end end end end ) Yeah, because it not write in code. Maybe, you yourself create it in next time? P.S It's not good ask members of the forum, they wrote for you. You need write yourself.
  15. local sText = '' local uTimer addEventHandler ( 'onClientPlayerQuit', root, function( quitReason ) sText = sText..string.format( '#FFFFFFServer: #FFFFFF%s has left the server (%s) \n',getPlayerName( source ), quitReason ) if isTimer( uTimer ) then killTimer( uTimer ) end uTimer = setTimer( function( ) sText = '' end, 5000, 1 ) end ) addEventHandler( 'onClientRender', root, function( ) if sText ~= '' then dxDrawText( sText,388.0,134.0,558.0,163.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) dxDrawRectangle( 631.0,7.0,160.0,20.0,tocolor( 0,0,0,150 ),false ) end end ) Example output: Server: Kenix has left the server (Timed out) Server: Draken has left the server (Quit) Server: RainyLawyer has left the server (Quit) Nope string.format easy understand P.S 2000 post
  16. local sText, sReason = '','' local uTimer addEventHandler ( 'onClientPlayerQuit', root, function( quitReason ) sText, sReason = getPlayerName( source ), quitReason if isTimer( uTimer ) then killTimer( uTimer ) end uTimer = setTimer( function( ) sText = '' end, 5000, 1 ) end ) addEventHandler( 'onClientRender', root, function( ) if sText ~= '' then dxDrawText( '#FFFFFFServer: #FFFFFF'.. sText .. ' has left the server (' .. sReason .. ')',388.0,134.0,558.0,163.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) dxDrawRectangle( 631.0,7.0,160.0,20.0,tocolor( 0,0,0,150 ),false ) end end ) And why you not update text in render?
  17. Why you use it in event? local root = getRootElement() local rootChildren = getElementChildren( root ) root is predefined variable. viewtopic.php?f=91&t=39678 getRootElement is root
  18. Vehicle mods: https://community.multitheftauto.com/index.php?p= ... ls&id=3932 skins mods: https://community.multitheftauto.com/index.php?p= ... ls&id=3927 https://community.multitheftauto.com/index.php?p= ... ls&id=3928
  19. Learn viewtopic.php?f=91&t=40809 https://wiki.multitheftauto.com/wiki/Scr ... troduction
  20. You want create if player quit or join draw it? Use: https://wiki.multitheftauto.com/wiki/OnClientPlayerJoin https://wiki.multitheftauto.com/wiki/OnClientPlayerQuit
×
×
  • Create New...