1. Post #81
    Gold Banana
    Banana Lord.'s Avatar
    May 2010
    6,852 Posts
    objPl:PrintMessage( HUD_PRINTCENTER, "message here" );

    that only works server-side
    Reply With Quote Edit / Delete Windows 7 United States Show Events Lua Helper Lua Helper x 1 (list)

  2. Post #82

    May 2011
    74 Posts
    self.lblTeam:SetText( ****** )
    I need to get player rank in scorboard, so what to use?

    Tested:
    self.lblTeam:SetText( self:EV_GetRank() )
    self.lblTeam:SetText( pl:EV_GetRank() )
    Reply With Quote Edit / Delete Windows XP Lithuania Show Events

  3. Post #83
    Gold Banana
    Banana Lord.'s Avatar
    May 2010
    6,852 Posts
    that's how you do it afaik, is there an error or something
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  4. Post #84

    May 2011
    74 Posts
    [sui_scoreboard\player_row.lua:129] attempt to index global 'pl' (a nil value)
    Code:
    self.lblTeam:SetText( pl:EV_GetRank() )
    It just can't get the rank, and i dont know whay.

    sui_scoreboard\player_row.lua:129] attempt to call method 'EV_GetRank' (a nil value)
    Code:
    self.lblTeam:SetText( self:EV_GetRank() )
    Reply With Quote Edit / Delete Windows XP Lithuania Show Events

  5. Post #85
    Gold Banana
    Banana Lord.'s Avatar
    May 2010
    6,852 Posts
    isn't it self.Player instead of pl?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  6. Post #86

    May 2011
    74 Posts
    self.Player:EV_GetRank()
    Worked with no errors, testing now. Thanks.
    ---------------------------------------------
    Updated:
    Working
    ---------------------------------------------
    Updated:
    Now i need code to get rank color.
    Reply With Quote Edit / Delete Windows XP Lithuania Show Events Friendly Friendly x 1 (list)

  7. Post #87
    Fight for justice, fight for Manning and Snowden.
    Persious's Avatar
    April 2010
    2,597 Posts
    Is SuspectID an INT or a VARCHAR? If you're converting ID to a number I don't see why SuspectID would be a TEXT or VARCHAR. Remove the ' '.
    Oh, I see. ID is a int.
    Reply With Quote Edit / Delete Windows 7 Faroe Islands Show Events

  8. Post #88
    Gold Banana
    Banana Lord.'s Avatar
    May 2010
    6,852 Posts
    self.Player:EV_GetRank()
    Worked with no errors, testing now. Thanks.
    ---------------------------------------------
    Updated:
    Working
    ---------------------------------------------
    Updated:
    Now i need code to get rank color.
    does Evolve have that feature?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  9. Post #89

    May 2011
    74 Posts
    Yes, there is nick colors, i need code to get it
    Reply With Quote Edit / Delete Windows XP Lithuania Show Events

  10. Post #90
    Gold Banana
    Banana Lord.'s Avatar
    May 2010
    6,852 Posts
    evolve.ranks[self.Player:EV_GetRank( )].Color || color_white
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  11. Post #91
    Robots FTW
    SiPlus's Avatar
    December 2011
    888 Posts
    G.PrintMessage with HUD_PRINTCENTER on server to broadcast, Player.PrintMessage on both client and server to print only to single user.
    Reply With Quote Edit / Delete Windows 8 Russian Federation Show Events Late Late x 2 (list)

  12. Post #92
    Fight for justice, fight for Manning and Snowden.
    Persious's Avatar
    April 2010
    2,597 Posts
    Still doesn't work

    
    local Crime 	= args[1]
    local Stage 	= args[2]
    local ID 	= args[3]
    
    print("Crime: " .. Crime .. "\nStage: " .. Stage .. "\nID: " .. ID)
    
    sql.Query("UPDATE Wanted SET Crime = '" .. Crime .. "', '" .. Stage .. "' WHERE SuspectID = " .. tonumber(ID) .. "")
    
    Reply With Quote Edit / Delete Windows 7 Faroe Islands Show Events

  13. Post #93
    diaoyudao shi ZHONGGUO de
    Disseminate's Avatar
    December 2007
    4,094 Posts
    "UPDATE Wanted SET Crime = 'CrimeVal', 'StageVal' WHERE SuspectID = id"

    That's the query you're sending
    Reply With Quote Edit / Delete Windows 7 Canada Show Events

  14. Post #94
    Fight for justice, fight for Manning and Snowden.
    Persious's Avatar
    April 2010
    2,597 Posts
    I'm new to this SQL stuff, and have no clue what I'm doing wrong. I've been trying a lot, and sadly I don't know what you're trying to point out :/

    Edited:

    Oh wait, I see what I did wrong.

    Edited:

    Hm, that didn't even work.

    sql.Query("UPDATE Wanted SET Crime = '" .. Crime .. "', Stage = '" .. Stage .. "' WHERE SuspectID = " .. tonumber(ID) .. "")
    

    Edited:

    Stebbzor told me to use print(sql.LastError()) and it gave me this

    near "s": syntax error
    Reply With Quote Edit / Delete Windows 7 Faroe Islands Show Events

  15. Post #95
    Gold Member
    marvincmarvin's Avatar
    January 2011
    796 Posts
    I'm new to this SQL stuff, and have no clue what I'm doing wrong. I've been trying a lot, and sadly I don't know what you're trying to point out :/

    Edited:

    Oh wait, I see what I did wrong.

    Edited:

    Hm, that didn't even work.

    sql.Query("UPDATE Wanted SET Crime = '" .. Crime .. "', Stage = '" .. Stage .. "' WHERE SuspectID = " .. tonumber(ID) .. "")
    

    Edited:

    Stebbzor told me to use print(sql.LastError()) and it gave me this

    near "s": syntax error
    The hint was you weren't using quotes for the id.

    Edited:

    I guess I was wrong..
    Reply With Quote Edit / Delete Windows 7 United States Show Events Disagree Disagree x 3 (list)

  16. Post #96
    Fight for justice, fight for Manning and Snowden.
    Persious's Avatar
    April 2010
    2,597 Posts
    Did I have to? As the ID is a int?
    Reply With Quote Edit / Delete Windows 7 Faroe Islands Show Events

  17. Post #97
    Ask me about my ex-boyfriend being raided by the FBI
    Nerdeboy's Avatar
    August 2009
    1,862 Posts
    No, you don't. Assuming ID is defined somewhere.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  18. Post #98
    Fight for justice, fight for Manning and Snowden.
    Persious's Avatar
    April 2010
    2,597 Posts
    Yeah, ID is defined as argument 3, which definetly gets recieved.

    Edited:

    Might it be because the "Crime" and "Stage" have spaces?
    Reply With Quote Edit / Delete Windows 7 Faroe Islands Show Events

  19. Post #99
    MoronYard
    _nonSENSE's Avatar
    May 2010
    1,266 Posts
    I'm new to this SQL stuff, and have no clue what I'm doing wrong. I've been trying a lot, and sadly I don't know what you're trying to point out :/

    Edited:

    Oh wait, I see what I did wrong.

    Edited:

    Hm, that didn't even work.

    sql.Query("UPDATE Wanted SET Crime = '" .. Crime .. "', Stage = '" .. Stage .. "' WHERE SuspectID = " .. tonumber(ID) .. "")
    

    Edited:

    Stebbzor told me to use print(sql.LastError()) and it gave me this

    near "s": syntax error
    Did you escape your strings? An unescaped string with a quote can mess up your query (along with leaving you vulnerable to sql injection).
    Reply With Quote Edit / Delete Windows 7 Germany Show Events

  20. Post #100
    Gold Member
    mil0001's Avatar
    January 2010
    485 Posts
    Some kind of detection for an entity to detect if another entity is within x radius to it.
    Reply With Quote Edit / Delete Windows 7 Australia Show Events

  21. Post #101
    Fight for justice, fight for Manning and Snowden.
    Persious's Avatar
    April 2010
    2,597 Posts
    Did you escape your strings? An unescaped string with a quote can mess up your query (along with leaving you vulnerable to sql injection).
    Could you explain more about escaping a string? I don't think I did that.
    Reply With Quote Edit / Delete Windows 7 Faroe Islands Show Events

  22. Post #102
    PROUD BRONY 4LYFE
    Drakehawke's Avatar
    February 2009
    3,312 Posts
    Could you explain more about escaping a string? I don't think I did that.
    sql.Query("UPDATE Wanted SET Crime = '" .. sql.SQLStr( Crime ) .. "', Stage = '" .. sql.SQLStr( Stage ) .. "' WHERE SuspectID = " .. tonumber(ID) .. "")
    Reply With Quote Edit / Delete Windows Vista United Kingdom Show Events

  23. Post #103
    Fight for justice, fight for Manning and Snowden.
    Persious's Avatar
    April 2010
    2,597 Posts
    Okay, still haven't tested it as I'm going to sleep. But if I updated it, and got it back to the DTextEntry, wouldn't it show up as "Some random text here" (With the quotes)
    Reply With Quote Edit / Delete Windows 7 Faroe Islands Show Events

  24. Post #104
    Vend's Avatar
    January 2012
    12 Posts
    If you are using sql.SQLStr you don not need a '.
    sql.Query("UPDATE Wanted SET Crime = " .. sql.SQLStr( Crime ) .. ", Stage = " .. sql.SQLStr( Stage ) .. " WHERE SuspectID = " .. tonumber(ID) .. ")
    This will work.
    Reply With Quote Edit / Delete Windows 7 Russian Federation Show Events Agree Agree x 1 (list)

  25. Post #105
    JustSoFaded's Avatar
    December 2011
    432 Posts
    Some kind of detection for an entity to detect if another entity is within x radius to it.
    local function IsInRadius( ent )
    	local cDist = math.huge;
    	local cTarg = nil;
    
    	if( ValidEntity( ent ) && ent != LocalPlayer() ) then
    		if( (LocalPlayer():GetPos() - ent:GetPos()):Length() < cDist ) then
    			cDist = (LocalPlayer():GetPos() - ent:GetPos()):Length();
    			cTarg = ent;
    		end
    	end
    
    	return {cDist, cTarg};
    end
    
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  26. Post #106
    Ask me about my ex-boyfriend being raided by the FBI
    Nerdeboy's Avatar
    August 2009
    1,862 Posts
    Some kind of detection for an entity to detect if another entity is within x radius to it.
    Ents.FindInSphere
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 1 (list)

  27. Post #107
    Fight for justice, fight for Manning and Snowden.
    Persious's Avatar
    April 2010
    2,597 Posts
    Uh, this is getting confusing. Now, for a odd reason, everything turns nil when I use print(sql.LastError())
    Reply With Quote Edit / Delete Windows 7 Faroe Islands Show Events

  28. Post #108
    MoronYard
    _nonSENSE's Avatar
    May 2010
    1,266 Posts
    Print the query. You should have done this in the first place. If there are no obvious errors in the query, then we can go from there and check what else could be wrong.
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Agree Agree x 2 (list)

  29. Post #109
    Gold Member
    xomskaa's Avatar
    February 2012
    142 Posts
    Hello, I am currently running AppleJack Cider gamemode, and I have quite the predicament..the doors will not lock

    if anyone has a solution please post it, can't seem to figure it out

    Even the doors on the DoorsToolv2 won't lock, except the lab elevator door
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  30. Post #110
    Please waste more of your money changing this title again.
    Gmod4ever's Avatar
    August 2005
    6,837 Posts
    Not really explicitly Lua-related, but, I'll ask here for lack of anywhere else to ask.

    If I recall correctly, the env_fire entity can no longer be resized with the SetKeyValue control (it doesn't register the changes), meaning that I need a Lua fire entity to take its place.

    Does anyone happen to have a fire entity I can utilize? I'm not that great with sprite/effect design, and would prefer not having to make one if I don't have to. All I really need is the actual effect - the functionality I can do myself.

    If not, that's okay, too. I'd just prefer this, if it's possible.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  31. Post #111
    NnyAskC's Avatar
    April 2006
    101 Posts
    I'm getting a "[lua\test.lua:25] attempt to index global 'SWEP' (a nil value)" error from this block. Can anyone figure out wtf I'm doing wrong other than the obvious everything?

    function SWEP:PrimaryAttack()            <---------- Line 25
    
        if !self:CanPrimaryAttack() then
    	    return
    	end
        
    	local eyetrace = self.Owner:GetEyeTrace();
     
        if !eyetrace.Entity:IsPlayer() then
    	    return
    	end
     
        local distx = eyetrace.Entity:GetPos().x - self.Owner:GetPos().x
        local disty = eyetrace.Entity:GetPos().y - self.Owner:GetPos().y
        local distz = eyetrace.Entity:GetPos().z - self.Owner:GetPos().z
    
        local distLong = (distx*distx)+(disty*disty)+(distz*distz)
        local dist = math.sqrt(distLong)
    
        if dist > 200 then
            self.Owner:PrintMessage(HUD_PRINTCENTER, "Too Far Away!")
            return
    	end
     
        if eyetrace.Entity:IsPlayer() then
    	    self.Weapon:EmitSound("Weapon_StunStick.Activate")
            self:tasePlayer(eyetrace.Entity)
            SetGlobalInt("mReloadTimer",CurTime()+10)
            SetGlobalInt("tazedTimer",CurTime()+3)
        end
     
    end
    
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  32. Post #112
    Moderator
    Ninja101's Avatar
    December 2008
    740 Posts
    I'm getting a "[lua\test.lua:25] attempt to index global 'SWEP' (a nil value)" error from this block. Can anyone figure out wtf I'm doing wrong other than the obvious everything?

    function SWEP:PrimaryAttack()            <---------- Line 25
    
        if !self:CanPrimaryAttack() then
    	    return
    	end
        
    	local eyetrace = self.Owner:GetEyeTrace();
     
        if !eyetrace.Entity:IsPlayer() then
    	    return
    	end
     
        local distx = eyetrace.Entity:GetPos().x - self.Owner:GetPos().x
        local disty = eyetrace.Entity:GetPos().y - self.Owner:GetPos().y
        local distz = eyetrace.Entity:GetPos().z - self.Owner:GetPos().z
    
        local distLong = (distx*distx)+(disty*disty)+(distz*distz)
        local dist = math.sqrt(distLong)
    
        if dist > 200 then
            self.Owner:PrintMessage(HUD_PRINTCENTER, "Too Far Away!")
            return
    	end
     
        if eyetrace.Entity:IsPlayer() then
    	    self.Weapon:EmitSound("Weapon_StunStick.Activate")
            self:tasePlayer(eyetrace.Entity)
            SetGlobalInt("mReloadTimer",CurTime()+10)
            SetGlobalInt("tazedTimer",CurTime()+3)
        end
     
    end
    
    The Lua file wants to be in lua/weapons/<name>/init.lua
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  33. Post #113
    Fight for justice, fight for Manning and Snowden.
    Persious's Avatar
    April 2010
    2,597 Posts
    Okay, apperantly the only thing that works now is inserting. Deleting and updating does not update after doing so.

    Edited:

    Ah, got it all working now. I have no clue what caused it, but somehow I fixed it.
    Reply With Quote Edit / Delete Windows 7 Faroe Islands Show Events Funny Funny x 1 (list)

  34. Post #114

    May 2011
    74 Posts
    What code gets all props count in server?
    Reply With Quote Edit / Delete Windows XP Lithuania Show Events

  35. Post #115
    pennerlord's Avatar
    February 2011
    504 Posts
    What code gets all props count in server?
    print(#ents.FindByClass("prop_physics"))
    Reply With Quote Edit / Delete Windows 7 Germany Show Events

  36. Post #116
    Gold Member
    Feihc's Avatar
    October 2006
    1,080 Posts
    How would one go about making a color flash from a set color to red and back when the player is low on health? Maybe one blink every second or two. I always have a rough time with transitions like this...
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  37. Post #117
    PROUD BRONY 4LYFE
    Drakehawke's Avatar
    February 2009
    3,312 Posts
    What's a better MySQL module to use? tmysql or mysqloo?
    Reply With Quote Edit / Delete Windows Vista United Kingdom Show Events

  38. Post #118
    Gold Member
    ralle105's Avatar
    October 2005
    4,648 Posts
    local f = 0.5+0.5*math.sin(math.pi*2*CurTime()*BlinksPerSec)
    local color = color1*f+color2*(1-f)
    
    Something along those lines
    Reply With Quote Edit / Delete Windows 7 Sweden Show Events Lua Helper Lua Helper x 1 (list)

  39. Post #119
    WHY WHEN WHY
    Krizzu's Avatar
    June 2011
    176 Posts
    Is there a way to make player invisible? Like only 25% visibility.
    Reply With Quote Edit / Delete Windows 7 Poland Show Events

  40. Post #120
    MoronYard
    _nonSENSE's Avatar
    May 2010
    1,266 Posts
    Find the player entity on the client and use SetColor(255,255,255,25)? (or in beta: SetColor(Color(255,255,255,25)).
    Reply With Quote Edit / Delete Windows 7 Germany Show Events