Sim Posted December 21, 2021 Posted December 21, 2021 new hook("profileStat", function ($profile) { global $user; $test = array("stat" => 99, "text" => "Test" ); $test = array("stat" => 99, "text" => "Test" ); if ($user->id == $profile->info->U_id) { return $test; } }); I been trying to return multiple profile stats set once. I know this choice obviously well but do so, but all attempts of 2d arrays/objects have failed. Anyone got any ideas? Maybe template change the variable? @Dayo Quote
ags_cs4 Posted December 21, 2021 Posted December 21, 2021 Add each stat in its own hook The way you want it you need to 1d another {each} but that wont work with the other 1 stat hook you need to add if condition to you code in both 2 stat hook and ur tpl to get what you want Quote
Dayo Posted December 21, 2021 Posted December 21, 2021 Yeah each would have to be its own hook. I can look about adding support for multi-dimensional arrays but i would have to add it into loads of places to keep uniformity. It would be annoying to support it on one Hook and not all others. 1 Quote
Sim Posted December 22, 2021 Author Posted December 22, 2021 15 hours ago, ags_cs4 said: Add each stat in its own hook That would be a lot of hooks, and not knowing the amount of hooks to add is even harder. I was trying to add a rap sheet to the profile by each success failed attempts to the profile stats. Quote
ags_cs4 Posted December 22, 2021 Posted December 22, 2021 How many hooks you gona add? Do some thing like how i did it in my racing mod (check the screenshots) Â Quote
Sim Posted December 22, 2021 Author Posted December 22, 2021 As many as a game owner decides? @ags_cs4 Â Â Quote
Sim Posted December 25, 2021 Author Posted December 25, 2021 (edited) 2 hours ago, ags_cs4 said: Didn't understand what you said I thought the screen shots would help you understand. Game owner can choose which mods to show failed/success/attempts to be added to profile stat. But obviously it was an epic fail on my part not realizing I could not return an array. 🙂 Edited December 25, 2021 by Sim Quote
Sim Posted December 27, 2021 Author Posted December 27, 2021 I managed to get the results I wantes with the alterModuleTemplateHook.. Actually better results. Â Quote
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.