Add original release (v1 BETA) files
This commit is contained in:
parent
4142f854de
commit
ce596ac0b8
13
UCW_readme.txt
Normal file
13
UCW_readme.txt
Normal file
@ -0,0 +1,13 @@
|
||||
//***********ULTRA CUBIC WORLD********//
|
||||
|
||||
//pasha97 aka Pavel Chernyshov
|
||||
//2013-2013
|
||||
//Voronezh, Russia
|
||||
//Skype: pasha.97.97
|
||||
//All rights reserved
|
||||
|
||||
How to install this game mode:
|
||||
1. Extract the files from an archive to appropriate folders of your server
|
||||
2. Open server.cfg and write UCW to the "gamemode0" line. It must be like: "gamemode0 UCW 1"
|
||||
3. Add the names of all the plugins which are included to the archive to the "plugins" line of server.cfg
|
||||
4. Open the server and join! If something works wrong, write it in the release thread.
|
BIN
gamemodes/UCW.amx
Normal file
BIN
gamemodes/UCW.amx
Normal file
Binary file not shown.
2721
gamemodes/UCW.pwn
Normal file
2721
gamemodes/UCW.pwn
Normal file
File diff suppressed because it is too large
Load Diff
268
pawno/include/Dini.inc
Normal file
268
pawno/include/Dini.inc
Normal file
@ -0,0 +1,268 @@
|
||||
/*
|
||||
* Dini 1.6
|
||||
* (c) Copyright 2006-2008 by DracoBlue
|
||||
*
|
||||
* @author : DracoBlue (http://dracoblue.com)
|
||||
* @date : 13th May 2006
|
||||
* @update : 16th Sep 2008
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* It's released under the terms of MIT.
|
||||
*
|
||||
* Feel free to use it, a little message in
|
||||
* about box is honouring thing, isn't it?
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined _dini_included
|
||||
#endinput
|
||||
#endif
|
||||
|
||||
#define _dini_included
|
||||
#pragma library dini
|
||||
|
||||
#if defined MAX_STRING
|
||||
#define DINI_MAX_STRING MAX_STRING
|
||||
#else
|
||||
#define DINI_MAX_STRING 255
|
||||
#endif
|
||||
|
||||
stock dini_Exists(filename[]) {
|
||||
return fexist(filename);
|
||||
}
|
||||
|
||||
stock dini_Remove(filename[]) {
|
||||
return fremove(filename);
|
||||
}
|
||||
|
||||
stock dini_Create(filename[]) {
|
||||
if (fexist(filename)) return false;
|
||||
new File:fhnd;
|
||||
fhnd=fopen(filename,io_write);
|
||||
if (fhnd) {
|
||||
fclose(fhnd);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
stock dini_Set(filename[],key[],value[]) {
|
||||
// If we have no key, it can't be set
|
||||
// we also have no chance to set the value, if all together is bigger then the max string
|
||||
new key_length = strlen(key);
|
||||
new value_length = strlen(value);
|
||||
if (key_length==0 || key_length+value_length+2>DINI_MAX_STRING) return false;
|
||||
|
||||
new File:fohnd, File:fwhnd;
|
||||
new tmpres[DINI_MAX_STRING];
|
||||
new bool:wasset=false;
|
||||
|
||||
// Let's remove the old *.part file if there was one.
|
||||
format(tmpres,sizeof(tmpres),"%s.part",filename);
|
||||
fremove(tmpres);
|
||||
|
||||
// We'll open the source file.
|
||||
fohnd=fopen(filename,io_read);
|
||||
if (!fohnd) return false;
|
||||
|
||||
fwhnd=fopen(tmpres,io_write);
|
||||
if (!fwhnd) {
|
||||
// we can't open the second file for writing, so .. let's close the open one and exit.
|
||||
fclose(fohnd);
|
||||
return false;
|
||||
}
|
||||
|
||||
while (fread(fohnd,tmpres)) {
|
||||
if (
|
||||
!wasset
|
||||
&& tmpres[key_length]=='='
|
||||
&& !strcmp(tmpres, key, true, key_length)
|
||||
) {
|
||||
// We've got what needs to be replaced!
|
||||
format(tmpres,sizeof(tmpres),"%s=%s",key,value);
|
||||
wasset=true;
|
||||
} else {
|
||||
DINI_StripNewLine(tmpres);
|
||||
}
|
||||
fwrite(fwhnd,tmpres);
|
||||
fwrite(fwhnd,"\r\n");
|
||||
}
|
||||
|
||||
if (!wasset) {
|
||||
format(tmpres,sizeof(tmpres),"%s=%s",key,value);
|
||||
fwrite(fwhnd,tmpres);
|
||||
fwrite(fwhnd,"\r\n");
|
||||
}
|
||||
|
||||
fclose(fohnd);
|
||||
fclose(fwhnd);
|
||||
|
||||
format(tmpres,sizeof(tmpres),"%s.part",filename);
|
||||
if (DINI_fcopytextfile(tmpres,filename)) {
|
||||
return fremove(tmpres);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
stock dini_IntSet(filename[],key[],value) {
|
||||
new valuestring[DINI_MAX_STRING];
|
||||
format(valuestring,DINI_MAX_STRING,"%d",value);
|
||||
return dini_Set(filename,key,valuestring);
|
||||
}
|
||||
|
||||
stock dini_Int(filename[],key[]) {
|
||||
return strval(dini_Get(filename,key));
|
||||
}
|
||||
|
||||
stock dini_FloatSet(filename[],key[],Float:value) {
|
||||
new valuestring[DINI_MAX_STRING];
|
||||
format(valuestring,DINI_MAX_STRING,"%f",value);
|
||||
return dini_Set(filename,key,valuestring);
|
||||
}
|
||||
|
||||
stock Float:dini_Float(filename[],key[]) {
|
||||
return floatstr(dini_Get(filename,key));
|
||||
}
|
||||
|
||||
stock dini_Bool(filename[],key[]) {
|
||||
return strval(dini_Get(filename,key));
|
||||
}
|
||||
|
||||
stock dini_BoolSet(filename[],key[],value) {
|
||||
if (value) {
|
||||
return dini_Set(filename,key,"1");
|
||||
}
|
||||
return dini_Set(filename,key,"0");
|
||||
}
|
||||
|
||||
stock dini_Unset(filename[],key[]) {
|
||||
// If we have no key, it can't be set
|
||||
// we also have no chance to unset the key, if all together is bigger then the max string
|
||||
new key_length = strlen(key);
|
||||
if (key_length==0 || key_length+2>DINI_MAX_STRING) return false;
|
||||
|
||||
new File:fohnd, File:fwhnd;
|
||||
new tmpres[DINI_MAX_STRING];
|
||||
|
||||
// Let's remove the old *.part file if there was one.
|
||||
format(tmpres,DINI_MAX_STRING,"%s.part",filename);
|
||||
fremove(tmpres);
|
||||
|
||||
// We'll open the source file.
|
||||
fohnd=fopen(filename,io_read);
|
||||
if (!fohnd) return false;
|
||||
|
||||
fwhnd=fopen(tmpres,io_write);
|
||||
if (!fwhnd) {
|
||||
// we can't open the second file for writing, so .. let's close the open one and exit.
|
||||
fclose(fohnd);
|
||||
return false;
|
||||
}
|
||||
|
||||
while (fread(fohnd,tmpres)) {
|
||||
if (
|
||||
tmpres[key_length]=='='
|
||||
&& !strcmp(tmpres, key, true, key_length)
|
||||
) {
|
||||
// We've got what needs to be removed!
|
||||
} else {
|
||||
DINI_StripNewLine(tmpres);
|
||||
fwrite(fwhnd,tmpres);
|
||||
fwrite(fwhnd,"\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fohnd);
|
||||
fclose(fwhnd);
|
||||
|
||||
format(tmpres,DINI_MAX_STRING,"%s.part",filename);
|
||||
if (DINI_fcopytextfile(tmpres,filename)) {
|
||||
return fremove(tmpres);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
stock dini_Get(filename[],key[]) {
|
||||
new tmpres[DINI_MAX_STRING];
|
||||
|
||||
new key_length = strlen(key);
|
||||
if (key_length==0 || key_length+2>DINI_MAX_STRING) return tmpres;
|
||||
|
||||
new File:fohnd;
|
||||
fohnd=fopen(filename,io_read);
|
||||
if (!fohnd) return tmpres;
|
||||
|
||||
while (fread(fohnd,tmpres)) {
|
||||
if (
|
||||
tmpres[key_length]=='='
|
||||
&& !strcmp(tmpres, key, true, key_length)
|
||||
) {
|
||||
/* We've got what we need */
|
||||
DINI_StripNewLine(tmpres);
|
||||
strmid(tmpres, tmpres, key_length + 1, strlen(tmpres), DINI_MAX_STRING);
|
||||
fclose(fohnd);
|
||||
return tmpres;
|
||||
}
|
||||
}
|
||||
fclose(fohnd);
|
||||
return tmpres;
|
||||
}
|
||||
|
||||
|
||||
stock dini_Isset(filename[],key[]) {
|
||||
new key_length = strlen(key);
|
||||
if (key_length==0 || key_length+2>DINI_MAX_STRING) return false;
|
||||
|
||||
new File:fohnd;
|
||||
fohnd=fopen(filename,io_read);
|
||||
if (!fohnd) return false;
|
||||
|
||||
new tmpres[DINI_MAX_STRING];
|
||||
while (fread(fohnd,tmpres)) {
|
||||
if (
|
||||
tmpres[key_length]=='='
|
||||
&& !strcmp(tmpres, key, true, key_length)
|
||||
) {
|
||||
// We've got what we need
|
||||
fclose(fohnd);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
fclose(fohnd);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
stock DINI_StripNewLine(stringd[]) {
|
||||
new len = strlen(stringd);
|
||||
if (stringd[0]==0) return ;
|
||||
if ((stringd[len - 1] == '\n') || (stringd[len - 1] == '\r')) {
|
||||
stringd[len - 1] = 0;
|
||||
if (stringd[0]==0) return ;
|
||||
if ((stringd[len - 2] == '\n') || (stringd[len - 2] == '\r')) stringd[len - 2] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
stock DINI_fcopytextfile(oldname[],newname[]) {
|
||||
new File:ohnd,File:nhnd;
|
||||
if (!fexist(oldname)) return false;
|
||||
ohnd=fopen(oldname,io_read);
|
||||
if (!ohnd) return false;
|
||||
nhnd=fopen(newname,io_write);
|
||||
if (!nhnd) {
|
||||
fclose(ohnd);
|
||||
return false;
|
||||
}
|
||||
new tmpres[DINI_MAX_STRING];
|
||||
while (fread(ohnd,tmpres)) {
|
||||
DINI_StripNewLine(tmpres);
|
||||
format(tmpres,sizeof(tmpres),"%s\r\n",tmpres);
|
||||
fwrite(nhnd,tmpres);
|
||||
}
|
||||
fclose(ohnd);
|
||||
fclose(nhnd);
|
||||
return true;
|
||||
}
|
967
pawno/include/MPM.inc
Normal file
967
pawno/include/MPM.inc
Normal file
@ -0,0 +1,967 @@
|
||||
// MPM - Model Preview Menus system.(0.3x++)
|
||||
|
||||
// - Creator: Pasha97 (2013-...)
|
||||
// - Thanks to Doefler and Kalcor
|
||||
|
||||
//Include version: 1.0
|
||||
|
||||
|
||||
/*Available functions
|
||||
|
||||
LoadMPMenu(f_name[])
|
||||
HideMPMenu(playerid)
|
||||
ShowMPMenu(playerid, ListID, header_text[], titles_array[][],titles_amount = 0, dialogBGcolor = 0x34c924BB, previewBGcolor = 0xBEF57499 , tdSelectionColor = 0xCCFF00AA, tdTitleColor = 0xcd5700AA)
|
||||
ShowDynamicMPMenu(playerid, items_array[], item_amount, header_text[], extraid, Float:Xrot = 0.0, Float:Yrot = 0.0, Float:Zrot = 0.0, Float:mZoom = 1.0, titles_array[][], dialogBGcolor = 0x34c924BB, previewBGcolor = 0xBEF57499, tdSelectionColor = 0xCCFF00AA,tdTitleColor = 0xcd5700AA)
|
||||
|
||||
//NEW
|
||||
ShowColorMPMenu(playerid, items_array[], item_amount, header_text[], extraid, titles_array[][], dialogBGcolor = 0x34c924BB, previewBGcolor = 0xBEF57499, tdSelectionColor = 0xCCFF00AA,tdTitleColor = 0xcd5700AA)
|
||||
//This function shows colorful selection, not with models.In this this function items_array[] must be an array of diffrent colors for each item.
|
||||
*/
|
||||
|
||||
// Callbacks
|
||||
forward OnMPMenuResponse(playerid, response, listid, modelid, listitem);
|
||||
forward OnDynamicMPMenuResponse(playerid, response, extraid, modelid, listitem);
|
||||
|
||||
// Common settings
|
||||
new MPM_TITLE_ALIGNMENT = 2 /*Alignment of titles (1-left 2-centered 3-right)*/;
|
||||
new MPM_TITLE_POSITION = 1 /*Position of titles (1-top of the item 2-bottom of the item)*/;
|
||||
|
||||
#define MPM_NEXT_BUTTON "Next" //Text of 'Next' Button
|
||||
#define MPM_BACK_BUTTON "Back" //Text of 'Back' Button
|
||||
#define MPM_EXIT_BUTTON "Exit" //Text of 'Exit' Button
|
||||
|
||||
// Settings for static lists
|
||||
#define MPM_TOTAL_ITEMS 1000 // Max amount of items from all lists
|
||||
#define MPM_TOTAL_LISTS 90 // Max amount of lists
|
||||
#define MPM_TOTAL_ROT_ZOOM 100 // Max amount of items using extra information like zoom or rotations
|
||||
|
||||
// Settings for dynamic (per player) lists
|
||||
#define MPM_DYNAMIC_MAX_ITEMS 1000
|
||||
|
||||
//All parts of script below are not for usual users!
|
||||
|
||||
#define MPM_INVALID_LISTID MPM_TOTAL_LISTS
|
||||
#define MPM_DYNAMIC_LISTID (MPM_TOTAL_LISTS+1)
|
||||
#define MPM_COLOR_LISTID (MPM_TOTAL_LISTS+2)
|
||||
|
||||
new DynamicList[MAX_PLAYERS][MPM_DYNAMIC_MAX_ITEMS];
|
||||
new ColorList[MAX_PLAYERS][MPM_DYNAMIC_MAX_ITEMS];
|
||||
|
||||
new MPM_previewBGcolor[MAX_PLAYERS][MPM_DYNAMIC_MAX_ITEMS];
|
||||
|
||||
|
||||
new NO_TITLES[][]=
|
||||
{
|
||||
" ",
|
||||
" "
|
||||
};
|
||||
|
||||
#define MPM_SELECTION_ITEMS 21
|
||||
#define MPM_ITEMS_PER_LINE 7
|
||||
#define MPM_DIALOG_BASE_X 75.0
|
||||
#define MPM_DIALOG_BASE_Y 120.0//130
|
||||
#define MPM_DIALOG_WIDTH 550.0
|
||||
#define MPM_DIALOG_HEIGHT 180.0
|
||||
#define MPM_SPRITE_DIM_X 60.0
|
||||
#define MPM_SPRITE_DIM_Y 70.0
|
||||
|
||||
new PlayerText:CurrentPageTextDraw[MAX_PLAYERS];
|
||||
new PlayerText:HeaderTextDraw[MAX_PLAYERS];
|
||||
new PlayerText:BackgroundTextDraw[MAX_PLAYERS];
|
||||
new PlayerText:NextButtonTextDraw[MAX_PLAYERS];
|
||||
new PlayerText:PrevButtonTextDraw[MAX_PLAYERS];
|
||||
new PlayerText:CancelButtonTextDraw[MAX_PLAYERS];
|
||||
new PlayerText:ItemsTD[MAX_PLAYERS][MPM_SELECTION_ITEMS];
|
||||
new PreviewItemModel[MAX_PLAYERS][MPM_SELECTION_ITEMS];
|
||||
new ItemID[MAX_PLAYERS][MPM_SELECTION_ITEMS];
|
||||
new PlayerText:Title[MAX_PLAYERS][101];
|
||||
new globalItemAt[MAX_PLAYERS];
|
||||
|
||||
#define MPM_LIST_START 0
|
||||
#define MPM_LIST_END 1
|
||||
new All_Lists[MPM_TOTAL_LISTS][2]; // list information start/end index
|
||||
|
||||
#define MPM_ITEM_MODEL 0
|
||||
#define MPM_ITEM_ROT_ZOOM_ID 1
|
||||
new All_Items[MPM_TOTAL_ITEMS][2];
|
||||
|
||||
new Float:RotZoomInfo[MPM_TOTAL_ROT_ZOOM][4]; // Array for saving rotation and zoom info
|
||||
new ItemAmount = 0; // Amount of items used
|
||||
new ListAmount = 0; // Amount of lists used
|
||||
new RotZoomInfoAmount = 0; // Amount of Rotation/Zoom informations used
|
||||
#pragma tabsize 0
|
||||
//------------------------------------------------
|
||||
|
||||
stock MPM_GetPagesAmount(ListID)
|
||||
{
|
||||
new ItemAmount_m = MPM_GetAmountOfListItems(ListID);
|
||||
if((ItemAmount_m >= MPM_SELECTION_ITEMS) && (ItemAmount_m % MPM_SELECTION_ITEMS) == 0)
|
||||
{
|
||||
return (ItemAmount_m / MPM_SELECTION_ITEMS);
|
||||
}
|
||||
else return (ItemAmount_m / MPM_SELECTION_ITEMS) + 1;
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
stock MPM_GetPagesAmountEx(playerid)
|
||||
{
|
||||
new ItemAmount_m = MPM_GetAmountOfListItemsEx(playerid);
|
||||
if((ItemAmount_m >= MPM_SELECTION_ITEMS) && (ItemAmount_m % MPM_SELECTION_ITEMS) == 0)
|
||||
{
|
||||
return (ItemAmount_m / MPM_SELECTION_ITEMS);
|
||||
}
|
||||
else return (ItemAmount_m / MPM_SELECTION_ITEMS) + 1;
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
stock MPM_GetAmountOfListItems(ListID)
|
||||
{
|
||||
return (All_Lists[ListID][MPM_LIST_END] - All_Lists[ListID][MPM_LIST_START])+1;
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
stock MPM_GetAmountOfListItemsEx(playerid)
|
||||
{
|
||||
return GetPVarInt(playerid, "MPM_DYNAMIC_item_amount");
|
||||
}
|
||||
stock MPM_GetAmountOfListItemsEx2(playerid)
|
||||
{
|
||||
return GetPVarInt(playerid, "MPM_COLOR_item_amount");
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
stock MPM_GetPlayerCurrentListID(playerid)
|
||||
{
|
||||
if(GetPVarInt(playerid, "MPM_list_active") == 1) return GetPVarInt(playerid, "MPM_list_id");
|
||||
else return MPM_INVALID_LISTID;
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
stock PlayerText:MPM_CreateCurrentPageTextDraw(playerid, Float:Xpos, Float:Ypos)
|
||||
{
|
||||
new PlayerText:txtInit;
|
||||
txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, "0/0");
|
||||
PlayerTextDrawUseBox(playerid, txtInit, 0);
|
||||
PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1);
|
||||
PlayerTextDrawFont(playerid, txtInit, 1);
|
||||
PlayerTextDrawSetShadow(playerid, txtInit, 0);
|
||||
PlayerTextDrawSetOutline(playerid, txtInit, 1);
|
||||
PlayerTextDrawColor(playerid, txtInit, 0xACCBF1FF);
|
||||
PlayerTextDrawShow(playerid, txtInit);
|
||||
return txtInit;
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
// Creates a button textdraw and returns the textdraw ID.
|
||||
|
||||
stock PlayerText:MPM_CreatePlayerDialogButton(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height, button_text[])
|
||||
{
|
||||
new PlayerText:txtInit;
|
||||
txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, button_text);
|
||||
PlayerTextDrawUseBox(playerid, txtInit, 1);
|
||||
PlayerTextDrawBoxColor(playerid, txtInit, 0x000000FF);
|
||||
PlayerTextDrawBackgroundColor(playerid, txtInit, 0x000000FF);
|
||||
PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1);
|
||||
PlayerTextDrawFont(playerid, txtInit, 1);
|
||||
PlayerTextDrawSetShadow(playerid, txtInit, 0); // no shadow
|
||||
PlayerTextDrawSetOutline(playerid, txtInit, 0);
|
||||
PlayerTextDrawColor(playerid, txtInit, 0x4A5A6BFF);
|
||||
PlayerTextDrawSetSelectable(playerid, txtInit, 1);
|
||||
PlayerTextDrawAlignment(playerid, txtInit, 2);
|
||||
PlayerTextDrawTextSize(playerid, txtInit, Height, Width); // The width and height are reversed for centering.. something the game does <g>
|
||||
PlayerTextDrawShow(playerid, txtInit);
|
||||
return txtInit;
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
stock PlayerText:MPM_CreatePlayerHeaderTextDraw(playerid, Float:Xpos, Float:Ypos, header_text[])
|
||||
{
|
||||
new PlayerText:txtInit;
|
||||
txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, header_text);
|
||||
PlayerTextDrawUseBox(playerid, txtInit, 0);
|
||||
PlayerTextDrawLetterSize(playerid, txtInit, 1.25, 3.0);
|
||||
PlayerTextDrawFont(playerid, txtInit, 1);
|
||||
PlayerTextDrawSetShadow(playerid, txtInit, 0);
|
||||
PlayerTextDrawSetOutline(playerid, txtInit, 1);
|
||||
PlayerTextDrawColor(playerid, txtInit, 0xACCBF1FF);
|
||||
PlayerTextDrawShow(playerid, txtInit);
|
||||
return txtInit;
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
stock PlayerText:MPM_CreatePlayerBGTextDraw(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height, bgcolor)
|
||||
{
|
||||
new PlayerText:txtBackground = CreatePlayerTextDraw(playerid, Xpos, Ypos," ~n~"); // enough space for everyone
|
||||
PlayerTextDrawUseBox(playerid, txtBackground, 1);
|
||||
PlayerTextDrawBoxColor(playerid, txtBackground, bgcolor);
|
||||
PlayerTextDrawLetterSize(playerid, txtBackground, 5.0, 5.0);
|
||||
PlayerTextDrawFont(playerid, txtBackground, 0);
|
||||
PlayerTextDrawSetShadow(playerid, txtBackground, 0);
|
||||
PlayerTextDrawSetOutline(playerid, txtBackground, 0);
|
||||
PlayerTextDrawColor(playerid, txtBackground,0x000000FF);
|
||||
PlayerTextDrawTextSize(playerid, txtBackground, Width, Height);
|
||||
PlayerTextDrawBackgroundColor(playerid, txtBackground, bgcolor);
|
||||
PlayerTextDrawShow(playerid, txtBackground);
|
||||
return txtBackground;
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
// Creates a model preview sprite
|
||||
|
||||
stock PlayerText:MPM_CreateMPTextDraw(playerid, modelindex, Float:Xpos, Float:Ypos, Float:Xrot, Float:Yrot, Float:Zrot, Float:mZoom, Float:width, Float:height, bgcolor)
|
||||
{
|
||||
new PlayerText:txtPlayerSprite = CreatePlayerTextDraw(playerid, Xpos, Ypos, ""); // it has to be set with SetText later
|
||||
PlayerTextDrawFont(playerid, txtPlayerSprite, TEXT_DRAW_FONT_MODEL_PREVIEW);
|
||||
PlayerTextDrawColor(playerid, txtPlayerSprite, 0xFFFFFFFF);
|
||||
PlayerTextDrawBackgroundColor(playerid, txtPlayerSprite, bgcolor);
|
||||
PlayerTextDrawTextSize(playerid, txtPlayerSprite, width, height); // Text size is the Width:Height
|
||||
PlayerTextDrawSetPreviewModel(playerid, txtPlayerSprite, modelindex);
|
||||
PlayerTextDrawSetPreviewRot(playerid,txtPlayerSprite, Xrot, Yrot, Zrot, mZoom);
|
||||
PlayerTextDrawSetSelectable(playerid, txtPlayerSprite, 1);
|
||||
PlayerTextDrawShow(playerid,txtPlayerSprite);
|
||||
return txtPlayerSprite;
|
||||
}
|
||||
stock PlayerText:MPM_CreateTitle(playerid, text[], Float:Xpos, Float:Ypos,tdTitleColor)
|
||||
{
|
||||
new Float:XposF,Float:YposF;
|
||||
if(MPM_TITLE_POSITION == 1) YposF=Ypos;
|
||||
if(MPM_TITLE_POSITION == 2) YposF=Ypos+50;
|
||||
if(MPM_TITLE_ALIGNMENT == 1) XposF=Xpos;
|
||||
if(MPM_TITLE_ALIGNMENT == 2) XposF=Xpos+28;
|
||||
if(MPM_TITLE_ALIGNMENT == 3) XposF=Xpos+58;
|
||||
|
||||
new PlayerText:txtPlayerSprite = CreatePlayerTextDraw(playerid, XposF, YposF, text); // it has to be set with SetText later
|
||||
PlayerTextDrawFont(playerid, txtPlayerSprite, 1);
|
||||
PlayerTextDrawAlignment(playerid, txtPlayerSprite, MPM_TITLE_ALIGNMENT);
|
||||
if(MPM_TITLE_ALIGNMENT == 2) PlayerTextDrawTextSize(playerid, txtPlayerSprite, 50, 60);
|
||||
PlayerTextDrawLetterSize(playerid, txtPlayerSprite, 0.35, 1.1);
|
||||
PlayerTextDrawColor(playerid, txtPlayerSprite, tdTitleColor);
|
||||
PlayerTextDrawSetShadow(playerid,txtPlayerSprite,0);
|
||||
PlayerTextDrawSetOutline(playerid,txtPlayerSprite,1);
|
||||
PlayerTextDrawBackgroundColor(playerid,txtPlayerSprite ,0x000000FF);
|
||||
PlayerTextDrawShow(playerid,txtPlayerSprite);
|
||||
return txtPlayerSprite;
|
||||
}
|
||||
//------------------------------------------------
|
||||
|
||||
stock MPM_DestroyPlayerMPs(playerid)
|
||||
{
|
||||
new x=0;
|
||||
while(x != MPM_SELECTION_ITEMS) {
|
||||
if(ItemsTD[playerid][x] != PlayerText:INVALID_TEXT_DRAW) {
|
||||
PlayerTextDrawDestroy(playerid, ItemsTD[playerid][x]);
|
||||
ItemsTD[playerid][x] = PlayerText:INVALID_TEXT_DRAW;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
for(new i=0;i<100;i++)
|
||||
{
|
||||
if(Title[playerid][i] != PlayerText:INVALID_TEXT_DRAW)
|
||||
{
|
||||
PlayerTextDrawDestroy(playerid, Title[playerid][i]);
|
||||
Title[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
stock MPM_ShowPlayerMPs(playerid)
|
||||
{
|
||||
//print("showplayermps");
|
||||
new bgcolor = GetPVarInt(playerid, "MPM_previewBGcolor");
|
||||
new x=0;
|
||||
new Float:BaseX = MPM_DIALOG_BASE_X;
|
||||
new Float:BaseY = MPM_DIALOG_BASE_Y - (MPM_SPRITE_DIM_Y * 0.33); // down a bit
|
||||
new linetracker = 0;
|
||||
new itemid = 0;
|
||||
|
||||
new MPM_listID = MPM_GetPlayerCurrentListID(playerid);
|
||||
if(MPM_listID == MPM_DYNAMIC_LISTID)
|
||||
{
|
||||
//print("dynamic");
|
||||
new itemat = (GetPVarInt(playerid, "MPM_list_page") * MPM_SELECTION_ITEMS);
|
||||
new Float:rotzoom[4];
|
||||
rotzoom[0] = GetPVarFloat(playerid, "MPM_DYNAMIC_Xrot");
|
||||
rotzoom[1] = GetPVarFloat(playerid, "MPM_DYNAMIC_Yrot");
|
||||
rotzoom[2] = GetPVarFloat(playerid, "MPM_DYNAMIC_Zrot");
|
||||
rotzoom[3] = GetPVarFloat(playerid, "MPM_DYNAMIC_Zoom");
|
||||
new itemamount = MPM_GetAmountOfListItemsEx(playerid);
|
||||
// Destroy any previous ones created
|
||||
MPM_DestroyPlayerMPs(playerid);
|
||||
|
||||
while(x != MPM_SELECTION_ITEMS && itemat < (itemamount)) {
|
||||
if(linetracker == 0) {
|
||||
BaseX = MPM_DIALOG_BASE_X + 25.0; // in a bit from the box
|
||||
BaseY += MPM_SPRITE_DIM_Y + 1.0; // move on the Y for the next line
|
||||
}
|
||||
ItemsTD[playerid][x] = MPM_CreateMPTextDraw(playerid, DynamicList[playerid][itemat], BaseX, BaseY, rotzoom[0], rotzoom[1], rotzoom[2], rotzoom[3], MPM_SPRITE_DIM_X, MPM_SPRITE_DIM_Y, bgcolor);
|
||||
PreviewItemModel[playerid][x] = DynamicList[playerid][itemat];
|
||||
ItemID[playerid][x] = itemid;
|
||||
BaseX += MPM_SPRITE_DIM_X + 1.0; // move on the X for the next sprite
|
||||
linetracker++;
|
||||
itemid++;
|
||||
if(linetracker == MPM_ITEMS_PER_LINE) linetracker = 0;
|
||||
itemat++;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
if(MPM_listID == MPM_COLOR_LISTID)
|
||||
{
|
||||
//print("color");
|
||||
new itemat = (GetPVarInt(playerid, "MPM_list_page") * MPM_SELECTION_ITEMS);
|
||||
new itemamount = MPM_GetAmountOfListItemsEx2(playerid);
|
||||
// Destroy any previous ones created
|
||||
MPM_DestroyPlayerMPs(playerid);
|
||||
//printf("x=%d != 21, itemat=%d < itemamount=%d",x,itemat,itemamount);
|
||||
while(x != MPM_SELECTION_ITEMS && itemat < (itemamount)) {
|
||||
if(linetracker == 0) {
|
||||
BaseX = MPM_DIALOG_BASE_X + 25.0; // in a bit from the box
|
||||
BaseY += MPM_SPRITE_DIM_Y + 1.0; // move on the Y for the next line
|
||||
}
|
||||
//printf("creating mp number %d, and something is %d",x,itemat);
|
||||
ItemsTD[playerid][x] = MPM_CreateMPTextDraw(playerid, 19300, BaseX, BaseY, 0, 0, 0, 0, MPM_SPRITE_DIM_X, MPM_SPRITE_DIM_Y, MPM_previewBGcolor[playerid][x]);
|
||||
PreviewItemModel[playerid][x] = ColorList[playerid][itemat];
|
||||
ItemID[playerid][x] = itemid;
|
||||
BaseX += MPM_SPRITE_DIM_X + 1.0; // move on the X for the next sprite
|
||||
linetracker++;
|
||||
itemid++;
|
||||
if(linetracker == MPM_ITEMS_PER_LINE) linetracker = 0;
|
||||
itemat++;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
if(MPM_listID != MPM_COLOR_LISTID && MPM_listID != MPM_DYNAMIC_LISTID)
|
||||
{
|
||||
//print("not color and not dynamic");
|
||||
new itemat = (All_Lists[MPM_listID][MPM_LIST_START] + (GetPVarInt(playerid, "MPM_list_page") * MPM_SELECTION_ITEMS));
|
||||
|
||||
// Destroy any previous ones created
|
||||
MPM_DestroyPlayerMPs(playerid);
|
||||
|
||||
while(x != MPM_SELECTION_ITEMS && itemat < (All_Lists[MPM_listID][MPM_LIST_END]+1)) {
|
||||
if(linetracker == 0) {
|
||||
BaseX = MPM_DIALOG_BASE_X + 25.0; // in a bit from the box
|
||||
BaseY += MPM_SPRITE_DIM_Y + 1.0; // move on the Y for the next line
|
||||
}
|
||||
new rzID = All_Items[itemat][MPM_ITEM_ROT_ZOOM_ID]; // avoid long line
|
||||
if(rzID > -1) ItemsTD[playerid][x] = MPM_CreateMPTextDraw(playerid, All_Items[itemat][MPM_ITEM_MODEL], BaseX, BaseY, RotZoomInfo[rzID][0], RotZoomInfo[rzID][1], RotZoomInfo[rzID][2], RotZoomInfo[rzID][3], MPM_SPRITE_DIM_X, MPM_SPRITE_DIM_Y, bgcolor);
|
||||
else ItemsTD[playerid][x] = MPM_CreateMPTextDraw(playerid, All_Items[itemat][MPM_ITEM_MODEL], BaseX, BaseY, 0.0, 0.0, 0.0, 1.0, MPM_SPRITE_DIM_X, MPM_SPRITE_DIM_Y, bgcolor);
|
||||
PreviewItemModel[playerid][x] = All_Items[itemat][MPM_ITEM_MODEL];
|
||||
ItemID[playerid][x] = itemid;
|
||||
BaseX += MPM_SPRITE_DIM_X + 1.0; // move on the X for the next sprite
|
||||
linetracker++;
|
||||
itemid++;
|
||||
if(linetracker == MPM_ITEMS_PER_LINE) linetracker = 0;
|
||||
itemat++;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
stock MPM_UpdatePageTextDraw(playerid)
|
||||
{
|
||||
new PageText[64+1];
|
||||
new listID = MPM_GetPlayerCurrentListID(playerid);
|
||||
if(listID == MPM_DYNAMIC_LISTID || listID == MPM_COLOR_LISTID)
|
||||
{
|
||||
format(PageText, 64, "%d/%d", GetPVarInt(playerid,"MPM_list_page") + 1, MPM_GetPagesAmountEx(playerid));
|
||||
PlayerTextDrawSetString(playerid, CurrentPageTextDraw[playerid], PageText);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
format(PageText, 64, "%d/%d", GetPVarInt(playerid,"MPM_list_page") + 1, MPM_GetPagesAmount(listID));
|
||||
PlayerTextDrawSetString(playerid, CurrentPageTextDraw[playerid], PageText);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
stock ShowMPMenu(playerid, ListID, header_text[], titles_array[][],titles_amount = 0, dialogBGcolor = 0x34c924BB, previewBGcolor = 0xBEF57499 , tdSelectionColor = 0xCCFF00AA, tdTitleColor = 0xcd5700AA)
|
||||
{
|
||||
if(!(0 <= ListID < MPM_TOTAL_LISTS && All_Lists[ListID][MPM_LIST_START] != All_Lists[ListID][MPM_LIST_END])) return 0;
|
||||
MPM_DestroySelectionMenu(playerid);
|
||||
SetPVarInt(playerid, "MPM_list_page", 0);
|
||||
SetPVarInt(playerid, "MPM_list_id", ListID);
|
||||
SetPVarInt(playerid, "MPM_list_active", 1);
|
||||
SetPVarInt(playerid, "MPM_list_time", GetTickCount());
|
||||
|
||||
BackgroundTextDraw[playerid] = MPM_CreatePlayerBGTextDraw(playerid, MPM_DIALOG_BASE_X, MPM_DIALOG_BASE_Y + 20.0, MPM_DIALOG_WIDTH, MPM_DIALOG_HEIGHT, dialogBGcolor);
|
||||
HeaderTextDraw[playerid] = MPM_CreatePlayerHeaderTextDraw(playerid, MPM_DIALOG_BASE_X, MPM_DIALOG_BASE_Y, header_text);
|
||||
CurrentPageTextDraw[playerid] = MPM_CreateCurrentPageTextDraw(playerid, MPM_DIALOG_WIDTH - 30.0, MPM_DIALOG_BASE_Y + 15.0);
|
||||
NextButtonTextDraw[playerid] = MPM_CreatePlayerDialogButton(playerid, MPM_DIALOG_WIDTH - 30.0, MPM_DIALOG_BASE_Y+MPM_DIALOG_HEIGHT+100.0, 50.0, 16.0, MPM_NEXT_BUTTON);
|
||||
PrevButtonTextDraw[playerid] = MPM_CreatePlayerDialogButton(playerid, MPM_DIALOG_WIDTH - 90.0, MPM_DIALOG_BASE_Y+MPM_DIALOG_HEIGHT+100.0, 50.0, 16.0, MPM_BACK_BUTTON);
|
||||
CancelButtonTextDraw[playerid] = MPM_CreatePlayerDialogButton(playerid, MPM_DIALOG_WIDTH - 440.0, MPM_DIALOG_BASE_Y+MPM_DIALOG_HEIGHT+100.0, 50.0, 16.0, MPM_EXIT_BUTTON);
|
||||
|
||||
SetPVarInt(playerid, "MPM_previewBGcolor", previewBGcolor);
|
||||
MPM_ShowPlayerMPs(playerid);
|
||||
MPM_UpdatePageTextDraw(playerid);
|
||||
if(titles_amount >21)
|
||||
{
|
||||
print("-MPM system- WARNING: Too many titles given to \"ShowMPMenu\", Max titles: 21. This cannot be changed");
|
||||
titles_amount=21;
|
||||
}
|
||||
if(titles_amount !=0)
|
||||
{
|
||||
new linetracker=0;
|
||||
new Float:BaseX = MPM_DIALOG_BASE_X;
|
||||
new Float:BaseY = MPM_DIALOG_BASE_Y - (MPM_SPRITE_DIM_Y * 0.33); // down a bit
|
||||
for(new i=0;i<titles_amount;i++)
|
||||
{
|
||||
if(linetracker == 0) {
|
||||
BaseX = MPM_DIALOG_BASE_X + 25.0; // in a bit from the box
|
||||
BaseY += MPM_SPRITE_DIM_Y + 1.0; // move on the Y for the next line
|
||||
}
|
||||
Title[playerid][i] = MPM_CreateTitle(playerid, titles_array[i], BaseX, BaseY,tdTitleColor);
|
||||
BaseX += MPM_SPRITE_DIM_X + 1.0; // move on the X for the next sprite
|
||||
linetracker++;
|
||||
if(linetracker == MPM_ITEMS_PER_LINE) linetracker = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(new i=0;i<100;i++)
|
||||
{
|
||||
|
||||
Title[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
|
||||
}
|
||||
}
|
||||
SelectTextDraw(playerid, tdSelectionColor);
|
||||
return 1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
stock ShowDynamicMPMenu(playerid, items_array[], item_amount, header_text[], extraid, Float:Xrot = 0.0, Float:Yrot = 0.0, Float:Zrot = 0.0, Float:mZoom = 1.0, titles_array[][], dialogBGcolor = 0x34c924BB, previewBGcolor = 0xBEF57499, tdSelectionColor = 0xCCFF00AA,tdTitleColor = 0xcd5700AA)
|
||||
{ MPM_DestroySelectionMenu(playerid);
|
||||
if(item_amount > MPM_DYNAMIC_MAX_ITEMS)
|
||||
{
|
||||
item_amount = MPM_DYNAMIC_MAX_ITEMS;
|
||||
print("-MPM system- WARNING: Too many items given to \"ShowDynamicMPMenu\", increase \"MPM_DYNAMIC_MAX_ITEMS\" to fix this");
|
||||
}
|
||||
if(item_amount > 0)
|
||||
{
|
||||
for(new i=0;i<item_amount;i++)
|
||||
{
|
||||
DynamicList[playerid][i] = items_array[i];
|
||||
}
|
||||
SetPVarInt(playerid, "MPM_list_page", 0);
|
||||
SetPVarInt(playerid, "MPM_list_id", MPM_DYNAMIC_LISTID);
|
||||
SetPVarInt(playerid, "MPM_list_active", 1);
|
||||
SetPVarInt(playerid, "MPM_list_time", GetTickCount());
|
||||
|
||||
SetPVarInt(playerid, "MPM_DYNAMIC_item_amount", item_amount);
|
||||
SetPVarFloat(playerid, "MPM_DYNAMIC_Xrot", Xrot);
|
||||
SetPVarFloat(playerid, "MPM_DYNAMIC_Yrot", Yrot);
|
||||
SetPVarFloat(playerid, "MPM_DYNAMIC_Zrot", Zrot);
|
||||
SetPVarFloat(playerid, "MPM_DYNAMIC_Zoom", mZoom);
|
||||
SetPVarInt(playerid, "MPM_DYNAMIC_extraid", extraid);
|
||||
|
||||
|
||||
BackgroundTextDraw[playerid] = MPM_CreatePlayerBGTextDraw(playerid, MPM_DIALOG_BASE_X, MPM_DIALOG_BASE_Y + 20.0, MPM_DIALOG_WIDTH, MPM_DIALOG_HEIGHT, dialogBGcolor);
|
||||
HeaderTextDraw[playerid] = MPM_CreatePlayerHeaderTextDraw(playerid, MPM_DIALOG_BASE_X, MPM_DIALOG_BASE_Y, header_text);
|
||||
CurrentPageTextDraw[playerid] = MPM_CreateCurrentPageTextDraw(playerid, MPM_DIALOG_WIDTH - 30.0, MPM_DIALOG_BASE_Y + 15.0);
|
||||
NextButtonTextDraw[playerid] = MPM_CreatePlayerDialogButton(playerid, MPM_DIALOG_WIDTH - 30.0, MPM_DIALOG_BASE_Y+MPM_DIALOG_HEIGHT+100.0, 50.0, 16.0, MPM_NEXT_BUTTON);
|
||||
PrevButtonTextDraw[playerid] = MPM_CreatePlayerDialogButton(playerid, MPM_DIALOG_WIDTH - 90.0, MPM_DIALOG_BASE_Y+MPM_DIALOG_HEIGHT+100.0, 50.0, 16.0, MPM_BACK_BUTTON);
|
||||
CancelButtonTextDraw[playerid] = MPM_CreatePlayerDialogButton(playerid, MPM_DIALOG_WIDTH - 440.0, MPM_DIALOG_BASE_Y+MPM_DIALOG_HEIGHT+100.0, 50.0, 16.0, MPM_EXIT_BUTTON);
|
||||
|
||||
SetPVarInt(playerid, "MPM_previewBGcolor", previewBGcolor);
|
||||
MPM_ShowPlayerMPs(playerid);
|
||||
MPM_UpdatePageTextDraw(playerid);
|
||||
if(item_amount !=0 && strcmp(titles_array[0], NO_TITLES[0])!=0)
|
||||
{
|
||||
new linetracker=0;
|
||||
new Float:BaseX = MPM_DIALOG_BASE_X;
|
||||
new Float:BaseY = MPM_DIALOG_BASE_Y - (MPM_SPRITE_DIM_Y * 0.33); // down a bit
|
||||
for(new i=0;i<item_amount;i++)
|
||||
{
|
||||
if(linetracker == 0) {
|
||||
BaseX = MPM_DIALOG_BASE_X + 25.0; // in a bit from the box
|
||||
BaseY += MPM_SPRITE_DIM_Y + 1.0; // move on the Y for the next line
|
||||
}
|
||||
Title[playerid][i] = MPM_CreateTitle(playerid, titles_array[i], BaseX, BaseY,tdTitleColor);
|
||||
BaseX += MPM_SPRITE_DIM_X + 1.0; // move on the X for the next sprite
|
||||
linetracker++;
|
||||
if(linetracker == MPM_ITEMS_PER_LINE) linetracker = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(new i=0;i<100;i++)
|
||||
{
|
||||
|
||||
Title[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
|
||||
}
|
||||
}
|
||||
SelectTextDraw(playerid, tdSelectionColor);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
stock ShowColorMPMenu(playerid, items_array[], item_amount, header_text[], extraid, titles_array[][], dialogBGcolor = 0x34c924BB, previewBGcolor = 0xBEF57499, tdSelectionColor = 0xCCFF00AA,tdTitleColor = 0xcd5700AA)
|
||||
{ MPM_DestroySelectionMenu(playerid);
|
||||
if(item_amount > MPM_DYNAMIC_MAX_ITEMS)
|
||||
{
|
||||
item_amount = MPM_DYNAMIC_MAX_ITEMS;
|
||||
print("-MPM system- WARNING: Too many items given to \"ShowColorMPMenu\", increase \"MPM_COLOR_MAX_ITEMS\" to fix this");
|
||||
}
|
||||
if(item_amount > 0)
|
||||
{
|
||||
for(new i=0;i<item_amount;i++)
|
||||
{
|
||||
ColorList[playerid][i] = items_array[i];
|
||||
}
|
||||
SetPVarInt(playerid, "MPM_list_page", 0);
|
||||
SetPVarInt(playerid, "MPM_list_id", MPM_COLOR_LISTID);
|
||||
SetPVarInt(playerid, "MPM_list_active", 1);
|
||||
SetPVarInt(playerid, "MPM_list_time", GetTickCount());
|
||||
|
||||
SetPVarInt(playerid, "MPM_COLOR_item_amount", item_amount);
|
||||
SetPVarInt(playerid, "MPM_COLOR_extraid", extraid);
|
||||
|
||||
|
||||
BackgroundTextDraw[playerid] = MPM_CreatePlayerBGTextDraw(playerid, MPM_DIALOG_BASE_X, MPM_DIALOG_BASE_Y + 20.0, MPM_DIALOG_WIDTH, MPM_DIALOG_HEIGHT, dialogBGcolor);
|
||||
HeaderTextDraw[playerid] = MPM_CreatePlayerHeaderTextDraw(playerid, MPM_DIALOG_BASE_X, MPM_DIALOG_BASE_Y, header_text);
|
||||
CurrentPageTextDraw[playerid] = MPM_CreateCurrentPageTextDraw(playerid, MPM_DIALOG_WIDTH - 30.0, MPM_DIALOG_BASE_Y + 15.0);
|
||||
NextButtonTextDraw[playerid] = MPM_CreatePlayerDialogButton(playerid, MPM_DIALOG_WIDTH - 30.0, MPM_DIALOG_BASE_Y+MPM_DIALOG_HEIGHT+100.0, 50.0, 16.0, MPM_NEXT_BUTTON);
|
||||
PrevButtonTextDraw[playerid] = MPM_CreatePlayerDialogButton(playerid, MPM_DIALOG_WIDTH - 90.0, MPM_DIALOG_BASE_Y+MPM_DIALOG_HEIGHT+100.0, 50.0, 16.0, MPM_BACK_BUTTON);
|
||||
CancelButtonTextDraw[playerid] = MPM_CreatePlayerDialogButton(playerid, MPM_DIALOG_WIDTH - 440.0, MPM_DIALOG_BASE_Y+MPM_DIALOG_HEIGHT+100.0, 50.0, 16.0, MPM_EXIT_BUTTON);
|
||||
|
||||
for(new i=0;i<item_amount;i++)
|
||||
{
|
||||
MPM_previewBGcolor[playerid][i]=items_array[i];
|
||||
}
|
||||
for(new i=item_amount;i<100;i++)
|
||||
{
|
||||
MPM_previewBGcolor[playerid][i]=previewBGcolor;
|
||||
}
|
||||
MPM_ShowPlayerMPs(playerid);
|
||||
MPM_UpdatePageTextDraw(playerid);
|
||||
if(item_amount !=0 && strcmp(titles_array[0], NO_TITLES[0])!=0)
|
||||
{
|
||||
new linetracker=0;
|
||||
new Float:BaseX = MPM_DIALOG_BASE_X;
|
||||
new Float:BaseY = MPM_DIALOG_BASE_Y - (MPM_SPRITE_DIM_Y * 0.33); // down a bit
|
||||
for(new i=0;i<item_amount;i++)
|
||||
{
|
||||
if(linetracker == 0) {
|
||||
BaseX = MPM_DIALOG_BASE_X + 25.0; // in a bit from the box
|
||||
BaseY += MPM_SPRITE_DIM_Y + 1.0; // move on the Y for the next line
|
||||
}
|
||||
Title[playerid][i] = MPM_CreateTitle(playerid, titles_array[i], BaseX, BaseY,tdTitleColor);
|
||||
BaseX += MPM_SPRITE_DIM_X + 1.0; // move on the X for the next sprite
|
||||
linetracker++;
|
||||
if(linetracker == MPM_ITEMS_PER_LINE) linetracker = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(new i=0;i<100;i++)
|
||||
{
|
||||
|
||||
Title[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
|
||||
}
|
||||
}
|
||||
SelectTextDraw(playerid, tdSelectionColor);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
stock HideMPMenu(playerid)
|
||||
{
|
||||
MPM_DestroySelectionMenu(playerid);
|
||||
SetPVarInt(playerid, "MPM_ignore_next_esc", 1);
|
||||
CancelSelectTextDraw(playerid);
|
||||
return 1;
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
stock MPM_DestroySelectionMenu(playerid)
|
||||
{
|
||||
if(GetPVarInt(playerid, "MPM_list_active") == 1)
|
||||
{
|
||||
if(MPM_GetPlayerCurrentListID(playerid) == MPM_DYNAMIC_LISTID)
|
||||
{
|
||||
DeletePVar(playerid, "MPM_DYNAMIC_Xrot");
|
||||
DeletePVar(playerid, "MPM_DYNAMIC_Yrot");
|
||||
DeletePVar(playerid, "MPM_DYNAMIC_Zrot");
|
||||
DeletePVar(playerid, "MPM_DYNAMIC_Zoom");
|
||||
DeletePVar(playerid, "MPM_DYNAMIC_extraid");
|
||||
DeletePVar(playerid, "MPM_DYNAMIC_item_amount");
|
||||
}
|
||||
if(MPM_GetPlayerCurrentListID(playerid) == MPM_COLOR_LISTID)
|
||||
{
|
||||
DeletePVar(playerid, "MPM_COLOR_extraid");
|
||||
DeletePVar(playerid, "MPM_COLOR_item_amount");
|
||||
}
|
||||
DeletePVar(playerid, "MPM_list_time");
|
||||
SetPVarInt(playerid, "MPM_list_active", 0);
|
||||
MPM_DestroyPlayerMPs(playerid);
|
||||
|
||||
PlayerTextDrawDestroy(playerid, HeaderTextDraw[playerid]);
|
||||
PlayerTextDrawDestroy(playerid, BackgroundTextDraw[playerid]);
|
||||
PlayerTextDrawDestroy(playerid, CurrentPageTextDraw[playerid]);
|
||||
PlayerTextDrawDestroy(playerid, NextButtonTextDraw[playerid]);
|
||||
PlayerTextDrawDestroy(playerid, PrevButtonTextDraw[playerid]);
|
||||
PlayerTextDrawDestroy(playerid, CancelButtonTextDraw[playerid]);
|
||||
|
||||
HeaderTextDraw[playerid] = PlayerText:INVALID_TEXT_DRAW;
|
||||
BackgroundTextDraw[playerid] = PlayerText:INVALID_TEXT_DRAW;
|
||||
CurrentPageTextDraw[playerid] = PlayerText:INVALID_TEXT_DRAW;
|
||||
NextButtonTextDraw[playerid] = PlayerText:INVALID_TEXT_DRAW;
|
||||
PrevButtonTextDraw[playerid] = PlayerText:INVALID_TEXT_DRAW;
|
||||
CancelButtonTextDraw[playerid] = PlayerText:INVALID_TEXT_DRAW;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
public OnPlayerConnect(playerid)
|
||||
{
|
||||
// Init all of the textdraw related globals
|
||||
HeaderTextDraw[playerid] = PlayerText:INVALID_TEXT_DRAW;
|
||||
BackgroundTextDraw[playerid] = PlayerText:INVALID_TEXT_DRAW;
|
||||
CurrentPageTextDraw[playerid] = PlayerText:INVALID_TEXT_DRAW;
|
||||
NextButtonTextDraw[playerid] = PlayerText:INVALID_TEXT_DRAW;
|
||||
PrevButtonTextDraw[playerid] = PlayerText:INVALID_TEXT_DRAW;
|
||||
CancelButtonTextDraw[playerid] = PlayerText:INVALID_TEXT_DRAW;
|
||||
for(new x=0; x < 100; x++) {
|
||||
Title[playerid][x] = PlayerText:INVALID_TEXT_DRAW;
|
||||
}
|
||||
|
||||
for(new x=0; x < MPM_SELECTION_ITEMS; x++) {
|
||||
ItemsTD[playerid][x] = PlayerText:INVALID_TEXT_DRAW;
|
||||
}
|
||||
|
||||
globalItemAt[playerid] = 0;
|
||||
|
||||
return CallLocalFunction("MP_OPC", "i", playerid);
|
||||
}
|
||||
|
||||
#if defined _ALS_OnPlayerConnect
|
||||
#undef OnPlayerConnect
|
||||
#else
|
||||
#define _ALS_OnPlayerConnect
|
||||
#endif
|
||||
#define OnPlayerConnect MP_OPC
|
||||
|
||||
forward MP_OPC(playerid);
|
||||
|
||||
//-------------------------------------------
|
||||
// Even though only Player* textdraws are used in this script,
|
||||
// OnPlayerClickTextDraw is still required to handle ESC
|
||||
|
||||
public OnPlayerClickTextDraw(playerid, Text:clickedid)
|
||||
{
|
||||
if(GetPVarInt(playerid, "MPM_ignore_next_esc") == 1) {
|
||||
SetPVarInt(playerid, "MPM_ignore_next_esc", 0);
|
||||
return CallLocalFunction("MP_OPCTD", "ii", playerid, _:clickedid);
|
||||
}
|
||||
if(GetPVarInt(playerid, "MPM_list_active") == 0) return CallLocalFunction("MP_OPCTD", "ii", playerid, _:clickedid);
|
||||
|
||||
// Handle: They cancelled (with ESC)
|
||||
if(clickedid == Text:INVALID_TEXT_DRAW) {
|
||||
new listid = MPM_GetPlayerCurrentListID(playerid);
|
||||
if(listid == MPM_DYNAMIC_LISTID)
|
||||
{
|
||||
new extraid = GetPVarInt(playerid, "MPM_DYNAMIC_extraid");
|
||||
MPM_DestroySelectionMenu(playerid);
|
||||
CallLocalFunction("OnDynamicMPMenuResponse", "dddd", playerid, 0, extraid, -1,-1);
|
||||
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
|
||||
}
|
||||
if(listid == MPM_COLOR_LISTID)
|
||||
{
|
||||
new extraid = GetPVarInt(playerid, "MPM_COLOR_extraid");
|
||||
MPM_DestroySelectionMenu(playerid);
|
||||
CallLocalFunction("OnDynamicMPMenuResponse", "dddd", playerid, 0, extraid, -1,-1);
|
||||
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
|
||||
}
|
||||
if(listid != MPM_COLOR_LISTID && listid != MPM_DYNAMIC_LISTID)
|
||||
{
|
||||
MPM_DestroySelectionMenu(playerid);
|
||||
CallLocalFunction("OnMPMenuResponse", "dddd", playerid, 0, listid, -1,-1);
|
||||
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
return CallLocalFunction("MP_OPCTD", "ii", playerid, _:clickedid);
|
||||
}
|
||||
|
||||
#if defined _ALS_OnPlayerClickTextDraw
|
||||
#undef OnPlayerClickTextDraw
|
||||
#else
|
||||
#define _ALS_OnPlayerClickTextDraw
|
||||
#endif
|
||||
#define OnPlayerClickTextDraw MP_OPCTD
|
||||
|
||||
forward MP_OPCTD(playerid, Text:clickedid);
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
|
||||
{
|
||||
if(GetPVarInt(playerid, "MPM_list_active") == 0 || (GetTickCount()-GetPVarInt(playerid, "MPM_list_time")) < 200 /* Disable instant selection */) return CallLocalFunction("MP_OPCPTD", "ii", playerid, _:playertextid);
|
||||
|
||||
new curpage = GetPVarInt(playerid, "MPM_list_page");
|
||||
|
||||
// Handle: cancel button
|
||||
if(playertextid == CancelButtonTextDraw[playerid]) {
|
||||
new listID = MPM_GetPlayerCurrentListID(playerid);
|
||||
if(listID == MPM_DYNAMIC_LISTID)
|
||||
{
|
||||
new extraid = GetPVarInt(playerid, "MPM_DYNAMIC_extraid");
|
||||
HideMPMenu(playerid);
|
||||
CallLocalFunction("OnDynamicMPMenuResponse", "dddd", playerid, 0, extraid, -1,-1);
|
||||
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
|
||||
}
|
||||
if(listID == MPM_COLOR_LISTID)
|
||||
{
|
||||
new extraid = GetPVarInt(playerid, "MPM_COLOR_extraid");
|
||||
HideMPMenu(playerid);
|
||||
CallLocalFunction("OnDynamicMPMenuResponse", "dddd", playerid, 0, extraid, -1,-1);
|
||||
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
|
||||
}
|
||||
if(listID != MPM_COLOR_LISTID && listID != MPM_DYNAMIC_LISTID)
|
||||
{
|
||||
HideMPMenu(playerid);
|
||||
CallLocalFunction("OnMPMenuResponse", "dddd", playerid, 0, listID, -1,-1);
|
||||
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Handle: next button
|
||||
if(playertextid == NextButtonTextDraw[playerid]) {
|
||||
new listID = MPM_GetPlayerCurrentListID(playerid);
|
||||
if(listID == MPM_DYNAMIC_LISTID)
|
||||
{
|
||||
if(curpage < (MPM_GetPagesAmountEx(playerid) - 1)) {
|
||||
SetPVarInt(playerid, "MPM_list_page", curpage + 1);
|
||||
MPM_ShowPlayerMPs(playerid);
|
||||
MPM_UpdatePageTextDraw(playerid);
|
||||
PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
|
||||
} else {
|
||||
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(curpage < (MPM_GetPagesAmount(listID) - 1)) {
|
||||
SetPVarInt(playerid, "MPM_list_page", curpage + 1);
|
||||
MPM_ShowPlayerMPs(playerid);
|
||||
MPM_UpdatePageTextDraw(playerid);
|
||||
PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
|
||||
} else {
|
||||
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Handle: previous button
|
||||
if(playertextid == PrevButtonTextDraw[playerid]) {
|
||||
if(curpage > 0) {
|
||||
SetPVarInt(playerid, "MPM_list_page", curpage - 1);
|
||||
MPM_ShowPlayerMPs(playerid);
|
||||
MPM_UpdatePageTextDraw(playerid);
|
||||
PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0);
|
||||
} else {
|
||||
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Search in the array of textdraws used for the items
|
||||
new x=0;
|
||||
while(x != MPM_SELECTION_ITEMS) {
|
||||
if(playertextid == ItemsTD[playerid][x]) {
|
||||
new listID = MPM_GetPlayerCurrentListID(playerid);
|
||||
if(listID == MPM_DYNAMIC_LISTID)
|
||||
{
|
||||
PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
|
||||
new item_id = PreviewItemModel[playerid][x];
|
||||
new item_id2 = ItemID[playerid][x];
|
||||
new extraid = GetPVarInt(playerid, "MPM_DYNAMIC_extraid");
|
||||
HideMPMenu(playerid);
|
||||
CallLocalFunction("OnDynamicMPMenuResponse", "ddddd", playerid, 1, extraid, item_id, item_id2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
if(listID == MPM_COLOR_LISTID)
|
||||
{
|
||||
PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
|
||||
new item_id = PreviewItemModel[playerid][x];
|
||||
new item_id2 = ItemID[playerid][x];
|
||||
new extraid = GetPVarInt(playerid, "MPM_COLOR_extraid");
|
||||
HideMPMenu(playerid);
|
||||
CallLocalFunction("OnDynamicMPMenuResponse", "ddddd", playerid, 1, extraid, item_id, item_id2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
if(listID != MPM_COLOR_LISTID && listID != MPM_DYNAMIC_LISTID)
|
||||
{
|
||||
PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
|
||||
new item_id = PreviewItemModel[playerid][x];
|
||||
new item_id2 = ItemID[playerid][x];
|
||||
HideMPMenu(playerid);
|
||||
CallLocalFunction("OnMPMenuResponse", "ddddd", playerid, 1, listID, item_id, item_id2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
x++;
|
||||
}
|
||||
|
||||
return CallLocalFunction("MP_OPCPTD", "ii", playerid, _:playertextid);
|
||||
}
|
||||
|
||||
#if defined _ALS_OnPlayerClickPlayerTD
|
||||
#undef OnPlayerClickPlayerTextDraw
|
||||
#else
|
||||
#define _ALS_OnPlayerClickPlayerTD
|
||||
#endif
|
||||
#define OnPlayerClickPlayerTextDraw MP_OPCPTD
|
||||
|
||||
forward MP_OPCPTD(playerid, PlayerText:playertextid);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
|
||||
stock LoadMPMenu(f_name[])
|
||||
{
|
||||
new File:f, str[75];
|
||||
format(str, sizeof(str), "%s", f_name);
|
||||
f = fopen(str, io_read);
|
||||
if( !f ) {
|
||||
printf("-MPM system- WARNING: Failed to load list: \"%s\"", f_name);
|
||||
return MPM_INVALID_LISTID;
|
||||
}
|
||||
|
||||
if(ListAmount >= MPM_TOTAL_LISTS)
|
||||
{
|
||||
printf("-MPM system- WARNING: Reached maximum amount of lists, increase \"MPM_TOTAL_LISTS\"", f_name);
|
||||
return MPM_INVALID_LISTID;
|
||||
}
|
||||
new tmp_ItemAmount = ItemAmount; // copy value if loading fails
|
||||
|
||||
|
||||
new line[128], idxx;
|
||||
while(fread(f,line,sizeof(line),false))
|
||||
{
|
||||
if(tmp_ItemAmount >= MPM_TOTAL_ITEMS)
|
||||
{
|
||||
printf("-MPM system- WARNING: Reached maximum amount of items, increase \"MPM_TOTAL_ITEMS\"", f_name);
|
||||
break;
|
||||
}
|
||||
idxx = 0;
|
||||
if(!line[0]) continue;
|
||||
new mID = strval( MPM_strtok(line,idxx) );
|
||||
if(0 <= mID < 20000)
|
||||
{
|
||||
All_Items[tmp_ItemAmount][MPM_ITEM_MODEL] = mID;
|
||||
|
||||
new tmp_MPM_strtok[20];
|
||||
new Float:mRotation[3], Float:mZoom = 1.0;
|
||||
new bool:useRotation = false;
|
||||
|
||||
tmp_MPM_strtok = MPM_strtok(line,idxx);
|
||||
if(tmp_MPM_strtok[0]) {
|
||||
useRotation = true;
|
||||
mRotation[0] = floatstr(tmp_MPM_strtok);
|
||||
}
|
||||
tmp_MPM_strtok = MPM_strtok(line,idxx);
|
||||
if(tmp_MPM_strtok[0]) {
|
||||
useRotation = true;
|
||||
mRotation[1] = floatstr(tmp_MPM_strtok);
|
||||
}
|
||||
tmp_MPM_strtok = MPM_strtok(line,idxx);
|
||||
if(tmp_MPM_strtok[0]) {
|
||||
useRotation = true;
|
||||
mRotation[2] = floatstr(tmp_MPM_strtok);
|
||||
}
|
||||
tmp_MPM_strtok = MPM_strtok(line,idxx);
|
||||
if(tmp_MPM_strtok[0]) {
|
||||
useRotation = true;
|
||||
mZoom = floatstr(tmp_MPM_strtok);
|
||||
}
|
||||
if(useRotation)
|
||||
{
|
||||
new bool:foundRotZoom = false;
|
||||
for(new i=0; i < RotZoomInfoAmount; i++)
|
||||
{
|
||||
if(RotZoomInfo[i][0] == mRotation[0] && RotZoomInfo[i][1] == mRotation[1] && RotZoomInfo[i][2] == mRotation[2] && RotZoomInfo[i][3] == mZoom)
|
||||
{
|
||||
foundRotZoom = true;
|
||||
All_Items[tmp_ItemAmount][MPM_ITEM_ROT_ZOOM_ID] = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(RotZoomInfoAmount < MPM_TOTAL_ROT_ZOOM)
|
||||
{
|
||||
if(!foundRotZoom)
|
||||
{
|
||||
RotZoomInfo[RotZoomInfoAmount][0] = mRotation[0];
|
||||
RotZoomInfo[RotZoomInfoAmount][1] = mRotation[1];
|
||||
RotZoomInfo[RotZoomInfoAmount][2] = mRotation[2];
|
||||
RotZoomInfo[RotZoomInfoAmount][3] = mZoom;
|
||||
All_Items[tmp_ItemAmount][MPM_ITEM_ROT_ZOOM_ID] = RotZoomInfoAmount;
|
||||
RotZoomInfoAmount++;
|
||||
}
|
||||
}
|
||||
else print("-MPM system- WARNING: Not able to save rotation/zoom information. Reached maximum rotation/zoom information count. Increase '#define MPM_TOTAL_ROT_ZOOM' to fix the issue");
|
||||
}
|
||||
else All_Items[tmp_ItemAmount][MPM_ITEM_ROT_ZOOM_ID] = -1;
|
||||
tmp_ItemAmount++;
|
||||
}
|
||||
}
|
||||
if(tmp_ItemAmount > ItemAmount) // any models loaded ?
|
||||
{
|
||||
All_Lists[ListAmount][MPM_LIST_START] = ItemAmount;
|
||||
ItemAmount = tmp_ItemAmount; // copy back
|
||||
All_Lists[ListAmount][MPM_LIST_END] = (ItemAmount-1);
|
||||
|
||||
ListAmount++;
|
||||
return (ListAmount-1);
|
||||
}
|
||||
printf("-MPM system- WARNING: No Items found in file: %s", f_name);
|
||||
return MPM_INVALID_LISTID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
stock MPM_strtok(const string[], &index)
|
||||
{
|
||||
new length = strlen(string);
|
||||
while ((index < length) && (string[index] <= ' '))
|
||||
{
|
||||
index++;
|
||||
}
|
||||
|
||||
new offset = index;
|
||||
new result[20];
|
||||
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
|
||||
{
|
||||
result[index - offset] = string[index];
|
||||
index++;
|
||||
}
|
||||
result[index - offset] = EOS;
|
||||
return result;
|
||||
}
|
595
pawno/include/sscanf2.inc
Normal file
595
pawno/include/sscanf2.inc
Normal file
@ -0,0 +1,595 @@
|
||||
/*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* [url]http://www.mozilla.org/MPL/[/url]
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the sscanf 2.0 SA:MP plugin.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Alex "Y_Less" Cole.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Special Thanks to:
|
||||
*
|
||||
* SA:MP Team past, present and future
|
||||
*/
|
||||
|
||||
#if defined _inc_a_npc
|
||||
#pragma library sscanf
|
||||
#elseif !defined _inc_a_samp
|
||||
#error Please include <a_npc> or <a_samp> first.
|
||||
#endif
|
||||
|
||||
#define SSCANF:%0(%1) sscanf_%0(%1);public sscanf_%0(%1)
|
||||
|
||||
#if defined sscanf
|
||||
#error sscanf (possibly the PAWN version) already defined.
|
||||
#endif
|
||||
|
||||
native sscanf(const data[], const format[], {Float,_}:...);
|
||||
native unformat(const data[], const format[], {Float,_}:...) = sscanf;
|
||||
native SSCANF_Init(players, invalid, len);
|
||||
native SSCANF_Join(playerid, const name[], npc);
|
||||
native SSCANF_Leave(playerid);
|
||||
|
||||
native SSCANF_Option(const name[], value);
|
||||
|
||||
stock const
|
||||
SSCANF_QUIET[] = "SSCANF_QUIET",
|
||||
OLD_DEFAULT_NAME[] = "OLD_DEFAULT_NAME",
|
||||
MATCH_NAME_PARTIAL[] = "MATCH_NAME_PARTIAL",
|
||||
CELLMIN_ON_MATCHES[] = "CELLMIN_ON_MATCHES",
|
||||
OLD_DEFAULT_KUSTOM[] = "OLD_DEFAULT_KUSTOM",
|
||||
OLD_DEFAULT_CUSTOM[] = "OLD_DEFAULT_CUSTOM";
|
||||
|
||||
static stock
|
||||
bool:SSCANF_gInit = false,
|
||||
SSCANF_g_sPlayers[MAX_PLAYERS char];
|
||||
|
||||
#if defined _inc_a_npc
|
||||
forward SSCANF_PlayerCheck();
|
||||
|
||||
/*
|
||||
OnNPCModeInit
|
||||
|
||||
Called when the script starts if it is a NPC mode, sets up the system,
|
||||
then calls the "real" OnNPCModeInit (using the new ALS 2 hook method).
|
||||
*/
|
||||
|
||||
public OnNPCModeInit()
|
||||
{
|
||||
SSCANF_Init(MAX_PLAYERS, INVALID_PLAYER_ID, MAX_PLAYER_NAME);
|
||||
#if !defined SSCANF_NO_PLAYERS
|
||||
// Initialise the system.
|
||||
SSCANF_PlayerCheck();
|
||||
SetTimer("SSCANF_PlayerCheck", 1, 1);
|
||||
#endif
|
||||
#if defined SSCANF_OnNPCModeInit
|
||||
SSCANF_OnNPCModeInit();
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined _ALS_OnNPCModeInit
|
||||
#undef OnNPCModeInit
|
||||
#else
|
||||
#define _ALS_OnNPCModeInit
|
||||
#endif
|
||||
#define OnNPCModeInit SSCANF_OnNPCModeInit
|
||||
#if defined SSCANF_OnNPCModeInit
|
||||
forward SSCANF_OnNPCModeInit();
|
||||
#endif
|
||||
|
||||
/*
|
||||
SSCANF_PlayerCheck
|
||||
|
||||
NPC modes have no "OnPlayerConnect callback, so we need to simulate one.
|
||||
*/
|
||||
|
||||
#if !defined SSCANF_NO_PLAYERS
|
||||
public SSCANF_PlayerCheck()
|
||||
{
|
||||
for (new i = 0; i != MAX_PLAYERS; ++i)
|
||||
{
|
||||
if (IsPlayerConnected(i))
|
||||
{
|
||||
if (!SSCANF_g_sPlayers{i})
|
||||
{
|
||||
new
|
||||
name[MAX_PLAYER_NAME];
|
||||
GetPlayerName(i, name, sizeof (name));
|
||||
// We have no way to know if they are an NPC or not!
|
||||
SSCANF_Join(i, name, 0);
|
||||
SSCANF_g_sPlayers{i} = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SSCANF_g_sPlayers{i})
|
||||
{
|
||||
SSCANF_Leave(i);
|
||||
SSCANF_g_sPlayers{i} = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
/*
|
||||
OnFilterScriptInit
|
||||
|
||||
Called when the script starts if it is a filterscript, sets up the system,
|
||||
then calls the "real" OnFilterScriptInit (using the new ALS 2 hook
|
||||
method).
|
||||
*/
|
||||
|
||||
public OnFilterScriptInit()
|
||||
{
|
||||
SSCANF_Init(GetMaxPlayers(), INVALID_PLAYER_ID, MAX_PLAYER_NAME);
|
||||
SSCANF_gInit = true;
|
||||
#if defined SSCANF_OnFilterScriptInit
|
||||
SSCANF_OnFilterScriptInit();
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined _ALS_OnFilterScriptInit
|
||||
#undef OnFilterScriptInit
|
||||
#else
|
||||
#define _ALS_OnFilterScriptInit
|
||||
#endif
|
||||
#define OnFilterScriptInit SSCANF_OnFilterScriptInit
|
||||
#if defined SSCANF_OnFilterScriptInit
|
||||
forward SSCANF_OnFilterScriptInit();
|
||||
#endif
|
||||
|
||||
/*
|
||||
OnGameModeInit
|
||||
|
||||
Called when the script starts if it is a gamemode. This callback is also
|
||||
called in filterscripts so we don't want to reinitialise the system in
|
||||
that case.
|
||||
*/
|
||||
|
||||
public OnGameModeInit()
|
||||
{
|
||||
if (!SSCANF_gInit)
|
||||
{
|
||||
SSCANF_Init(GetMaxPlayers(), INVALID_PLAYER_ID, MAX_PLAYER_NAME);
|
||||
SSCANF_gInit = true;
|
||||
}
|
||||
#if defined SSCANF_OnGameModeInit
|
||||
SSCANF_OnGameModeInit();
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined _ALS_OnGameModeInit
|
||||
#undef OnGameModeInit
|
||||
#else
|
||||
#define _ALS_OnGameModeInit
|
||||
#endif
|
||||
#define OnGameModeInit SSCANF_OnGameModeInit
|
||||
#if defined SSCANF_OnGameModeInit
|
||||
forward SSCANF_OnGameModeInit();
|
||||
#endif
|
||||
|
||||
/*
|
||||
OnPlayerConnect
|
||||
|
||||
Called when a player connects. Actually increments an internal count so
|
||||
that if a script ends and "OnPlayerDisconnect" is called then "sscanf"
|
||||
still knows that the player is really connected. Also stores their name
|
||||
internally.
|
||||
*/
|
||||
|
||||
public OnPlayerConnect(playerid)
|
||||
{
|
||||
new
|
||||
name[MAX_PLAYER_NAME];
|
||||
GetPlayerName(playerid, name, sizeof (name));
|
||||
SSCANF_Join(playerid, name, IsPlayerNPC(playerid));
|
||||
#if defined SSCANF_OnPlayerConnect
|
||||
SSCANF_OnPlayerConnect(playerid);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined _ALS_OnPlayerConnect
|
||||
#undef OnPlayerConnect
|
||||
#else
|
||||
#define _ALS_OnPlayerConnect
|
||||
#endif
|
||||
#define OnPlayerConnect SSCANF_OnPlayerConnect
|
||||
#if defined SSCANF_OnPlayerConnect
|
||||
forward SSCANF_OnPlayerConnect(playerid);
|
||||
#endif
|
||||
|
||||
/*
|
||||
OnPlayerDisconnect
|
||||
|
||||
Called when a player disconnects, or when a script is ended.
|
||||
*/
|
||||
|
||||
public OnPlayerDisconnect(playerid, reason)
|
||||
{
|
||||
#if defined SSCANF_OnPlayerDisconnect
|
||||
SSCANF_OnPlayerDisconnect(playerid, reason);
|
||||
#endif
|
||||
SSCANF_Leave(playerid);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined _ALS_OnPlayerDisconnect
|
||||
#undef OnPlayerDisconnect
|
||||
#else
|
||||
#define _ALS_OnPlayerDisconnect
|
||||
#endif
|
||||
#define OnPlayerDisconnect SSCANF_OnPlayerDisconnect
|
||||
#if defined SSCANF_OnPlayerDisconnect
|
||||
forward SSCANF_OnPlayerDisconnect(playerid, reason);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define SSCANF_Init
|
||||
#define SSCANF_Join
|
||||
#define SSCANF_Leave
|
||||
|
||||
#define extract%0->%1; EXTRN%1;unformat(_:EXTRZ:EXTRV:EXTRX:%0,##,%1,,);
|
||||
#define unformat(_:EXTRZ:EXTRV:EXTRX:%0,##,%1);%2else if (unformat(_:EXTRV:EXTRX:%0,##,%1))
|
||||
|
||||
#define EXTRV:EXTRX:%0<%3>##,%9new%1,%2) EXTRY:%0##P<%3>,|||%1|||%2)
|
||||
#define EXTRX:%0##,%9new%1,%2) EXTRY:%0##,|||%1|||%2)
|
||||
#define EXTRY: EXTR8:EXTR9:EXTR0:EXTR1:EXTR2:EXTR3:EXTR4:
|
||||
|
||||
#define EXTR8:EXTR9:EXTR0:EXTR1:EXTR2:EXTR3:EXTR4:%0##%1,%2|||%6:%3=%9|||%4) %6_EXTRO:%0##%1,%2|||%3=%9|||%4)
|
||||
#define EXTR9:EXTR0:EXTR1:EXTR2:EXTR3:EXTR4:%0##%1,%2|||%3=%9|||%4) __EXTRO:%0##%1,%2|||%3=%9|||%4)
|
||||
#define EXTR0:EXTR1:EXTR2:EXTR3:EXTR4:%0##%1,%2|||%6:%3[%7]|||%4) %6_EXTRW:%0##%1,%2|||%3[%7]|||%4)
|
||||
#define EXTR1:EXTR2:EXTR3:EXTR4:%0##%1,%2|||%3[%7]|||%4) __EXTRW:%0##%1,%2|||%3|||%4)
|
||||
#define EXTR2:EXTR3:EXTR4:%0##%1,%2|||%6:%3|||%4) %6_EXTRN:%0##%1,%2|||%3|||%4)
|
||||
#define EXTR3:EXTR4:%0##%1,,%2||||||%4) %0##%1,%2)
|
||||
#define EXTR4:%0##%1,%2|||%3|||%4) __EXTRN:%0##%1,%2|||%3|||%4)
|
||||
|
||||
// Optional specifiers.
|
||||
#define __EXTRO:%0##%1,%2|||%3=%9|||%4,%5) EXTRY:%0##%1I"("#%9")"#,%2,%3|||%4|||%5)
|
||||
#define Float_EXTRO:%0##%1,%2|||%3=%9|||%4,%5) EXTRY:%0##%1F"("#%9")"#,%2,%3|||%4|||%5)
|
||||
#define player_EXTRO:%0##%1,%2|||%3=%9|||%4,%5) EXTRY:%0##%1U"("#%9")"#,%2,%3|||%4|||%5)
|
||||
#define string_EXTRO:%0##%1,%2|||%3[%7]=%9|||%4,%5) EXTRY:%0##%1S"("#%9")"#[%7],%2,%3|||%4|||%5)
|
||||
|
||||
// Normal specifiers (the double underscore is to work for "_:".
|
||||
#define __EXTRN:%0##%1,%2|||%3|||%4,%5) EXTRY:%0##%1i,%2,%3|||%4|||%5)
|
||||
#define Float_EXTRN:%0##%1,%2|||%3|||%4,%5) EXTRY:%0##%1f,%2,%3|||%4|||%5)
|
||||
#define player_EXTRN:%0##%1,%2|||%3|||%4,%5) EXTRY:%0##%1u,%2,%3|||%4|||%5)
|
||||
//#define string_EXTRW:%0##%1,%2|||%3[%7]|||%4,%5) EXTRY:%0##%1s[%7],%2,%3|||%4|||%5)
|
||||
|
||||
// Array versions of normal specifiers.
|
||||
#define __EXTRW:%0##%1,%2|||%3[%7]|||%4,%5) EXTRY:%0##%1a<i>[%7],%2,%3|||%4|||%5)
|
||||
#define Float_EXTRW:%0##%1,%2|||%3[%7]|||%4,%5) EXTRY:%0##%1a<f>[%7],%2,%3|||%4|||%5)
|
||||
#define player_EXTRW:%0##%1,%2|||%3[%7]|||%4,%5) EXTRY:%0##%1a<u>[%7],%2,%3|||%4|||%5)
|
||||
#define string_EXTRW:%0##%1,%2|||%3[%7]|||%4,%5) EXTRY:%0##%1s[%7],%2,%3|||%4|||%5)
|
||||
|
||||
// Get rid of excess leading space which causes warnings.
|
||||
#define EXTRN%0new%1; new%1;
|
||||
|
||||
#if !defined string
|
||||
#define string:
|
||||
#endif
|
||||
|
||||
#define player:
|
||||
|
||||
#define hex:
|
||||
#define hex_EXTRO:%0##%1,%2|||%3=%9|||%4,%5) EXTRY:%0##%1H"("#%9")"#,%2,%3|||%4|||%5)
|
||||
#define hex_EXTRN:%0##%1,%2|||%3|||%4,%5) EXTRY:%0##%1h,%2,%3|||%4|||%5)
|
||||
#define hex_EXTRW:%0##%1,%2|||%3[%7]|||%4,%5) EXTRY:%0##%1a<h>[%7],%2,%3|||%4|||%5)
|
||||
|
||||
#define bin:
|
||||
#define bin_EXTRO:%0##%1,%2|||%3=%9|||%4,%5) EXTRY:%0##%1B"("#%9")"#,%2,%3|||%4|||%5)
|
||||
#define bin_EXTRN:%0##%1,%2|||%3|||%4,%5) EXTRY:%0##%1b,%2,%3|||%4|||%5)
|
||||
#define bin_EXTRW:%0##%1,%2|||%3[%7]|||%4,%5) EXTRY:%0##%1a<b>[%7],%2,%3|||%4|||%5)
|
||||
|
||||
#define kustom:%0<%1> %0
|
||||
#define kustom_EXTRO:%0##%1,%2|||%3<%8>=%9|||%4,%5) EXTRY:%0##%1K<%8>"("#%9")"#,%2,%3|||%4|||%5)
|
||||
#define kustom_EXTRN:%0##%1,%2|||%3<%8>|||%4,%5) EXTRY:%0##%1k<%8>,%2,%3|||%4|||%5)
|
||||
//#define bin_EXTRW:%0##%1,%2|||%3[%7]|||%4,%5) EXTRY:%0##%1a<b>[%7],%2,%3|||%4|||%5)
|
||||
|
||||
SSCANF:weapon(string[])
|
||||
{
|
||||
// This function is VERY basic, needs VASTLY improving to detect variations.
|
||||
if ('0' <= string[0] <= '9')
|
||||
{
|
||||
new
|
||||
ret = strval(string);
|
||||
if (0 <= ret <= 18 || 22 <= ret <= 46)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(string, "Unarmed")) return 0;
|
||||
else if (!strcmp(string, "Brass Knuckles")) return 1;
|
||||
else if (!strcmp(string, "Golf Club")) return 2;
|
||||
else if (!strcmp(string, "Night Stick")) return 3;
|
||||
else if (!strcmp(string, "Knife")) return 4;
|
||||
else if (!strcmp(string, "Baseball Bat")) return 5;
|
||||
else if (!strcmp(string, "Shovel")) return 6;
|
||||
else if (!strcmp(string, "Pool cue")) return 7;
|
||||
else if (!strcmp(string, "Katana")) return 8;
|
||||
else if (!strcmp(string, "Chainsaw")) return 9;
|
||||
else if (!strcmp(string, "Purple Dildo")) return 10;
|
||||
else if (!strcmp(string, "White Dildo")) return 11;
|
||||
else if (!strcmp(string, "Long White Dildo")) return 12;
|
||||
else if (!strcmp(string, "White Dildo 2")) return 13;
|
||||
else if (!strcmp(string, "Flowers")) return 14;
|
||||
else if (!strcmp(string, "Cane")) return 15;
|
||||
else if (!strcmp(string, "Grenades")) return 16;
|
||||
else if (!strcmp(string, "Tear Gas")) return 17;
|
||||
else if (!strcmp(string, "Molotovs")) return 18;
|
||||
else if (!strcmp(string, "Pistol")) return 22;
|
||||
else if (!strcmp(string, "Silenced Pistol")) return 23;
|
||||
else if (!strcmp(string, "Desert Eagle")) return 24;
|
||||
else if (!strcmp(string, "Shotgun")) return 25;
|
||||
else if (!strcmp(string, "Sawn Off Shotgun")) return 26;
|
||||
else if (!strcmp(string, "Combat Shotgun")) return 27;
|
||||
else if (!strcmp(string, "Micro Uzi")) return 28;
|
||||
else if (!strcmp(string, "Mac 10")) return 28;
|
||||
else if (!strcmp(string, "MP5")) return 29;
|
||||
else if (!strcmp(string, "AK47")) return 30;
|
||||
else if (!strcmp(string, "M4")) return 31;
|
||||
else if (!strcmp(string, "Tec9")) return 32;
|
||||
else if (!strcmp(string, "Rifle")) return 33;
|
||||
else if (!strcmp(string, "Sniper Rifle")) return 34;
|
||||
else if (!strcmp(string, "RPG")) return 35;
|
||||
else if (!strcmp(string, "Missile Launcher")) return 36;
|
||||
else if (!strcmp(string, "Flame Thrower")) return 37;
|
||||
else if (!strcmp(string, "Minigun")) return 38;
|
||||
else if (!strcmp(string, "Sachel Charges")) return 39;
|
||||
else if (!strcmp(string, "Detonator")) return 40;
|
||||
else if (!strcmp(string, "Spray Paint")) return 41;
|
||||
else if (!strcmp(string, "Fire Extinguisher")) return 42;
|
||||
else if (!strcmp(string, "Camera")) return 43;
|
||||
else if (!strcmp(string, "Nightvision Goggles")) return 44;
|
||||
else if (!strcmp(string, "Thermal Goggles")) return 45;
|
||||
else if (!strcmp(string, "Parachute")) return 46;
|
||||
return -1;
|
||||
}
|
||||
|
||||
SSCANF:vehicle(string[])
|
||||
{
|
||||
// This function is VERY basic, needs VASTLY improving to detect variations.
|
||||
if ('0' <= string[0] <= '9')
|
||||
{
|
||||
new
|
||||
ret = strval(string);
|
||||
if (400 <= ret <= 611)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(string, "Landstalker")) return 400;
|
||||
else if (!strcmp(string, "Bravura")) return 401;
|
||||
else if (!strcmp(string, "Buffalo")) return 402;
|
||||
else if (!strcmp(string, "Linerunner")) return 403;
|
||||
else if (!strcmp(string, "Perenniel")) return 404;
|
||||
else if (!strcmp(string, "Sentinel")) return 405;
|
||||
else if (!strcmp(string, "Dumper")) return 406;
|
||||
else if (!strcmp(string, "Firetruck")) return 407;
|
||||
else if (!strcmp(string, "Trashmaster")) return 408;
|
||||
else if (!strcmp(string, "Stretch")) return 409;
|
||||
else if (!strcmp(string, "Manana")) return 410;
|
||||
else if (!strcmp(string, "Infernus")) return 411;
|
||||
else if (!strcmp(string, "Voodoo")) return 412;
|
||||
else if (!strcmp(string, "Pony")) return 413;
|
||||
else if (!strcmp(string, "Mule")) return 414;
|
||||
else if (!strcmp(string, "Cheetah")) return 415;
|
||||
else if (!strcmp(string, "Ambulance")) return 416;
|
||||
else if (!strcmp(string, "Leviathan")) return 417;
|
||||
else if (!strcmp(string, "Moonbeam")) return 418;
|
||||
else if (!strcmp(string, "Esperanto")) return 419;
|
||||
else if (!strcmp(string, "Taxi")) return 420;
|
||||
else if (!strcmp(string, "Washington")) return 421;
|
||||
else if (!strcmp(string, "Bobcat")) return 422;
|
||||
else if (!strcmp(string, "Mr Whoopee")) return 423;
|
||||
else if (!strcmp(string, "BF Injection")) return 424;
|
||||
else if (!strcmp(string, "Hunter")) return 425;
|
||||
else if (!strcmp(string, "Premier")) return 426;
|
||||
else if (!strcmp(string, "Enforcer")) return 427;
|
||||
else if (!strcmp(string, "Securicar")) return 428;
|
||||
else if (!strcmp(string, "Banshee")) return 429;
|
||||
else if (!strcmp(string, "Predator")) return 430;
|
||||
else if (!strcmp(string, "Bus")) return 431;
|
||||
else if (!strcmp(string, "Rhino")) return 432;
|
||||
else if (!strcmp(string, "Barracks")) return 433;
|
||||
else if (!strcmp(string, "Hotknife")) return 434;
|
||||
else if (!strcmp(string, "Article Trailer")) return 435;
|
||||
else if (!strcmp(string, "Previon")) return 436;
|
||||
else if (!strcmp(string, "Coach")) return 437;
|
||||
else if (!strcmp(string, "Cabbie")) return 438;
|
||||
else if (!strcmp(string, "Stallion")) return 439;
|
||||
else if (!strcmp(string, "Rumpo")) return 440;
|
||||
else if (!strcmp(string, "RC Bandit")) return 441;
|
||||
else if (!strcmp(string, "Romero")) return 442;
|
||||
else if (!strcmp(string, "Packer")) return 443;
|
||||
else if (!strcmp(string, "Monster")) return 444;
|
||||
else if (!strcmp(string, "Admiral")) return 445;
|
||||
else if (!strcmp(string, "Squallo")) return 446;
|
||||
else if (!strcmp(string, "Seasparrow")) return 447;
|
||||
else if (!strcmp(string, "Pizzaboy")) return 448;
|
||||
else if (!strcmp(string, "Tram")) return 449;
|
||||
else if (!strcmp(string, "Article Trailer 2")) return 450;
|
||||
else if (!strcmp(string, "Turismo")) return 451;
|
||||
else if (!strcmp(string, "Speeder")) return 452;
|
||||
else if (!strcmp(string, "Reefer")) return 453;
|
||||
else if (!strcmp(string, "Tropic")) return 454;
|
||||
else if (!strcmp(string, "Flatbed")) return 455;
|
||||
else if (!strcmp(string, "Yankee")) return 456;
|
||||
else if (!strcmp(string, "Caddy")) return 457;
|
||||
else if (!strcmp(string, "Solair")) return 458;
|
||||
else if (!strcmp(string, "Berkley's RC Van")) return 459;
|
||||
else if (!strcmp(string, "Skimmer")) return 460;
|
||||
else if (!strcmp(string, "PCJ-600")) return 461;
|
||||
else if (!strcmp(string, "Faggio")) return 462;
|
||||
else if (!strcmp(string, "Freeway")) return 463;
|
||||
else if (!strcmp(string, "RC Baron")) return 464;
|
||||
else if (!strcmp(string, "RC Raider")) return 465;
|
||||
else if (!strcmp(string, "Glendale")) return 466;
|
||||
else if (!strcmp(string, "Oceanic")) return 467;
|
||||
else if (!strcmp(string, "Sanchez")) return 468;
|
||||
else if (!strcmp(string, "Sparrow")) return 469;
|
||||
else if (!strcmp(string, "Patriot")) return 470;
|
||||
else if (!strcmp(string, "Quad")) return 471;
|
||||
else if (!strcmp(string, "Coastguard")) return 472;
|
||||
else if (!strcmp(string, "Dinghy")) return 473;
|
||||
else if (!strcmp(string, "Hermes")) return 474;
|
||||
else if (!strcmp(string, "Sabre")) return 475;
|
||||
else if (!strcmp(string, "Rustler")) return 476;
|
||||
else if (!strcmp(string, "ZR-350")) return 477;
|
||||
else if (!strcmp(string, "Walton")) return 478;
|
||||
else if (!strcmp(string, "Regina")) return 479;
|
||||
else if (!strcmp(string, "Comet")) return 480;
|
||||
else if (!strcmp(string, "BMX")) return 481;
|
||||
else if (!strcmp(string, "Burrito")) return 482;
|
||||
else if (!strcmp(string, "Camper")) return 483;
|
||||
else if (!strcmp(string, "Marquis")) return 484;
|
||||
else if (!strcmp(string, "Baggage")) return 485;
|
||||
else if (!strcmp(string, "Dozer")) return 486;
|
||||
else if (!strcmp(string, "Maverick")) return 487;
|
||||
else if (!strcmp(string, "SAN News Maverick")) return 488;
|
||||
else if (!strcmp(string, "Rancher")) return 489;
|
||||
else if (!strcmp(string, "FBI Rancher")) return 490;
|
||||
else if (!strcmp(string, "Virgo")) return 491;
|
||||
else if (!strcmp(string, "Greenwood")) return 492;
|
||||
else if (!strcmp(string, "Jetmax")) return 493;
|
||||
else if (!strcmp(string, "Hotring Racer")) return 494;
|
||||
else if (!strcmp(string, "Sandking")) return 495;
|
||||
else if (!strcmp(string, "Blista Compact")) return 496;
|
||||
else if (!strcmp(string, "Police Maverick")) return 497;
|
||||
else if (!strcmp(string, "Boxville")) return 498;
|
||||
else if (!strcmp(string, "Benson")) return 499;
|
||||
else if (!strcmp(string, "Mesa")) return 500;
|
||||
else if (!strcmp(string, "RC Goblin")) return 501;
|
||||
else if (!strcmp(string, "Hotring Racer")) return 502;
|
||||
else if (!strcmp(string, "Hotring Racer")) return 503;
|
||||
else if (!strcmp(string, "Bloodring Banger")) return 504;
|
||||
else if (!strcmp(string, "Rancher")) return 505;
|
||||
else if (!strcmp(string, "Super GT")) return 506;
|
||||
else if (!strcmp(string, "Elegant")) return 507;
|
||||
else if (!strcmp(string, "Journey")) return 508;
|
||||
else if (!strcmp(string, "Bike")) return 509;
|
||||
else if (!strcmp(string, "Mountain Bike")) return 510;
|
||||
else if (!strcmp(string, "Beagle")) return 511;
|
||||
else if (!strcmp(string, "Cropduster")) return 512;
|
||||
else if (!strcmp(string, "Stuntplane")) return 513;
|
||||
else if (!strcmp(string, "Tanker")) return 514;
|
||||
else if (!strcmp(string, "Roadtrain")) return 515;
|
||||
else if (!strcmp(string, "Nebula")) return 516;
|
||||
else if (!strcmp(string, "Majestic")) return 517;
|
||||
else if (!strcmp(string, "Buccaneer")) return 518;
|
||||
else if (!strcmp(string, "Shamal")) return 519;
|
||||
else if (!strcmp(string, "Hydra")) return 520;
|
||||
else if (!strcmp(string, "FCR-900")) return 521;
|
||||
else if (!strcmp(string, "NRG-500")) return 522;
|
||||
else if (!strcmp(string, "HPV1000")) return 523;
|
||||
else if (!strcmp(string, "Cement Truck")) return 524;
|
||||
else if (!strcmp(string, "Towtruck")) return 525;
|
||||
else if (!strcmp(string, "Fortune")) return 526;
|
||||
else if (!strcmp(string, "Cadrona")) return 527;
|
||||
else if (!strcmp(string, "FBI Truck")) return 528;
|
||||
else if (!strcmp(string, "Willard")) return 529;
|
||||
else if (!strcmp(string, "Forklift")) return 530;
|
||||
else if (!strcmp(string, "Tractor")) return 531;
|
||||
else if (!strcmp(string, "Combine Harvester")) return 532;
|
||||
else if (!strcmp(string, "Feltzer")) return 533;
|
||||
else if (!strcmp(string, "Remington")) return 534;
|
||||
else if (!strcmp(string, "Slamvan")) return 535;
|
||||
else if (!strcmp(string, "Blade")) return 536;
|
||||
else if (!strcmp(string, "Freight (Train)")) return 537;
|
||||
else if (!strcmp(string, "Brownstreak (Train)")) return 538;
|
||||
else if (!strcmp(string, "Vortex")) return 539;
|
||||
else if (!strcmp(string, "Vincent")) return 540;
|
||||
else if (!strcmp(string, "Bullet")) return 541;
|
||||
else if (!strcmp(string, "Clover")) return 542;
|
||||
else if (!strcmp(string, "Sadler")) return 543;
|
||||
else if (!strcmp(string, "Firetruck LA")) return 544;
|
||||
else if (!strcmp(string, "Hustler")) return 545;
|
||||
else if (!strcmp(string, "Intruder")) return 546;
|
||||
else if (!strcmp(string, "Primo")) return 547;
|
||||
else if (!strcmp(string, "Cargobob")) return 548;
|
||||
else if (!strcmp(string, "Tampa")) return 549;
|
||||
else if (!strcmp(string, "Sunrise")) return 550;
|
||||
else if (!strcmp(string, "Merit")) return 551;
|
||||
else if (!strcmp(string, "Utility Van")) return 552;
|
||||
else if (!strcmp(string, "Nevada")) return 553;
|
||||
else if (!strcmp(string, "Yosemite")) return 554;
|
||||
else if (!strcmp(string, "Windsor")) return 555;
|
||||
else if (!strcmp(string, "Monster \"A\"")) return 556;
|
||||
else if (!strcmp(string, "Monster \"B\"")) return 557;
|
||||
else if (!strcmp(string, "Uranus")) return 558;
|
||||
else if (!strcmp(string, "Jester")) return 559;
|
||||
else if (!strcmp(string, "Sultan")) return 560;
|
||||
else if (!strcmp(string, "Stratum")) return 561;
|
||||
else if (!strcmp(string, "Elegy")) return 562;
|
||||
else if (!strcmp(string, "Raindance")) return 563;
|
||||
else if (!strcmp(string, "RC Tiger")) return 564;
|
||||
else if (!strcmp(string, "Flash")) return 565;
|
||||
else if (!strcmp(string, "Tahoma")) return 566;
|
||||
else if (!strcmp(string, "Savanna")) return 567;
|
||||
else if (!strcmp(string, "Bandito")) return 568;
|
||||
else if (!strcmp(string, "Freight Flat Trailer (Train)")) return 569;
|
||||
else if (!strcmp(string, "Streak Trailer (Train)")) return 570;
|
||||
else if (!strcmp(string, "Kart")) return 571;
|
||||
else if (!strcmp(string, "Mower")) return 572;
|
||||
else if (!strcmp(string, "Dune")) return 573;
|
||||
else if (!strcmp(string, "Sweeper")) return 574;
|
||||
else if (!strcmp(string, "Broadway")) return 575;
|
||||
else if (!strcmp(string, "Tornado")) return 576;
|
||||
else if (!strcmp(string, "AT400")) return 577;
|
||||
else if (!strcmp(string, "DFT-30")) return 578;
|
||||
else if (!strcmp(string, "Huntley")) return 579;
|
||||
else if (!strcmp(string, "Stafford")) return 580;
|
||||
else if (!strcmp(string, "BF-400")) return 581;
|
||||
else if (!strcmp(string, "Newsvan")) return 582;
|
||||
else if (!strcmp(string, "Tug")) return 583;
|
||||
else if (!strcmp(string, "Petrol Trailer")) return 584;
|
||||
else if (!strcmp(string, "Emperor")) return 585;
|
||||
else if (!strcmp(string, "Wayfarer")) return 586;
|
||||
else if (!strcmp(string, "Euros")) return 587;
|
||||
else if (!strcmp(string, "Hotdog")) return 588;
|
||||
else if (!strcmp(string, "Club")) return 589;
|
||||
else if (!strcmp(string, "Freight Box Trailer (Train)")) return 590;
|
||||
else if (!strcmp(string, "Article Trailer 3")) return 591;
|
||||
else if (!strcmp(string, "Andromada")) return 592;
|
||||
else if (!strcmp(string, "Dodo")) return 593;
|
||||
else if (!strcmp(string, "RC Cam")) return 594;
|
||||
else if (!strcmp(string, "Launch")) return 595;
|
||||
else if (!strcmp(string, "Police Car (LSPD)")) return 596;
|
||||
else if (!strcmp(string, "Police Car (SFPD)")) return 597;
|
||||
else if (!strcmp(string, "Police Car (LVPD)")) return 598;
|
||||
else if (!strcmp(string, "Police Ranger")) return 599;
|
||||
else if (!strcmp(string, "Picador")) return 600;
|
||||
else if (!strcmp(string, "S.W.A.T.")) return 601;
|
||||
else if (!strcmp(string, "Alpha")) return 602;
|
||||
else if (!strcmp(string, "Phoenix")) return 603;
|
||||
else if (!strcmp(string, "Glendale Shit")) return 604;
|
||||
else if (!strcmp(string, "Sadler Shit")) return 605;
|
||||
else if (!strcmp(string, "Baggage Trailer \"A\"")) return 606;
|
||||
else if (!strcmp(string, "Baggage Trailer \"B\"")) return 607;
|
||||
else if (!strcmp(string, "Tug Stairs Trailer")) return 608;
|
||||
else if (!strcmp(string, "Boxville")) return 609;
|
||||
else if (!strcmp(string, "Farm Trailer")) return 610;
|
||||
else if (!strcmp(string, "Utility Trailer")) return 611;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Fix the compiler crash when both the PAWN and Plugin versions of sscanf are
|
||||
// found by renaming the old version at declaration. (fixes.inc compatible
|
||||
// naming scheme: "BAD_Function()").
|
||||
#define sscanf(%0:...) BAD_sscanf(%0:...)
|
512
pawno/include/streamer.inc
Normal file
512
pawno/include/streamer.inc
Normal file
@ -0,0 +1,512 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Incognito
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <a_samp>
|
||||
|
||||
// Definitions
|
||||
|
||||
#define STREAMER_TYPE_OBJECT (0)
|
||||
#define STREAMER_TYPE_PICKUP (1)
|
||||
#define STREAMER_TYPE_CP (2)
|
||||
#define STREAMER_TYPE_RACE_CP (3)
|
||||
#define STREAMER_TYPE_MAP_ICON (4)
|
||||
#define STREAMER_TYPE_3D_TEXT_LABEL (5)
|
||||
#define STREAMER_TYPE_AREA (6)
|
||||
|
||||
#define STREAMER_AREA_TYPE_CIRCLE (0)
|
||||
#define STREAMER_AREA_TYPE_RECTANGLE (1)
|
||||
#define STREAMER_AREA_TYPE_SPHERE (2)
|
||||
#define STREAMER_AREA_TYPE_CUBE (3)
|
||||
#define STREAMER_AREA_TYPE_POLYGON (4)
|
||||
|
||||
#define STREAMER_OBJECT_TYPE_GLOBAL (0)
|
||||
#define STREAMER_OBJECT_TYPE_PLAYER (1)
|
||||
#define STREAMER_OBJECT_TYPE_DYNAMIC (2)
|
||||
|
||||
#if !defined FLOAT_INFINITY
|
||||
#define FLOAT_INFINITY (Float:0x7F800000)
|
||||
#endif
|
||||
|
||||
// Include File Version
|
||||
|
||||
public Streamer_IncludeFileVersion = 0x26105;
|
||||
|
||||
#pragma unused Streamer_IncludeFileVersion
|
||||
|
||||
// Enumerator
|
||||
|
||||
enum
|
||||
{
|
||||
E_STREAMER_ATTACHED_OBJECT,
|
||||
E_STREAMER_ATTACHED_PLAYER,
|
||||
E_STREAMER_ATTACHED_VEHICLE,
|
||||
E_STREAMER_ATTACH_OFFSET_X,
|
||||
E_STREAMER_ATTACH_OFFSET_Y,
|
||||
E_STREAMER_ATTACH_OFFSET_Z,
|
||||
E_STREAMER_ATTACH_R_X,
|
||||
E_STREAMER_ATTACH_R_Y,
|
||||
E_STREAMER_ATTACH_R_Z,
|
||||
E_STREAMER_ATTACH_X,
|
||||
E_STREAMER_ATTACH_Y,
|
||||
E_STREAMER_ATTACH_Z,
|
||||
E_STREAMER_COLOR,
|
||||
E_STREAMER_DRAW_DISTANCE,
|
||||
E_STREAMER_EXTRA_ID,
|
||||
E_STREAMER_INTERIOR_ID,
|
||||
E_STREAMER_MAX_X,
|
||||
E_STREAMER_MAX_Y,
|
||||
E_STREAMER_MAX_Z,
|
||||
E_STREAMER_MIN_X,
|
||||
E_STREAMER_MIN_Y,
|
||||
E_STREAMER_MIN_Z,
|
||||
E_STREAMER_MODEL_ID,
|
||||
E_STREAMER_MOVE_R_X,
|
||||
E_STREAMER_MOVE_R_Y,
|
||||
E_STREAMER_MOVE_R_Z,
|
||||
E_STREAMER_MOVE_SPEED,
|
||||
E_STREAMER_MOVE_X,
|
||||
E_STREAMER_MOVE_Y,
|
||||
E_STREAMER_MOVE_Z,
|
||||
E_STREAMER_NEXT_X,
|
||||
E_STREAMER_NEXT_Y,
|
||||
E_STREAMER_NEXT_Z,
|
||||
E_STREAMER_PLAYER_ID,
|
||||
E_STREAMER_R_X,
|
||||
E_STREAMER_R_Y,
|
||||
E_STREAMER_R_Z,
|
||||
E_STREAMER_SIZE,
|
||||
E_STREAMER_STREAM_DISTANCE,
|
||||
E_STREAMER_STYLE,
|
||||
E_STREAMER_TEST_LOS,
|
||||
E_STREAMER_TYPE,
|
||||
E_STREAMER_WORLD_ID,
|
||||
E_STREAMER_X,
|
||||
E_STREAMER_Y,
|
||||
E_STREAMER_Z
|
||||
}
|
||||
|
||||
// Natives (Settings)
|
||||
|
||||
native Streamer_TickRate(rate);
|
||||
native Streamer_MaxItems(type, items);
|
||||
native Streamer_VisibleItems(type, items);
|
||||
native Streamer_CellDistance(Float:distance);
|
||||
native Streamer_CellSize(Float:size);
|
||||
|
||||
// Natives (Updates)
|
||||
|
||||
native Streamer_ProcessActiveItems();
|
||||
native Streamer_ToggleIdleUpdate(playerid, toggle);
|
||||
native Streamer_ToggleItemUpdate(playerid, type, toggle);
|
||||
native Streamer_Update(playerid);
|
||||
native Streamer_UpdateEx(playerid, Float:x, Float:y, Float:z, worldid = -1, interiorid = -1);
|
||||
|
||||
// Natives (Data Manipulation)
|
||||
|
||||
native Streamer_GetFloatData(type, {Text3D,_}:id, data, &Float:result);
|
||||
native Streamer_SetFloatData(type, {Text3D,_}:id, data, Float:value);
|
||||
native Streamer_GetIntData(type, {Text3D,_}:id, data);
|
||||
native Streamer_SetIntData(type, {Text3D,_}:id, data, value);
|
||||
native Streamer_GetArrayData(type, {Text3D,_}:id, data, dest[], maxlength = sizeof dest);
|
||||
native Streamer_SetArrayData(type, {Text3D,_}:id, data, const src[], maxlength = sizeof src);
|
||||
native Streamer_IsInArrayData(type, {Text3D,_}:id, data, value);
|
||||
native Streamer_AppendArrayData(type, {Text3D,_}:id, data, value);
|
||||
native Streamer_RemoveArrayData(type, {Text3D,_}:id, data, value);
|
||||
native Streamer_GetUpperBound(type);
|
||||
|
||||
// Natives (Miscellaneous)
|
||||
|
||||
native Streamer_GetDistanceToItem(Float:x, Float:y, Float:z, type, {Text3D,_}:id, &Float:distance);
|
||||
native Streamer_IsItemVisible(playerid, type, {Text3D,_}:id);
|
||||
native Streamer_DestroyAllVisibleItems(playerid, type);
|
||||
native Streamer_CountVisibleItems(playerid, type);
|
||||
|
||||
// Natives (Objects)
|
||||
|
||||
native CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 300.0);
|
||||
native DestroyDynamicObject(objectid);
|
||||
native IsValidDynamicObject(objectid);
|
||||
native SetDynamicObjectPos(objectid, Float:x, Float:y, Float:z);
|
||||
native GetDynamicObjectPos(objectid, &Float:x, &Float:y, &Float:z);
|
||||
native SetDynamicObjectRot(objectid, Float:rx, Float:ry, Float:rz);
|
||||
native GetDynamicObjectRot(objectid, &Float:rx, &Float:ry, &Float:rz);
|
||||
native MoveDynamicObject(objectid, Float:x, Float:y, Float:z, Float:speed, Float:rx = -1000.0, Float:ry = -1000.0, Float:rz = -1000.0);
|
||||
native StopDynamicObject(objectid);
|
||||
native IsDynamicObjectMoving(objectid);
|
||||
native AttachCameraToDynamicObject(playerid, objectid);
|
||||
native AttachDynamicObjectToVehicle(objectid, vehicleid, Float:offsetx, Float:offsety, Float:offsetz, Float:rx, Float:ry, Float:rz);
|
||||
native EditDynamicObject(playerid, objectid);
|
||||
native GetDynamicObjectMaterial(objectid, materialindex, &modelid, txdname[], texturename[], &materialcolor, maxtxdname = sizeof txdname, maxtexturename = sizeof texturename);
|
||||
native SetDynamicObjectMaterial(objectid, materialindex, modelid, const txdname[], const texturename[], materialcolor = 0);
|
||||
native GetDynamicObjectMaterialText(objectid, materialindex, text[], &materialsize, fontface[], &fontsize, &bold, &fontcolor, &backcolor, &textalignment, maxtext = sizeof text, maxfontface = sizeof fontface);
|
||||
native SetDynamicObjectMaterialText(objectid, materialindex, const text[], materialsize = OBJECT_MATERIAL_SIZE_256x128, const fontface[] = "Arial", fontsize = 24, bold = 1, fontcolor = 0xFFFFFFFF, backcolor = 0, textalignment = 0);
|
||||
native DestroyAllDynamicObjects();
|
||||
native CountDynamicObjects();
|
||||
|
||||
// Natives (Pickups)
|
||||
|
||||
native CreateDynamicPickup(modelid, type, Float:x, Float:y, Float:z, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0);
|
||||
native DestroyDynamicPickup(pickupid);
|
||||
native IsValidDynamicPickup(pickupid);
|
||||
native DestroyAllDynamicPickups();
|
||||
native CountDynamicPickups();
|
||||
|
||||
// Natives (Checkpoints)
|
||||
|
||||
native CreateDynamicCP(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0);
|
||||
native DestroyDynamicCP(checkpointid);
|
||||
native IsValidDynamicCP(checkpointid);
|
||||
native TogglePlayerDynamicCP(playerid, checkpointid, toggle);
|
||||
native TogglePlayerAllDynamicCPs(playerid, toggle);
|
||||
native IsPlayerInDynamicCP(playerid, checkpointid);
|
||||
native GetPlayerVisibleDynamicCP(playerid);
|
||||
native DestroyAllDynamicCPs();
|
||||
native CountDynamicCPs();
|
||||
|
||||
// Natives (Race Checkpoints)
|
||||
|
||||
native CreateDynamicRaceCP(type, Float:x, Float:y, Float:z, Float:nextx, Float:nexty, Float:nextz, Float:size, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0);
|
||||
native DestroyDynamicRaceCP(checkpointid);
|
||||
native IsValidDynamicRaceCP(checkpointid);
|
||||
native TogglePlayerDynamicRaceCP(playerid, checkpointid, toggle);
|
||||
native TogglePlayerAllDynamicRaceCPs(playerid, toggle);
|
||||
native IsPlayerInDynamicRaceCP(playerid, checkpointid);
|
||||
native GetPlayerVisibleDynamicRaceCP(playerid);
|
||||
native DestroyAllDynamicRaceCPs();
|
||||
native CountDynamicRaceCPs();
|
||||
|
||||
// Natives (Map Icons)
|
||||
|
||||
native CreateDynamicMapIcon(Float:x, Float:y, Float:z, type, color, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0);
|
||||
native DestroyDynamicMapIcon(iconid);
|
||||
native IsValidDynamicMapIcon(iconid);
|
||||
native DestroyAllDynamicMapIcons();
|
||||
native CountDynamicMapIcons();
|
||||
|
||||
// Natives (3D Text Labels)
|
||||
|
||||
native Text3D:CreateDynamic3DTextLabel(const text[], color, Float:x, Float:y, Float:z, Float:drawdistance, attachedplayer = INVALID_PLAYER_ID, attachedvehicle = INVALID_VEHICLE_ID, testlos = 0, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0);
|
||||
native DestroyDynamic3DTextLabel(Text3D:id);
|
||||
native IsValidDynamic3DTextLabel(Text3D:id);
|
||||
native GetDynamic3DTextLabelText(Text3D:id, text[], maxlength = sizeof text);
|
||||
native UpdateDynamic3DTextLabelText(Text3D:id, color, const text[]);
|
||||
native DestroyAllDynamic3DTextLabels();
|
||||
native CountDynamic3DTextLabels();
|
||||
|
||||
// Natives (Areas)
|
||||
|
||||
native CreateDynamicCircle(Float:x, Float:y, Float:size, worldid = -1, interiorid = -1, playerid = -1);
|
||||
native CreateDynamicRectangle(Float:minx, Float:miny, Float:maxx, Float:maxy, worldid = -1, interiorid = -1, playerid = -1);
|
||||
native CreateDynamicSphere(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid = -1);
|
||||
native CreateDynamicCube(Float:minx, Float:miny, Float:minz, Float:maxx, Float:maxy, Float:maxz, worldid = -1, interiorid = -1, playerid = -1);
|
||||
native CreateDynamicPolygon(Float:points[], Float:minz = -FLOAT_INFINITY, Float:maxz = FLOAT_INFINITY, maxpoints = sizeof points, worldid = -1, interiorid = -1, playerid = -1);
|
||||
native DestroyDynamicArea(areaid);
|
||||
native IsValidDynamicArea(areaid);
|
||||
native TogglePlayerDynamicArea(playerid, areaid, toggle);
|
||||
native TogglePlayerAllDynamicAreas(playerid, toggle);
|
||||
native IsPlayerInDynamicArea(playerid, areaid);
|
||||
native IsPlayerInAnyDynamicArea(playerid);
|
||||
native IsPointInDynamicArea(areaid, Float:x, Float:y, Float:z);
|
||||
native IsPointInAnyDynamicArea(Float:x, Float:y, Float:z);
|
||||
native AttachDynamicAreaToObject(areaid, objectid, type = STREAMER_OBJECT_TYPE_DYNAMIC, playerid = INVALID_PLAYER_ID);
|
||||
native AttachDynamicAreaToPlayer(areaid, playerid);
|
||||
native AttachDynamicAreaToVehicle(areaid, vehicleid);
|
||||
native DestroyAllDynamicAreas();
|
||||
native CountDynamicAreas();
|
||||
|
||||
// Natives (Extended)
|
||||
|
||||
native CreateDynamicObjectEx(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, Float:drawdistance = 0.0, Float:streamdistance = 200.0, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
|
||||
native CreateDynamicPickupEx(modelid, type, Float:x, Float:y, Float:z, Float:streamdistance = 100.0, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
|
||||
native CreateDynamicCPEx(Float:x, Float:y, Float:z, Float:size, Float:streamdistance = 100.0, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
|
||||
native CreateDynamicRaceCPEx(type, Float:x, Float:y, Float:z, Float:nextx, Float:nexty, Float:nextz, Float:size, Float:streamdistance = 100.0, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
|
||||
native CreateDynamicMapIconEx(Float:x, Float:y, Float:z, type, color, style = MAPICON_LOCAL, Float:streamdistance = 100.0, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
|
||||
native Text3D:CreateDynamic3DTextLabelEx(const text[], color, Float:x, Float:y, Float:z, Float:drawdistance, attachedplayer = INVALID_PLAYER_ID, attachedvehicle = INVALID_VEHICLE_ID, testlos = 0, Float:streamdistance = 100.0, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
|
||||
native CreateDynamicCircleEx(Float:x, Float:y, Float:size, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
|
||||
native CreateDynamicRectangleEx(Float:minx, Float:miny, Float:maxx, Float:maxy, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
|
||||
native CreateDynamicSphereEx(Float:x, Float:y, Float:z, Float:size, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
|
||||
native CreateDynamicCubeEx(Float:minx, Float:miny, Float:minz, Float:maxx, Float:maxy, Float:maxz, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
|
||||
native CreateDynamicPolygonEx(Float:points[], Float:minz = -FLOAT_INFINITY, Float:maxz = FLOAT_INFINITY, maxpoints = sizeof points, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
|
||||
|
||||
// Natives (Internal)
|
||||
|
||||
native Streamer_CallbackHook(callback, {Float,_}:...);
|
||||
|
||||
// Callbacks
|
||||
|
||||
forward OnDynamicObjectMoved(objectid);
|
||||
forward OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz);
|
||||
forward OnPlayerSelectDynamicObject(playerid, objectid, modelid, Float:x, Float:y, Float:z);
|
||||
forward OnPlayerPickUpDynamicPickup(playerid, pickupid);
|
||||
forward OnPlayerEnterDynamicCP(playerid, checkpointid);
|
||||
forward OnPlayerLeaveDynamicCP(playerid, checkpointid);
|
||||
forward OnPlayerEnterDynamicRaceCP(playerid, checkpointid);
|
||||
forward OnPlayerLeaveDynamicRaceCP(playerid, checkpointid);
|
||||
forward OnPlayerEnterDynamicArea(playerid, areaid);
|
||||
forward OnPlayerLeaveDynamicArea(playerid, areaid);
|
||||
|
||||
// Callback Hook Section
|
||||
|
||||
#define STREAMER_OPC (0)
|
||||
#define STREAMER_OPDC (1)
|
||||
#define STREAMER_OPEO (2)
|
||||
#define STREAMER_OPSO (3)
|
||||
#define STREAMER_OPPP (4)
|
||||
#define STREAMER_OPEC (5)
|
||||
#define STREAMER_OPLC (6)
|
||||
#define STREAMER_OPERC (7)
|
||||
#define STREAMER_OPLRC (8)
|
||||
|
||||
static bool:Streamer_g_OPC = false;
|
||||
static bool:Streamer_g_OPDC = false;
|
||||
static bool:Streamer_g_OPEO = false;
|
||||
static bool:Streamer_g_OPSO = false;
|
||||
static bool:Streamer_g_OPPP = false;
|
||||
static bool:Streamer_g_OPEC = false;
|
||||
static bool:Streamer_g_OPLC = false;
|
||||
static bool:Streamer_g_OPERC = false;
|
||||
static bool:Streamer_g_OPLRC = false;
|
||||
|
||||
public OnFilterScriptInit()
|
||||
{
|
||||
Streamer_g_OPC = funcidx("Streamer_OnPlayerConnect") != -1;
|
||||
Streamer_g_OPDC = funcidx("Streamer_OnPlayerDisconnect") != -1;
|
||||
Streamer_g_OPEO = funcidx("Streamer_OnPlayerEditObject") != -1;
|
||||
Streamer_g_OPSO = funcidx("Streamer_OnPlayerSelectObject") != -1;
|
||||
Streamer_g_OPPP = funcidx("Streamer_OnPlayerPickUpPickup") != -1;
|
||||
Streamer_g_OPEC = funcidx("Streamer_OnPlayerEnterCP") != -1;
|
||||
Streamer_g_OPLC = funcidx("Streamer_OnPlayerLeaveCP") != -1;
|
||||
Streamer_g_OPERC = funcidx("Streamer_OnPlayerEnterRaceCP") != -1;
|
||||
Streamer_g_OPLRC = funcidx("Streamer_OnPlayerLeaveRaceCP") != -1;
|
||||
if (funcidx("Streamer_OnFilterScriptInit") != -1)
|
||||
{
|
||||
return CallLocalFunction("Streamer_OnFilterScriptInit", "");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined _ALS_OnFilterScriptInit
|
||||
#undef OnFilterScriptInit
|
||||
#else
|
||||
#define _ALS_OnFilterScriptInit
|
||||
#endif
|
||||
#define OnFilterScriptInit Streamer_OnFilterScriptInit
|
||||
|
||||
forward Streamer_OnFilterScriptInit();
|
||||
|
||||
public OnGameModeInit()
|
||||
{
|
||||
Streamer_g_OPC = funcidx("Streamer_OnPlayerConnect") != -1;
|
||||
Streamer_g_OPDC = funcidx("Streamer_OnPlayerDisconnect") != -1;
|
||||
Streamer_g_OPEO = funcidx("Streamer_OnPlayerEditObject") != -1;
|
||||
Streamer_g_OPSO = funcidx("Streamer_OnPlayerSelectObject") != -1;
|
||||
Streamer_g_OPPP = funcidx("Streamer_OnPlayerPickUpPickup") != -1;
|
||||
Streamer_g_OPEC = funcidx("Streamer_OnPlayerEnterCP") != -1;
|
||||
Streamer_g_OPLC = funcidx("Streamer_OnPlayerLeaveCP") != -1;
|
||||
Streamer_g_OPERC = funcidx("Streamer_OnPlayerEnterRaceCP") != -1;
|
||||
Streamer_g_OPLRC = funcidx("Streamer_OnPlayerLeaveRaceCP") != -1;
|
||||
if (funcidx("Streamer_OnGameModeInit") != -1)
|
||||
{
|
||||
return CallLocalFunction("Streamer_OnGameModeInit", "");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined _ALS_OnGameModeInit
|
||||
#undef OnGameModeInit
|
||||
#else
|
||||
#define _ALS_OnGameModeInit
|
||||
#endif
|
||||
#define OnGameModeInit Streamer_OnGameModeInit
|
||||
|
||||
forward Streamer_OnGameModeInit();
|
||||
|
||||
public OnPlayerConnect(playerid)
|
||||
{
|
||||
Streamer_CallbackHook(STREAMER_OPC, playerid);
|
||||
if (Streamer_g_OPC)
|
||||
{
|
||||
return CallLocalFunction("Streamer_OnPlayerConnect", "d", playerid);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined _ALS_OnPlayerConnect
|
||||
#undef OnPlayerConnect
|
||||
#else
|
||||
#define _ALS_OnPlayerConnect
|
||||
#endif
|
||||
#define OnPlayerConnect Streamer_OnPlayerConnect
|
||||
|
||||
forward Streamer_OnPlayerConnect(playerid);
|
||||
|
||||
public OnPlayerDisconnect(playerid, reason)
|
||||
{
|
||||
Streamer_CallbackHook(STREAMER_OPDC, playerid, reason);
|
||||
if (Streamer_g_OPDC)
|
||||
{
|
||||
return CallLocalFunction("Streamer_OnPlayerDisconnect", "dd", playerid, reason);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined _ALS_OnPlayerDisconnect
|
||||
#undef OnPlayerDisconnect
|
||||
#else
|
||||
#define _ALS_OnPlayerDisconnect
|
||||
#endif
|
||||
#define OnPlayerDisconnect Streamer_OnPlayerDisconnect
|
||||
|
||||
forward Streamer_OnPlayerDisconnect(playerid, reason);
|
||||
|
||||
public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
|
||||
{
|
||||
if (playerobject)
|
||||
{
|
||||
Streamer_CallbackHook(STREAMER_OPEO, playerid, playerobject, objectid, response, fX, fY, fZ, fRotX, fRotY, fRotZ);
|
||||
}
|
||||
if (Streamer_g_OPEO)
|
||||
{
|
||||
return CallLocalFunction("Streamer_OnPlayerEditObject", "ddddffffff", playerid, playerobject, objectid, response, fX, fY, fZ, fRotX, fRotY, fRotZ);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined _ALS_OnPlayerEditObject
|
||||
#undef OnPlayerEditObject
|
||||
#else
|
||||
#define _ALS_OnPlayerEditObject
|
||||
#endif
|
||||
#define OnPlayerEditObject Streamer_OnPlayerEditObject
|
||||
|
||||
forward Streamer_OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ);
|
||||
|
||||
public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ)
|
||||
{
|
||||
if (type == SELECT_OBJECT_PLAYER_OBJECT)
|
||||
{
|
||||
Streamer_CallbackHook(STREAMER_OPSO, playerid, type, objectid, modelid, fX, fY, fZ);
|
||||
}
|
||||
if (Streamer_g_OPSO)
|
||||
{
|
||||
return CallLocalFunction("Streamer_OnPlayerSelectObject", "ddddfff", playerid, type, objectid, modelid, fX, fY, fZ);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined _ALS_OnPlayerSelectObject
|
||||
#undef OnPlayerSelectObject
|
||||
#else
|
||||
#define _ALS_OnPlayerSelectObject
|
||||
#endif
|
||||
#define OnPlayerSelectObject Streamer_OnPlayerSelectObject
|
||||
|
||||
forward Streamer_OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ);
|
||||
|
||||
public OnPlayerPickUpPickup(playerid, pickupid)
|
||||
{
|
||||
Streamer_CallbackHook(STREAMER_OPPP, playerid, pickupid);
|
||||
if (Streamer_g_OPPP)
|
||||
{
|
||||
return CallLocalFunction("Streamer_OnPlayerPickUpPickup", "dd", playerid, pickupid);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined _ALS_OnPlayerPickUpPickup
|
||||
#undef OnPlayerPickUpPickup
|
||||
#else
|
||||
#define _ALS_OnPlayerPickUpPickup
|
||||
#endif
|
||||
#define OnPlayerPickUpPickup Streamer_OnPlayerPickUpPickup
|
||||
|
||||
forward Streamer_OnPlayerPickUpPickup(playerid, pickupid);
|
||||
|
||||
public OnPlayerEnterCheckpoint(playerid)
|
||||
{
|
||||
Streamer_CallbackHook(STREAMER_OPEC, playerid);
|
||||
if (Streamer_g_OPEC)
|
||||
{
|
||||
return CallLocalFunction("Streamer_OnPlayerEnterCP", "d", playerid);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined _ALS_OnPlayerEnterCheckpoint
|
||||
#undef OnPlayerEnterCheckpoint
|
||||
#else
|
||||
#define _ALS_OnPlayerEnterCheckpoint
|
||||
#endif
|
||||
#define OnPlayerEnterCheckpoint Streamer_OnPlayerEnterCP
|
||||
|
||||
forward Streamer_OnPlayerEnterCP(playerid);
|
||||
|
||||
public OnPlayerLeaveCheckpoint(playerid)
|
||||
{
|
||||
Streamer_CallbackHook(STREAMER_OPLC, playerid);
|
||||
if (Streamer_g_OPLC)
|
||||
{
|
||||
return CallLocalFunction("Streamer_OnPlayerLeaveCP", "d", playerid);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined _ALS_OnPlayerLeaveCheckpoint
|
||||
#undef OnPlayerLeaveCheckpoint
|
||||
#else
|
||||
#define _ALS_OnPlayerLeaveCheckpoint
|
||||
#endif
|
||||
#define OnPlayerLeaveCheckpoint Streamer_OnPlayerLeaveCP
|
||||
|
||||
forward Streamer_OnPlayerLeaveCP(playerid);
|
||||
|
||||
public OnPlayerEnterRaceCheckpoint(playerid)
|
||||
{
|
||||
Streamer_CallbackHook(STREAMER_OPERC, playerid);
|
||||
if (Streamer_g_OPERC)
|
||||
{
|
||||
return CallLocalFunction("Streamer_OnPlayerEnterRaceCP", "d", playerid);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined _ALS_OnPlayerEnterRaceCP
|
||||
#undef OnPlayerEnterRaceCheckpoint
|
||||
#else
|
||||
#define _ALS_OnPlayerEnterRaceCP
|
||||
#endif
|
||||
#define OnPlayerEnterRaceCheckpoint Streamer_OnPlayerEnterRaceCP
|
||||
|
||||
forward Streamer_OnPlayerEnterRaceCP(playerid);
|
||||
|
||||
public OnPlayerLeaveRaceCheckpoint(playerid)
|
||||
{
|
||||
Streamer_CallbackHook(STREAMER_OPLRC, playerid);
|
||||
if (Streamer_g_OPLRC)
|
||||
{
|
||||
return CallLocalFunction("Streamer_OnPlayerLeaveRaceCP", "d", playerid);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined _ALS_OnPlayerLeaveRaceCP
|
||||
#undef OnPlayerLeaveRaceCheckpoint
|
||||
#else
|
||||
#define _ALS_OnPlayerLeaveRaceCP
|
||||
#endif
|
||||
#define OnPlayerLeaveRaceCheckpoint Streamer_OnPlayerLeaveRaceCP
|
||||
|
||||
forward Streamer_OnPlayerLeaveRaceCP(playerid);
|
BIN
plugins/Whirlpool.dll
Normal file
BIN
plugins/Whirlpool.dll
Normal file
Binary file not shown.
BIN
plugins/Whirlpool.so
Normal file
BIN
plugins/Whirlpool.so
Normal file
Binary file not shown.
BIN
plugins/sscanf.dll
Normal file
BIN
plugins/sscanf.dll
Normal file
Binary file not shown.
BIN
plugins/sscanf.so
Normal file
BIN
plugins/sscanf.so
Normal file
Binary file not shown.
BIN
plugins/streamer.dll
Normal file
BIN
plugins/streamer.dll
Normal file
Binary file not shown.
BIN
plugins/streamer.so
Normal file
BIN
plugins/streamer.so
Normal file
Binary file not shown.
0
scriptfiles/GLOBAL_MAP.sav
Normal file
0
scriptfiles/GLOBAL_MAP.sav
Normal file
0
scriptfiles/LABELS.sav
Normal file
0
scriptfiles/LABELS.sav
Normal file
8
scriptfiles/Nature.txt
Normal file
8
scriptfiles/Nature.txt
Normal file
@ -0,0 +1,8 @@
|
||||
11332 90 0 0 0.05
|
||||
1303 0 0 0 0.2
|
||||
18228 0 0 0 0.05
|
||||
18844 0 0 0 0.05
|
||||
16202 90 0 0 0.05
|
||||
19091 90 0 0 0.2
|
||||
1649 0 0 0 0.4
|
||||
832 0 0 90 0.17
|
0
scriptfiles/SAFE_ZONES.sav
Normal file
0
scriptfiles/SAFE_ZONES.sav
Normal file
9
scriptfiles/color.txt
Normal file
9
scriptfiles/color.txt
Normal file
@ -0,0 +1,9 @@
|
||||
19300
|
||||
19300
|
||||
19300
|
||||
19300
|
||||
19300
|
||||
19300
|
||||
19300
|
||||
19300
|
||||
19300
|
15
scriptfiles/decorations.txt
Normal file
15
scriptfiles/decorations.txt
Normal file
@ -0,0 +1,15 @@
|
||||
1671 0 0 165
|
||||
1720 0 0 165
|
||||
1711 0 0 180 1.4
|
||||
2635
|
||||
1408
|
||||
3927
|
||||
1802 -15 0 0 1.6
|
||||
912 -15 0 180
|
||||
2204 -15 0 0 1.4
|
||||
2328 -15 0 180 0.6
|
||||
3361
|
||||
1491
|
||||
1502
|
||||
1223
|
||||
970
|
3
scriptfiles/fencing.txt
Normal file
3
scriptfiles/fencing.txt
Normal file
@ -0,0 +1,3 @@
|
||||
983 0 0 90 0.3
|
||||
3282 0 0 0 0.2
|
||||
4100 0 0 0 0.3
|
9
scriptfiles/glass.txt
Normal file
9
scriptfiles/glass.txt
Normal file
@ -0,0 +1,9 @@
|
||||
19300
|
||||
19300
|
||||
19300
|
||||
19300
|
||||
19300
|
||||
19300
|
||||
19300
|
||||
19300
|
||||
19300
|
12
scriptfiles/grass.txt
Normal file
12
scriptfiles/grass.txt
Normal file
@ -0,0 +1,12 @@
|
||||
617
|
||||
659
|
||||
673
|
||||
732
|
||||
3506
|
||||
736
|
||||
685
|
||||
820
|
||||
821
|
||||
19473
|
||||
869
|
||||
870
|
6003
scriptfiles/last.txt
Normal file
6003
scriptfiles/last.txt
Normal file
File diff suppressed because it is too large
Load Diff
12
scriptfiles/plants.txt
Normal file
12
scriptfiles/plants.txt
Normal file
@ -0,0 +1,12 @@
|
||||
617
|
||||
659
|
||||
673
|
||||
732
|
||||
3506
|
||||
736
|
||||
685
|
||||
820
|
||||
821
|
||||
19473
|
||||
869
|
||||
870
|
7
scriptfiles/stone.txt
Normal file
7
scriptfiles/stone.txt
Normal file
@ -0,0 +1,7 @@
|
||||
4724 0 0 90 0.4
|
||||
19355 0 0 90 0.6
|
||||
19364 0 0 90 0.6
|
||||
19357 0 0 90 0.6
|
||||
19359 0 0 90 0.6
|
||||
19363 0 0 90 0.6
|
||||
19371 0 0 90 0.6
|
9
scriptfiles/switch.txt
Normal file
9
scriptfiles/switch.txt
Normal file
@ -0,0 +1,9 @@
|
||||
822
|
||||
1463
|
||||
897
|
||||
19091
|
||||
1649
|
||||
970
|
||||
1720 0 0 165
|
||||
617
|
||||
19133 0 0 90 1
|
7
scriptfiles/wood.txt
Normal file
7
scriptfiles/wood.txt
Normal file
@ -0,0 +1,7 @@
|
||||
1224 0 0 0 0.6
|
||||
3260 0 0 0 0.6
|
||||
2988 0 0 90 0.5
|
||||
19376 0 0 90 0.6
|
||||
19378 0 0 90 0.6
|
||||
19379 0 0 90 0.6
|
||||
19356 0 0 90 0.6
|
Loading…
x
Reference in New Issue
Block a user