23.05.2015, 11:23
Model Browser
(Search, browse and view all skins, vehicles and objects in-game)
(image is resized)
(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_x, Float:pos_y, Float:pos_z, vehicleid;
GetPlayerPos(playerid, pos_x, pos_y, pos_z);
vehicleid = CreateVehicle(modelid, pos_x, pos_y, pos_z, 0.0, -1, -1, 60);
PutPlayerInVehicle(playerid, vehicleid, 0);
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;
}
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".