Jump to content

sckatchof

Members
  • Posts

    394
  • Joined

  • Last visited

Posts posted by sckatchof

  1. CreateColid is a local variable in OnresourceOpen function in a loop. So, if( source == CreateColid) in OnPlayerOnColHit will never be true.

    thnx , how can i fix it :(

  2. i work for turf system but i have some problem when i enter to turf zone output don't work !

    part of server side :

      
    ... 
    .. 
    .. 
    function OnresourceOpen (player) 
    local ColSize = 10.0 
      for ID in pairs(Turfids) do  
         local fX, fY, fZ = Turfids[ID][1], Turfids[ID][2], Turfids[ID][3] 
         local CreateColid = createColCuboid ( fX, fY, fZ, ColSize, ColSize, ColSize ) 
           if CreateColid then 
            addEventHandler("onColShapeHit", CreateColid, OnPlayerOnColHit) 
    end 
    end 
    end 
    addEventHandler("onResourceStart", resourceRoot, OnresourceOpen) 
      
      
     function OnPlayerOnColHit (player)  
          local money = math.random(2580, 4950) 
              if( source == CreateColid ) then 
             if getElementData( player, "YouAreTurfing") then  
             outputChatBox("You already Turfing.",player,255,0,0)  
             return  
             end 
           outputChatBox("balblabla", player, 0,255,255) 
            setElementData(player,"YouAreTurfing",true) 
            triggerClientEvent (player,"tn:Turfing",getRootElement()) 
             setRadarAreaFlashing ( pArea, true ) 
              TurfTimers[ player ] = setTimer(  
             function() 
             ..... 
             .. 
             .. 
            end, 300000, 1 ) 
    end 
    end      
      
    

  3. hello guys ,

    why this script don't work ?

    local xmlFile = nil 
    local xmlNode = nil 
    local yearday, hour 
      
    function openFile( ) 
        local time = getRealTime( ) 
        yearday = time.yearday 
        hour = time.hour 
        local fileName = ( "TNSlogs/%04d-%02d-%02d/%02d.html" ):format( time.year + 1900, time.month + 1, time.monthday, time.hour ) 
          xmlFile = xmlLoadFile( fileName ) 
           if not xmlFile then 
            xmlFile = xmlCreateFile( fileName, "html" ) 
            local head = xmlCreateChild( xmlFile, "head" ) 
            local title = xmlCreateChild( head, "title" ) 
            xmlNodeSetValue( title, ( "TNS MTA :: Client Logs :: %04d-%02d-%02d" ):format( time.year + 1900, time.month + 1, time.monthday ) ) 
             
            local style = xmlCreateChild( head, "style" ) 
            xmlNodeSetAttribute( style, "type", "text/css" ) 
            xmlNodeSetValue( style, "body { font-family: Tahoma; font-size: 0.8em; background: #000000; }  p { padding: 0; margin: 0; } .v1 { color: #AAAAAA; } .v2 { color: #DDDDDD; } .v3 { white-space:pre; }" ) 
             
            xmlNode = xmlCreateChild( xmlFile, "body" ) 
            xmlSaveFile( xmlFile ) 
        else 
            xmlNode = xmlFindChild( xmlFile, "body", 0 ) 
        end 
    end 
      
    addEventHandler( "onClientResourceStart", getResourceRootElement( ), 
        function( ) 
            openFile( ) 
        end 
    ) 
    

  4. hello my friends i have a problem in some panels

    i have make police computer and medic ... New admin panel they work just when their is in-pair player in my server like 1 player or 3 or 5 it work but when there is pair player my panels don't work i don't understand the problem where ?!

  5. addEventHandler ( 'onClientPlayerWasted', localPlayer, -- Instead of "root" we use "localPlayer" which is the player who died. 
        function ( ) 
            dxshow = true 
            if isTimer( DxTime ) then 
                killTimer( DxTime ) 
            end     
            DxTime = setTimer( 
                function( ) 
                    dxshow = false 
                end, 
            1000, 
            1 ) 
        end 
    )   
    

    Read comment.

    thank you snake :D

  6. triggerClientEvent(source, "StartIntro", source) 
    

    thnx for help and this when any player die dxD show to all players :

    addEventHandler( 'onClientPlayerWasted', root, 
        function( ) 
            dxshow = true 
            if isTimer( DxTime ) then 
                killTimer( DxTime ) 
            end     
            DxTime = setTimer( 
                function( ) 
                    dxshow = false 
                end, 
            1000, 
            1 ) 
        end 
    )   
    

  7. hi guys i have problem when any Player joi server my intro script show for all players !

    this is part of script :

    server :

    function OnPlayerjoinserver()    
        showPlayerHudComponent ( source, "clock", false ) 
        showPlayerHudComponent ( source, "radar", false ) 
        showChat ( source, false ) 
        triggerClientEvent("StartIntro", source) 
     end 
    addEventHandler ( "onPlayerJoin", getRootElement(), OnPlayerjoinserver) 
    

  8. Check what return this line
    local nHouse = guiGetText ( housenumber ); 
    

    Omg thnx kenix i forget something it's not "housenumer" it's" "LabelHouseNumber" and now when i buy the house it work but pickup don't change and owner on gui don't change .

  9. client :

      elseif (source == ButtonBuyHouse) then 
        local housenumber = guiGetText (tonumber(housenumber)) 
        triggerServerEvent ("HouseSystemBuyHouse",localPlayer,housenumber) 
    

    server side :

    addEvent("HouseSystemBuyHouse",true) 
    addEventHandler ("HouseSystemBuyHouse", getRootElement(), 
    function(housenumber) 
      local root = xmlLoadFile ("homes.xml") 
      local houseHeadRootNode = xmlFindChild (root,"houses",0) 
      local houseRootNode = xmlFindChild (houseHeadRootNode,"house",tonumber(housenumber))   
      local price = xmlNodeGetAttribute (houseRootNode,"cost") 
      local owner = xmlNodeGetAttribute (houseRootNode,"owner") 
      if not (isGuestAccount (getPlayerAccount(source))) then 
        if (owner == "") and (getPlayerMoney (source) >= tonumber(price)) then 
          takePlayerMoney (source,tonumber(price)) 
          xmlNodeSetAttribute (houseRootNode,"owner",getAccountName(getPlayerAccount(source))) 
          outputChatBox ("Congratulations, you are the new owner!",source,255,0,0,false) 
          outputChatBox ("Price: ".. tostring(price) .. "$!",source,255,0,0,false) 
          for i,v in ipairs ( getElementsByType("pickup")) do 
                local number = getElementData ( v, "housenumber" ) 
                if ( number == housenumber ) then 
                setPickupType ( v, 3, 1272 ) 
                end 
                end 
          xmlSaveFile (root) 
        elseif not (owner == "") then 
          outputChatBox ("This house is already Bought!",source,255,0,0,false) 
        elseif (getPlayerMoney (source) < tonumber(price)) then 
          outputChatBox ("Sorry, you are too poor!",source,255,0,0,false) 
        end 
      end 
      xmlUnloadFile (root)   
    end 
    ) 
    

  10. Show how you trigger the event.

    you mean that

      if (source == ButtonBuyHouse) then 
        local housenumber = guiGetText (LabelHouseNumber) 
        triggerServerEvent ("HouseSystemBuyHouse",localPlayer,housenumber) 
    end 
    

  11. hello my friends i have post this problem again cause nobody can help me , my problem when i buy a house it output outputChatBox ("You have buy this house ...) and Nothing it change in xml file and owner stay blank and pick up don't change to 1273 .

    Server side :

    addEvent("HouseSystemBuyHouse",true) 
    addEventHandler ("HouseSystemBuyHouse", getRootElement(), 
    function(housenumber) 
      local root = xmlLoadFile ("homes.xml") 
      local houseHeadRootNode = xmlFindChild (root,"houses",0) 
      local houseRootNode = xmlFindChild (houseHeadRootNode,"house",tonumber(housenumber))   
      local price = xmlNodeGetAttribute (houseRootNode,"cost") 
      local owner = xmlNodeGetAttribute (houseRootNode,"owner") 
      if not (isGuestAccount (getPlayerAccount(source))) then 
        if (owner == "") and (getPlayerMoney (source) >= tonumber(price)) then 
          takePlayerMoney (source,tonumber(price)) 
          xmlNodeSetAttribute (houseRootNode,"owner",getAccountName(getPlayerAccount(source))) 
          outputChatBox ("You have buy this house for : ".. tostring(price) .. "$",source,255,255,255,false) 
             for i,v in ipairs ( getElementsByType("pickup")) do 
                local number = getElementData ( v, "housenumber" ) 
                if ( number == housenumber ) then 
                setPickupType ( v, 3, 1273 ) 
                end 
                end 
            xmlSaveFile (root) 
        elseif not (owner == "") then 
          outputChatBox ("This house is already Bought!",source,255,0,0,false) 
        elseif (getPlayerMoney (source) < tonumber(price)) then 
          outputChatBox ("You don't have enough money.",source,255,0,0,false) 
        end 
      end 
      triggerClientEvent (source,"hideHouseGuiWindow",source) 
      xmlUnloadFile (root)   
    end) 
    

  12. Error in this line

    elseif ( fOwner ~= '' and getPlayerMoney ( source ) >= tonumber ( fPrice ) ) then 
    

    and wornig in this lines

                local fPrice    = xmlNodeGetValue ( fHouse, 'cost' ); 
                local fOwner    = xmlNodeGetValue ( fHouse, 'owner' ); 
    

    line 1and 2 and lien 14
              local fPrice    = xmlNodeGetValue ( fHouse, 'cost' ); 
                local fOwner    = xmlNodeGetValue ( fHouse, 'owner' ); 
                if ( not isGuestAccount ( getPlayerAccount ( source ) ) ) then 
                    if ( fOwner == '' and getPlayerMoney ( source ) >= tonumber ( fPrice ) ) then 
                        takePlayerMoney ( source, tonumber ( fPrice ) ); 
                        xmlNodeSetValue ( xmlFindChild ( fHouse, 'owner', 0 ), getAccountName ( getPlayerAccount ( source ) ) ); 
                        outputChatBox ( 'You have bought this house for: $' .. price, source, 255, 255, 255, false ); 
                        for _, cPickup in ipairs ( getElementsByType 'pickup' ) do 
                            if ( getElementData ( cPickup, 'housenumber' ) == nHouse ) then -- check element data 'housenumber' 
                                setPickupType ( v, 3, 1273 ); 
                            end 
                        end 
                        xmlSaveFile ( fRoot ) 
                    elseif ( fOwner ~= '' and getPlayerMoney ( source ) >= tonumber ( fPrice ) ) then 
    

  13. outputChatBox ( type ( nHouse ) .. ' - ' .. nHouse ); 
    

    DraKen i realy don't understand i want when i click buy house it save my account name in xml file and pick up change that what i want and thnx for help again

×
×
  • Create New...