clear/empty an array - Printable Version + open.mp forum (https://forum.open.mp) -- Forum: General (https://forum.open.mp/forumdisplay.php?fid=19) --- Forum: Programming (https://forum.open.mp/forumdisplay.php?fid=56) --- Thread: clear/empty an array (/showthread.php?tid=2200) |
clear/empty an array - redex - 2021-07-31 hi! i wanted to know is there anyway to clear an array with only a few lines? i have player info in this array: Code: enum e_playerinfo and i wanted to know how can i clear it in on player disconnect after saving the values in sql, i used to do like this: Code: public OnPlayerDisconnect(...) and i had to do this for every variable i add, is there anyway to make this more simple? RE: clear/empty an array - Pinch - 2021-07-31 I think that this should work: Code: for(new i; e_playerinfo:i < e_playerinfo; i) { playerInfo[playerid][e_playerinfo:i] = -1; } RE: clear/empty an array - redex - 2021-07-31 (2021-07-31, 03:53 PM)Pinch Wrote: I think that this should work: so it will work for any data type? i want it to make the strings "", and ints 0, i think this is not working for every datatype RE: clear/empty an array - Pinch - 2021-07-31 (2021-07-31, 05:09 PM)redex Wrote:(2021-07-31, 03:53 PM)Pinch Wrote: I think that this should work: me neither, but what you can do is manually reset strings, you shouldn't have that much of them anyways? RE: clear/empty an array - Banditul - 2021-07-31 This is also a very good way to reset that enum https://github.com/pBlueG/SA-MP-MySQL/blob/master/example_scripts/login_system-cache.pwn#L106 RE: clear/empty an array - Pinch - 2021-08-01 (2021-07-31, 08:20 PM)Banditul Wrote: This is also a very good way to reset that enum https://github.com/pBlueG/SA-MP-MySQL/blob/master/example_scripts/login_system-cache.pwn#L106 Thank you, smart idea RE: clear/empty an array - redex - 2021-08-02 (2021-07-31, 08:20 PM)Banditul Wrote: This is also a very good way? to reset that enum https://github.com/pBlueG/SA-MP-MySQL/blob/master/example_scripts/login_system-cache.pwn#L106 thanks it was really helpful ! |