[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
#2

Very nice work, definitely going to try this out later.
Reply
#3

Nice! Very helpful
Reply
#4

Simply epic. Will check it out as soon as possible.
Reply
#5

Good job !!
Reply
#6

Damn, what gets my attention isn't the script itself, but the database. Did you enter all those entries manually? Did you downloaded the database? Or was it made with an automated process?
Reply
#7

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Damn, what gets my attention isn't the script itself, but the database. Did you enter all those entries manually? Did you downloaded the database? Or was it made with an automated process?
Using Sublime text 2 with regular expressions (regex) made it easy to prepare the data for a pawn script to read and add it to the database.

Objects are from MTA's object list. vehicles and skins are from the sa-mp wiki.
Reply
#8

This is definitely a winner. I'm taking this for my map editor.
Reply
#9

Omg this
Awesome work
Reply
#10

One thing I noticed is that you allow your hooks to process. If you perform an action there should be no need for anymore processing.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)