objPl:PrintMessage( HUD_PRINTCENTER, "message here" );
that only works server-side
objPl:PrintMessage( HUD_PRINTCENTER, "message here" );
that only works server-side
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() )
that's how you do it afaik, is there an error or something
[sui_scoreboard\player_row.lua:129] attempt to index global 'pl' (a nil value)
It just can't get the rank, and i dont know whay.Code:self.lblTeam:SetText( pl:EV_GetRank() )
sui_scoreboard\player_row.lua:129] attempt to call method 'EV_GetRank' (a nil value)
Code:self.lblTeam:SetText( self:EV_GetRank() )
isn't it self.Player instead of pl?
self.Player:EV_GetRank()
Worked with no errors, testing now. Thanks.
---------------------------------------------
Updated:
Working
---------------------------------------------
Updated:
Now i need code to get rank color.
Oh, I see. ID is a int.
does Evolve have that feature?
Yes, there is nick colors, i need code to get it
evolve.ranks[self.Player:EV_GetRank( )].Color || color_white
G.PrintMessage with HUD_PRINTCENTER on server to broadcast, Player.PrintMessage on both client and server to print only to single user.
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) .. "")
"UPDATE Wanted SET Crime = 'CrimeVal', 'StageVal' WHERE SuspectID = id"
That's the query you're sending
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..
Did I have to? As the ID is a int?
No, you don't. Assuming ID is defined somewhere.
Yeah, ID is defined as argument 3, which definetly gets recieved.
Edited:
Might it be because the "Crime" and "Stage" have spaces?
Did you escape your strings? An unescaped string with a quote can mess up your query (along with leaving you vulnerable to sql injection).
Some kind of detection for an entity to detect if another entity is within x radius to it.
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) .. "")
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)
If you are using sql.SQLStr you don not need a '.
This will work.sql.Query("UPDATE Wanted SET Crime = " .. sql.SQLStr( Crime ) .. ", Stage = " .. sql.SQLStr( Stage ) .. " WHERE SuspectID = " .. tonumber(ID) .. ")
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
Uh, this is getting confusing. Now, for a odd reason, everything turns nil when I use print(sql.LastError())
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.
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
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.![]()
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
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.
What code gets all props count in server?
print(#ents.FindByClass("prop_physics"))
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...
What's a better MySQL module to use? tmysql or mysqloo?
Something along those lineslocal f = 0.5+0.5*math.sin(math.pi*2*CurTime()*BlinksPerSec) local color = color1*f+color2*(1-f)
Is there a way to make player invisible? Like only 25% visibility.
Find the player entity on the client and use SetColor(255,255,255,25)? (or in beta: SetColor(Color(255,255,255,25)).