Recent Posts

Pages: 1 2 [3] 4 5 ... 10
21
Off-Topic / (Mysql)ShPoinsthop Player data load problem
« Last post by beska123123 on January 21, 2020, 07:04:27 AM »
When round is over in console i have this comunication and points hasn't given to player
"[SH PointshopSV] Player data for Player <MysteamId> has not been loaded!!"
22
Developers Corner / Re: ULX Respawn
« Last post by JamminR on January 20, 2020, 05:30:04 PM »
Code: [Select]
function ulx.spawn( calling_ply, target_plys )
local affected_plys = {}
for k,v in pairs(target_plys) do
if !v:Alive() then
v:Spawn()
table.insert(affected_plys, v)
end
end
ulx.fancyLogAdmin( calling_ply, "#A spawned #T", affected_plys )
end
local spawn = ulx.command ( "Custom ULX Commands" , "ulx spawn", ulx.spawn, "!spawn" )
spawn:addParam{ type=ULib.cmds.PlayersArg }
spawn:defaultAccess( ULib.ACCESS_ADMIN )
spawn:help( "Spawnd target(s)." )
23
Developers Corner / Re: ULX Respawn
« Last post by JamminR on January 20, 2020, 05:28:51 PM »
1) Don't do 1. (he's editing ULX files, all other 'fun' commands before his would break)
2) Now you're confusing things even more.
I basically said ulx.spawn ( "THIS CONTENT HERE", ...) is what goes in menu. Could be ulx.spawn ( variable_name, ...) and variable_name could literally be CATEGORY_NAME, already defined by us way up in the fun.lua file, or ulx.spawn ( "Custom ULX command", ...) and make thier own menu.
24
Developers Corner / Re: ULX Respawn
« Last post by jacksop on January 20, 2020, 01:27:48 AM »
What JamminR is saying is right.

There are 2 things you could do.

1. Delete the variable declaration at the beginning of the file and keep the string "Custom ULX Commands" in ulx.command

2.
Change your local variable (CATEGORY_NAME) to something unique - literally anything (lets just say SpawnCommand) -- local SpawnCommand = "Custom ULX Commands"
BUT you need to keep whatever you call that variable (in my case SpawnCommand) the same as what you put into the ulx.command so it would look like...
local spawn = ulx.command(SpawnCommand, "ulx spawn")..... and so on

Sorry if im repeating things. Its just because you said you were new to lua and I wanna make sure you understand.
25
Developers Corner / Re: Error in External MySQL database config - bad key
« Last post by jacksop on January 20, 2020, 01:18:54 AM »
Based on some testing I did, the cause of this problem is when I try to retrieve and concatenate ply:SteamID.
I am assuming the error: "attempt to index a string value with bad key" means I cannot concatenate this value as a string but rather as a variable.
So i changed my query line to this:
Code: [Select]
local query2 = DB_RP:query( "SELECT ulx_rank FROM playerinformation WHERE steam_id = '" .. ply:SteamID() "';")         -- no dots after ply:SteamID()

Doing so gives me this error instead: attempt to call a string value

So I guess my ultimate question here is.. how does lua respond to what value the ply:SteamID() is? is a treated as a variable? string?
Am I on the right track here or just going off on pointless tangents?  :D :-\
26
Developers Corner / Re: ULX Respawn
« Last post by JamminR on January 19, 2020, 10:29:06 AM »
It should work, but you have unnecessary  CATEGORY_NAME variable name above it.
You have now turned your utility variable into a string,
which ulx command set-up expects that first spot to be filled with. A variable containing a string, or as in your case now, an actual string.
While at same time, possibly overwriting previous category name variable defined much earlier in the file.
27
Developers Corner / Re: ULX Respawn
« Last post by Hatty on January 19, 2020, 09:52:16 AM »
Like this?

Code: [Select]
local CATEGORY_NAME = "Custom ULX Commands"

function ulx.spawn( calling_ply, target_plys )
local affected_plys = {}
for k,v in pairs(target_plys) do
if !v:Alive() then
v:Spawn()
table.insert(affected_plys, v)
end
end
ulx.fancyLogAdmin( calling_ply, "#A spawned #T", affected_plys )
end
local spawn = ulx.command ( "Custom ULX Commands" , "ulx spawn", ulx.spawn, "!spawn" )
spawn:addParam{ type=ULib.cmds.PlayersArg }
spawn:defaultAccess( ULib.ACCESS_ADMIN )
spawn:help( "Spawnd target(s)." )
28
Developers Corner / Re: ULX Respawn
« Last post by Hatty on January 19, 2020, 09:38:26 AM »
so where would I add that line of code again sorry Im newish to lua coding
29
Developers Corner / Re: ULX Respawn
« Last post by jacksop on January 18, 2020, 06:03:20 PM »
You need to create a variable for the ulx.command to link to. At the moment you have "Utility" in this parameter. Do you have a local variable called "Utility" at all in your code?

If not you would need to create one above the function ulx.spawn.

e.g. local Utility = "Extra ULX commands" -- this also creates a tab in the ulx menu called Extra ULX commands.

Unless of course you didn't include it in your code box??
30
Developers Corner / Re: ULX Respawn
« Last post by Hatty on January 18, 2020, 12:30:37 PM »
Nope
just shows the command in chat with no errors as if I just said it in game
Pages: 1 2 [3] 4 5 ... 10