Garry's Mod

Why won;t my LUA work?

Submitted by smilerryan, , Thread ID: 77848

Thread Closed
02-03-2018, 02:48 AM
#1
Hi there. I am setting up a Garry's mod server with donations, and I've added a script on the back end which will tell the server if they should get a rank or not.
The script should run the PlayerConnect function and simply check the website if they have been added to the list.
If it receives a 1, they should get the command ran and if they get nothing, nothing should happen.
I've checked the logs (and a custom IP logger with the claim.phpfile) and it doesn'trequest it.
If you could help me figure it out and get it to work, please tell me what I did wrong with it.
PS: The backend works fine, and I can request it and get it to work once in the queue.

function PlayerConnect( ply )
http.Fetch("http://xxxxxxxxxxxxxx.epizy.com/donate/inc/claim.php?u=" .. ply:SteamID(),
function( HTML )
if HTML == "1" then RunConsoleCommand("ulx", "adduserid", "" .. ply:SteamID() .. "", "Vip")
--elseif HTML == "2" then RunConsoleCommand("ulx", "adduser", "" .. ply:SteamID() .. "", "elitevip")
--elseif HTML == "3" then RunConsoleCommand("ulx", "adduser", "" .. ply:Nick() .. "", "Platnium")
end
end
)
end

--hopefully that will work
hook.Add( "PlayerInitialSpawn", "AutoDonate", PlayerConnect )

RE: Why won;t my LUA work?

#2
02-03-2018, 02:48 AM
smilerryan Wrote:
Hi there. I am setting up a Garry's mod server with donations, and I've added a script on the back end which will tell the server if they should get a rank or not.
The script should run the PlayerConnect function and simply check the website if they have been added to the list.
If it receives a 1, they should get the command ran and if they get nothing, nothing should happen.
I've checked the logs (and a custom IP logger with the claim.phpfile) and it doesn'trequest it.
If you could help me figure it out and get it to work, please tell me what I did wrong with it.
PS: The backend works fine, and I can request it and get it to work once in the queue.

function PlayerConnect( ply )
http.Fetch("http://xxxxxxxxxxxxxx.epizy.com/donate/inc/claim.php?u=" .. ply:SteamID(),
function( HTML )
if HTML == "1" then RunConsoleCommand("ulx", "adduserid", "" .. ply:SteamID() .. "", "Vip")
--elseif HTML == "2" then RunConsoleCommand("ulx", "adduser", "" .. ply:SteamID() .. "", "elitevip")
--elseif HTML == "3" then RunConsoleCommand("ulx", "adduser", "" .. ply:Nick() .. "", "Platnium")
end
end
)
end

--hopefully that will work
hook.Add( "PlayerInitialSpawn", "AutoDonate", PlayerConnect )

either use a leaked donation addon. or get a leaked donation addon to serve as an example code for your current code. and make
your whole new donation system addon and sell it.

RE: Why won;t my LUA work?

#3
It depends, You could have left a capital letter in an area it does not support, you could have miss spelt a word or missed out a line of code all together.

RE: Why won;t my LUA work?

#4
You can try check your syntax there https://fptje.github.io/glualint-web/

RE: Why won;t my LUA work?

#5
check your DB and you need ULX *w* yes i know i know i know
[Image: giphy.gif]

Users browsing this thread: 3 Guest(s)