sentanos / roblox-bots

This project is no longer maintained, please consider this instead: https://github.com/sentanos/roblox-js-server
17 stars 28 forks source link

Login errors? #17

Closed LukeTechnoUserOfficial closed 8 years ago

LukeTechnoUserOfficial commented 8 years ago

Hey, I know this is a pretty vague issue. However, I've been reading through the readme files and they are not very clear. In the receiver.php, I changed my group ID as well as my get and post keys. I believe I had to change the 'username' and 'password' to my bot's account too. I then used the send.lua to send the player to the server and according to roblox it send back, but the player was not promoted at all.

I am using hostinate.com/ as a server and I have put this entire folder into the server. Is there anything else that I need to edit?

Thanks Luke one two Receiver.txt

sentanos commented 8 years ago

Your setup looks correct, I can't help you beyond that because you have not told me what actually happened with the request other than the fact that it didn't work.

LukeTechnoUserOfficial commented 8 years ago

Oh i'm sorry! It's something to do with the 'getRoles.php 'Line 27' Syntax Error unexpected '[' getRoles.txt

$roles = json_decode(file_get_contents("http://api.roblox.com/groups/$group"),true)['Roles'];

sentanos commented 8 years ago

That error is caused by an outdated PHP version that does not support newer syntax used in a script, specifically this line in getRoles.php:

$roles = json_decode(file_get_contents("http://api.roblox.com/groups/$group"),true)['Roles'];

If possible, upgrade your PHP version; however, this can be easily fixed by the line to:

$json = json_decode(file_get_contents("http://api.roblox.com/groups/$group"),true);
$roles = $json['Roles'];

I can't remember if this is the only syntax incompatibility with older PHP versions, but I'm pretty sure other than trivial syntax incompatibilities the scripts should work.

LukeTechnoUserOfficial commented 8 years ago

Syntax error unexpected '[' Line 15

<?php /*

NOT MADE BY ME.
Source: http://php.net/manual/en/function.http-parse-headers.php#112917

If you are getting the X-CSRF token using pecl_http http_parse_headers function, do:
http_parse_headers['X-Csrf-Token'];
With this it's: 
http_parse_headers['X-CSRF-TOKEN'];

*/
if (!function_exists('http_parse_headers')) {
    function http_parse_headers ($raw_headers) {
        $headers = [];

        foreach (explode("\n", $raw_headers) as $i => $h) {
            $h = explode(':', $h, 2);

            if (isset($h[1])) {
                $headers[$h[0]] = trim($h[1]);
            }
        }

        return $headers;
    }
}

?>

sentanos commented 8 years ago

Is there really no way to upgrade your PHP version? Like I said, if you just do that everything should work fine.

Anyways the second error you are having is another incompatibility with old PHP versions, change the following line:

$headers = [];

to

$headers = array();
LukeTechnoUserOfficial commented 8 years ago

The final log just says 'No Change!' Did I do something wrong? I changed all of the json's like the first one you sent me in the misc file.

LukeTechnoUserOfficial commented 8 years ago

<?php // These are just a few miscellaneous ROBLOX APIs in php function form that you might want to use. function UsernameFromID($userId) { $json = json_decode(file_get_contents("http://api.roblox.com/users/$userId"),true); return $json['Username']; } function IDFromUsername($username) { $json = json_decode(file_get_contents("http://api.roblox.com/users/get-by-username?username=$username"),true); return $json['Id']; } function getRankInGroup($userId,$groupId) { return (int)simplexml_load_file("http://www.roblox.com/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=$userId&groupid=$groupId"); } function fetchShout($cookie,$group) { // Log in for correct permissions $curl = curl_init("http://www.roblox.com/My/Groups.aspx?gid=$group"); curl_setopt_array($curl,array( CURLOPT_RETURNTRANSFER => true, CURLOPT_COOKIEFILE => $cookie, CURLOPT_COOKIEJAR => $cookie )); $response = curl_exec($curl); curl_close($curl); $doc = new DOMDocument(); $doc->loadHTML($response); return $doc->getElementById('ctl00_cphRoblox_GroupStatusPane_StatusTextField')->textContent; } ?>

LukeTechnoUserOfficial commented 8 years ago

The only problem i can think of is this being written wrong?

local baseURL = 'http://bwepromotions.hst.im' -- This is your website URL, NOT including the file. local POSTKey = 'techno123775' -- Match with post key on your php file local GETKey = 'luke123775' -- Match with get key on your php file -- Example: baseURL/receiver.php?key=GETKey -- {"Validate":POSTKey ...}

-- Action and parameters are based on what you put in the receiver php file. local send = function(action,parameters) local array = { Validate = POSTKey, Action = action, Parameter1 = parameters[1], Parameter2 = parameters[2], } return game:GetService'HttpService':PostAsync(string.format('%s/receiver.php?key=%s',baseURL,GETKey),game:GetService'HttpService':JSONEncode(array)) end

-- MAKE SURE TO PUT PARAMETERS IN AN ARRAY, EVEN IF THERE IS ONLY ONE --send('shout',{'KILLER IS BAD'})

script.Parent.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) send(player,'setRank',{player.userId,4}) print(send(player,'setRank',{player.userId,4})) -- {player ID, RankRole}? print(player.Name.." has been promoted to Initiate.") player.PlayerGui.ScreenGui.End.Visible = true player.PlayerGui.ScreenGui.End.Script.Disabled = false end)

sentanos commented 8 years ago

You are not being clear about the actual issue at this point and the issues you have had are your own. It has been concluded that this is not a problem with the scripts themselves but your server and setup, which is your responsibility only.

If you can create a clear concise issue with these scripts (that is, with relevant errors and pictures after attempting to fix the problem on your own), even if it's related to your own setup, I will help simply out of the goodness of my heart. I am not providing service to you, I wrote these bots for anyone to use and I will deal with the problems of the scripts themselves so people who use it can continue to: I technically have no obligation to help anyone but I try to anyways. When people need step by step help over setup problems or post unclear issues there is nothing I can do for them.

Upgrade your PHP version and if you continue to have problems make a new issue clearly outlying specifically what problems you are having after you have looked it up yourself and I will happily help.