Skip to content

dinhkhoi2298/fSelection

Repository files navigation

fSelection

sampctl

Installation

Simply install to your project:

sampctl package install roesanne26/fSelection

Include in your code and begin using the library:

#include <fSelection>

fSelection-pp.inc

  • Unlimited item

(require https://github.com/IllidanS4/PawnPlus)

Usage

Functions

fselection_add_item(playerid, modelid, Float:rotx, Float:roty, Float:rotz, Float:zoom);
fselection_show(playerid, fselectid, const header[], page);
fselection_showing(playerid);
fselection_hide(playerid);

// fSelection-pp.inc
async_fselection_show(playerid, const header[]);

Example #1

// 
#include <fSelection>

const FSELECTION_CLOTHES = 0;

CMD:clothes(playerid) {
	if(fselection_showing(playerid)) 
		return SendClientMessage(playerid, -1, "SU DUNG ESC DE TAT.");

	for(new skinID = 1; skinID < 312; skinID ++) {
		if(skinID == 74) continue;
		fselection_add_item(playerid, skinID);
	}

	fselection_show(playerid, FSELECTION_CLOTHES, "Clothes");
	return 1;
}

public OnFSelectionResponse(playerid, fselectid, modelid, response) {	
	if(fselectid == FSELECTION_CLOTHES && response) {
		SetPlayerSkin(playerid, modelid);	
	}
	return 1;
}

Example #2

Using async_fselection_show

/* fSelection-pp test */
#include <fSelection-pp>

CMD:clothes(playerid) {
    if(fselection_showing(playerid)) 
        return SendClientMessage(playerid, -1, "SU DUNG ESC DE TAT.");

    new 
        str[64], fSelectionInfo[E_FSELECTION_INFO];

    task_yield(1);
    for(new i = 0; i < 311; i ++) {
        if(i == 74) 
            continue; // bad id

        fselection_add_item(playerid, i);
    }
    task_await_arr(async_fselection_show(playerid, "Clothes"), fSelectionInfo);
    if(fSelectionInfo[fs_response] == fS_RESPONSE_CLICKED) {
        SetPlayerSkin(playerid, fSelectionInfo[fs_modelid]);
        format(str, 64, "Bro da thay trang phuc %d", fSelectionInfo[fs_modelid]);
    }
    else strcat(str, "Bro da tat fSelection", 64);

    SendClientMessage(playerid, -1, str);
    return 1;
}

Testing

To test, simply run the package:

sampctl package run

Credits

jav - rfogkid26