1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Sign up for news, events and more!

    You're currently visiting the official DarkRP Forums as a guest. Sign up now to participate in our community and we'll let you know when we have news.

Script doesn't work, 0 errors.

Discussion in 'DarkRP Modding Questions & Help' started by Lechu x rice defender, Sep 10, 2018.

  1. Hello, could someone check why this isn't working? This is my first script for darkrp and I don't have any good idea what I broke.
    This is whole init file from my Entity. --> https://pastebin.com/nE4vVwdK
    I think I could mess up with DarkRP.


    Code (Text):
    AddCSLuaFile( "cl_init.lua" )
    AddCSLuaFile( "shared.lua" )
    include("shared.lua")
    osadzeni_restricted = {
        "TEAM_OSADZONY",
        "TEAM_OSADZONY1",
        "TEAM_OSADZONY2",
        "TEAM_OSADZONY3",
        "TEAM_OSADZONY4",
        "TEAM_OSADZONY5",
    }
    function ENT:Initialize()
        self:SetModel("models/props_vehicles/car001a_hatchback.mdl")
        self:PhysicsInit( SOLID_VPHYSICS )
        self:SetMoveType( MOVETYPE_VPHYSICS )
        self:SetSolid( SOLID_VPHYSICS )      
           local phys = self:GetPhysicsObject()
        if phys:IsValid() then
            phys:Wake()
        end
    end
    function ENT:Use(ply, caller)
       local random = math.random(1,2)
       local ids = ply:Team()
       local praca = team.GetName(ids)
        if random == 1 and table.HasValue(osadzeni_restricted,ids) and (ply:GetPData( "przebranie", 0 )==0) then
                ply:changeTeam("TEAM_REBEL", false, false)
                ply:SetPData( "przebranie", 1 )
            else
                ply:changeTeam("TEAM_CYWIL", false, false)
                ply:SetPData( "przebranie", 1 )
        end
    end
    function ENT:Think()
    end
    hook.Add("PlayerDeath",wywalka,function()
        if (ply:GetPData( "przebranie", 0 )==1) then
            ply:SetPData( "przebranie", 0 )
        end
    end )
    thanks for any reply

    My entity is gmod diresction\lua\entites
     
    Last edited: Sep 10, 2018
  2. Sir Klutch

    Sir Klutch Active Member

    Oof, id love to help you. However, pastebin seems to be under-going some maintenance.
     
  3. Added code, I forgot that is option to add code in spoiler.
     
  4. Pab14567

    Pab14567 Well-Known Member

    Don't put it in the gmod/lua entities, I believe that is the wrong place to put it, ( I'm probably wrong ), just drop it into addons. Also is that table being called anywhere else in other files ,
    Code (Lua):
    osadzeni_restricted = {
        "TEAM_OSADZONY",
        "TEAM_OSADZONY1",
        "TEAM_OSADZONY2",
        "TEAM_OSADZONY3",
        "TEAM_OSADZONY4",
        "TEAM_OSADZONY5",
    }
    Also a simple way to test to see if files loaded just make it print a console message saying the file loaded, or addon.
     
  5. Well, you didn't help me at all. But i made few edits in my code, and this jeju.PNG praca1check and praca2chck returns nill, no idea why.

    Everything works but im wondering how to get name from ply:getJobTable(), if anyone could help me I would be really happy!
     
    Last edited: Sep 14, 2018

Share This Page