[Library] samp-async-objects | Edit an object with pawnplus tasks! - Printable Version + open.mp forum (https://forum.open.mp) -- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) --- Forum: Releases (https://forum.open.mp/forumdisplay.php?fid=13) ---- Forum: Libraries (https://forum.open.mp/forumdisplay.php?fid=31) ---- Thread: [Library] samp-async-objects | Edit an object with pawnplus tasks! (/showthread.php?tid=1401) |
samp-async-objects | Edit an object with pawnplus tasks! - Mergevos - 2020-12-01 Redirect to github:? Installation Simply install to your project: Code: sampctl package install Mergevos/samp-async-objects Include in your code and begin using the library: Code: #include <async-objects> Usage Let's look at the following example: Code: YCMD:test(playerid, params[], help) The /test?command executes the SelectObject function which allows you to select an object you would like to edit. When you select the object it calls OnPlayerSelectObject, GUI is going to show up and allows you to edit, move, rotate and save the object changes. If you hit a cancel or the save button, it awaits task response and when it finishes, it returns task results in an array, thus, you can check, save and modify the object. In the code above, that array way obj_res, which is abbreviation of object_response, also, we've checked if player hit save button, a.k.a EDIT_RESPONSE_FINAL?or cancel button with obviously EDIT_RESPONSE_FINAL?and then we simply output a message. If, for some reason, messages didn't get output, then there's most likely a problem. The functions you're going to use are: Code: Task: AsyncObject_Edit(playerid, objectid) The params are obvious, the function also has a wrapper. By defining `ASYNC_OBJECT_SYNTAX_EDIT` you allow yourself to use it: Code: Task: EditObjectAsync(playerid, objectid) Note: You've to put `OnPlayerEditObject` callback in your script.* Testing To test, simply run the package, connect to a server and then execute /test: Code: sampctl package run |