2024-04-08, 02:17 AM
(2019-04-14, 11:04 PM)DTV Wrote: I remember seeing a thread like this on SA-MP forums so it'd be nice to share with each other little tricks to making our lives easier with pawn, I'll start:
Actually don't know what this is formally called, but you can use it to skip parts of code when needed (good in a situation where the ending part of code is always the same but you don't need to copy/paste that code in every if/switch statement)
Code:someFunc(params) {
? ? if(params) {
? ? ? ? SendClientMessage(playerid,-1,"Not skipped!");
? ? ? ? return 1;
? ? }
? ? else { goto skipBlock; } //this is how you'd call for the code to skip to `skipBlock`
? ? skipBlock: //this is how you'd create it
? ? SendClientMessage(playerid,-1,"Skipped!");
? ? return 1;
}