[Include] Model Browser - Search, browse and view all skins, vehicles and objects in-game.
#1

Model Browser
(Search, browse and view all skins, vehicles and objects in-game)

(image is resized)


About

Model Browser is an in-game model browser for searching and viewing all skins, vehicles and objects.
This includes all SA-MP objects from SA-MP.ide up till 0.3.7

All models can be searched for by clicking the "search" button.
Search results are limited to 19 (default) but I may add pages for more results in the future.

The arrows buttons next to X, Y, Z and zoom will rotate and zoom the object.

The arrows on the model preview will increase/decrease the viewed model number.

Pressing "close" or the ESCAPE key will close the menu,

Functions and callbacks

IsModelBrowserVisible(playerid)
Check if the browser is displayed for the given player.

ShowModelBrowser(playerid)
Show the browser to a player.

HideModelBrowser(playerid)
Hides the browser for the given player.

ModelBrowserSearch(playerid, search[])
Perform a browser search for the given player. Browser must be shown first.

SetBrowserModelID(playerid, modelid)
Set the model ID the player is viewing.

GetBrowserModelID(playerid)
Get the model ID the player is viewing.
If the browser has been closed, the last viewed model will be returned.

SetBrowserModelZoom(playerid, Float:zoom_level)
Set the zoom level of the browser preview model.

Float:GetBrowserModelZoom(playerid)
Get the zoom level of the browser model.

SetBrowserModelRot(playerid, Float:rot_x, Float:rot_y, Float:rot_z)
Set the rotations of the browser model.

GetBrowserModelRot(playerid, &Float:rot_x, &Float:rot_y, &Float:rot_z)
Get the rotations of the browser model.

OnPlayerExitModelBrowser(playerid)
Called when a player exits the browser.
The player must press the close button or ESCAPE for this to be triggered and is not called when
closing the browser with HideModelBrowser(playerid) (this may change if requested).

Example:
PHP код:
IsValidVehicleModelID(modelid)
{
    if (
400 <= modelid <= 611)
        return 
1;
    return 
0;
}
public 
OnPlayerExitModelBrowser(playerid)
{
    new 
modelid GetBrowserModelID(playerid);
    if (
IsValidVehicleModelID(modelid))
    {
        new 
Float:pos_xFloat:pos_yFloat:pos_zvehicleid;
        
GetPlayerPos(playeridpos_xpos_ypos_z);
        
vehicleid CreateVehicle(modelidpos_xpos_ypos_z0.0, -1, -160);
        
PutPlayerInVehicle(playeridvehicleid0);
        
SendClientMessage(playerid, -1"This is an example of spawning a vehicle from the model browser.");
    }
    
SendClientMessage(playerid, -1"Model browser closed.");
    
CancelSelectTextDraw(playerid);
    return 
1;

Download

modelids.db must be placed in the scriptfiles directory for searching to work.

All files are hosted on GitHub and can be downloaded by clicking "Download ZIP".
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)