Dayo Posted April 17, 2020 Share Posted April 17, 2020 You can find some simple documentation regarding hooks at https://github.com/ChristopherDay/Gangster-Legends-V2/wiki/Hooks 1 Quote Link to comment Share on other sites More sharing options...
Sim Posted April 17, 2020 Share Posted April 17, 2020 Awesome. Thanks. Maybe add a new sub forum "Coding help / development works in progress" Maybe "Show your work in progress or need help with GL code?" Quote Link to comment Share on other sites More sharing options...
Sim Posted April 22, 2020 Share Posted April 22, 2020 (edited) Inside the user action hook example, you forgot to include the $data parameter. I think this topic should be stickied as well. Afterall, any GL documentation is very important. Edited April 22, 2020 by Sim Quote Link to comment Share on other sites More sharing options...
Sim Posted April 26, 2020 Share Posted April 26, 2020 (edited) Can more then one stat or link be returned? With the profileLink and profileStat hook? @Dayo I need to add the userAction hooks to my mods. To try and get other people to follow suit. But My Mod below takes full advantage of the UserAction hook. Edited April 26, 2020 by Sim Quote Link to comment Share on other sites More sharing options...
Sim Posted April 28, 2020 Share Posted April 28, 2020 <?php new Hook("userAction", function ($data) { global $db, $user; debug("id: " . $data['user']); debug(var_dump($data)); }) ?> There is a issue with using the userAction hook and login mod. It will create this error the first time you try to login. If you hit refresh, your be logged in with no error. Lines 43 and 45 on login.inc.php. I am unsure if he userhook causes problems anywhere else as I only tried using it during logins so far. On several mods ND several different occasions. Not once have I not encountered this. Edit: Here's the fix. Replace lines 43 and 45 $this->user->id with $user->info->U_id Now, I don't know why $this->user->id works when you hit refresh but doesn't first time trying to login in with the hook. 🙂 1 Quote Link to comment Share on other sites More sharing options...
Sim Posted May 3, 2020 Share Posted May 3, 2020 (edited) There was a problem with the userAction hook bank.SendMoney It passed id as NULL. Old code: $actionHook = new hook("userAction"); $action = array( "user" => $this->user->id, "module" => "bank.sendMoney", "id" => $user->info->id, "success" => true, "reward" => $money ); New code: $actionHook = new hook("userAction"); $action = array( "user" => $this->user->id, "module" => "bank.sendMoney", "id" => $user->info->U_id, "success" => true, "reward" => $money ); There is a problem with the jail userAction hook. It passes the users rank you are trying to break out or jail instead of there id. On line 125 and line 151 code is: $action = array( "user" => $this->user->id, "module" => "jail", "id" => $user->info->US_rank, "success" => false, "reward" => 0 ); Can be replaced with this to fix: $action = array( "user" => $this->user->id, "module" => "jail", "id" => $id, "success" => false, "reward" => 0 ); EDIT: You spelled property like this on the property transfer hook. You definitely rushed these. :). At least you got m to thoroughly test your hooks. Don't worry I left a comment in my code. Lol //I'm forced to spell wrong for my code to work properly since @Dayo don't know how to spell property properly propety.transfer Edited May 3, 2020 by Sim 1 Quote Link to comment Share on other sites More sharing options...
Sim Posted August 14, 2021 Share Posted August 14, 2021 Missing $actuon in action hook parameters in documentation Quote Link to comment Share on other sites More sharing options...
Sim Posted August 19, 2021 Share Posted August 19, 2021 Missing $action Quote Link to comment Share on other sites More sharing options...
Dayo Posted August 19, 2021 Author Share Posted August 19, 2021 On 8/14/2021 at 7:23 AM, Sim said: Missing $actuon in action hook parameters in documentation 1 hour ago, Sim said: Missing $action It would be great to know where $action is missing ... Quote Link to comment Share on other sites More sharing options...
Sim Posted August 19, 2021 Share Posted August 19, 2021 (edited) 8 hours ago, Dayo said: It would be great to know where $action is missing ... Function ($action) Edited August 19, 2021 by Magictallguy Moved the image out of the quote Quote Link to comment Share on other sites More sharing options...
Sim Posted November 28, 2021 Share Posted November 28, 2021 new hook("profileStat", function ($profile) { global $user; if ($user->id == $profile->info->U_id) { return array( "stat" => profile->info->US_kills, "text" => "Kills" ); } }); How can I add multiple stats to the profile from the hooks page. I tried some 2d arrays with no results. Also @Dayo can you update the hooks documentation. I know there is a new Hook or two? And thw other typos I found in hooks. Missing $action in action hooks, forgot $ in profileStat hooks as seen above Quote Link to comment Share on other sites More sharing options...
Sim Posted December 21, 2021 Share Posted December 21, 2021 Bump Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.