Hey,
I have an auto donation script that uses a http.Fetch function to check my website for a user's donation status (either a '1' or nothing).
Unfortunately the code fails to see the '1' that is present when I (my donation status is '1' for testing) joins, and defaults to the 'else' code.
[CODE]
function PlayerConnect( ply ) http.Fetch("http://samg381.com/donate/inc/claim.php?u=" .. ply:SteamID(),
function( HTML )
if HTML == "1" then
game.ConsoleCommand("ulx asay Donation system success!")
game.ConsoleCommand("ulx adduser " .. ply:SteamID() .. " donator")
Msg("This user /is/ a donator..")
else
Msg("User is /not/ a donator.")
end
end)
end
hook.Add( "PlayerInitialSpawn", "AutoDonate", PlayerConnect )
end
[/CODE]
For example, my steam ID is STEAM_0:1:41910048. When I join, the ID is parsed with the link [url]http://samg381.com/donate/inc/claim.php?u=[/url] in order to check the donation status of the user.
Can anyone provide any insight on this issue? I can provide extra details if necessary.
Thanks in advance.
[QUOTE] 1[/QUOTE]
There is whitespace in front of your "1" in the HTML code. Should be pretty freaking obvious what you need to do.
I would try Parsing the page rather than just checking if a string matches.
Did you ever try, you know, printing the output of HTML?
[QUOTE=SeveredSkull;47117008]There is whitespace in front of your "1" in the HTML code. Should be pretty freaking obvious what you need to do.
I would try Parsing the page rather than just checking if a string matches.
Did you ever try, you know, printing the output of HTML?[/QUOTE]
Keep in mind, not everyone is wonderfully gifted at programming, and some of us are here to learn :downs:
How would I go about printing it plain text? Here's the PHP:
[CODE]
while($row = mysqli_fetch_array($result))
{
echo $row['rank'];
}
[/CODE]
[QUOTE=SeveredSkull;47117008]There is whitespace in front of your "1" in the HTML code. Should be pretty freaking obvious what you need to do.
I would try Parsing the page rather than just checking if a string matches.
Did you ever try, you know, printing the output of HTML?[/QUOTE]
I'm not actually seeing any whitespace?
[IMG]http://puu.sh/fL6pn/30f077c45d.png[/IMG]
Print the HTML in lua and see what it's coming out as.
I added a space before the '1' in the code off a whim and it actually worked.
Thank you for your help everyone.
Sorry, you need to Log In to post a reply to this thread.