├── .gitignore ├── CREDITS.md ├── README.md ├── gamemodes ├── Y │ ├── Y.inc │ ├── core │ │ ├── header.inc │ │ └── impl.inc │ ├── db │ │ ├── header.inc │ │ └── impl.inc │ ├── debug │ │ ├── header.inc │ │ └── impl.inc │ ├── language │ │ ├── header.inc │ │ ├── impl.inc │ │ └── tests.inc │ ├── log │ │ └── header.inc │ ├── object │ │ ├── header.inc │ │ └── impl.inc │ ├── player │ │ ├── admin │ │ │ ├── header.inc │ │ │ └── impl.inc │ │ ├── auth │ │ │ ├── header.inc │ │ │ └── impl.inc │ │ ├── core │ │ │ ├── header.inc │ │ │ └── impl.inc │ │ ├── header.inc │ │ ├── impl.inc │ │ ├── login │ │ │ ├── header.inc │ │ │ └── impl.inc │ │ ├── registration │ │ │ ├── header.inc │ │ │ ├── impl.inc │ │ │ └── tests.inc │ │ ├── status │ │ │ ├── header.inc │ │ │ └── impl.inc │ │ ├── tests.inc │ │ └── vehicle │ │ │ ├── header.inc │ │ │ └── impl.inc │ ├── utils │ │ ├── header.inc │ │ ├── impl.inc │ │ └── tests.inc │ └── vehicle │ │ ├── core │ │ ├── header.inc │ │ └── impl.inc │ │ ├── dealership │ │ ├── header.inc │ │ └── impl.inc │ │ ├── header.inc │ │ ├── impl.inc │ │ └── status │ │ ├── header.inc │ │ └── impl.inc ├── config.inc.template ├── install.pwn └── ycore.pwn └── scriptfiles ├── Y └── migrations │ └── players.sql └── YSI ├── core_LANG_DATA.yml ├── new text.txt ├── text ├── y.EN ├── y_players.EN ├── y_rp_factions.EN ├── y_rp_players.EN └── y_vehicles.EN ├── y_LANG_DATA.yml ├── y_core_LANG_DATA.yml ├── y_player_LANG_DATA.yml ├── y_players_LANG_DATA.yml ├── y_rp_factions_LANG_DATA.yml ├── y_rp_players_LANG_DATA.yml └── y_vehicles_LANG_DATA.yml /.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !gamemodes/**/*.inc 4 | !gamemodes/**/*.pwn 5 | !gamemodes/config.inc.template 6 | gamemodes/config.inc 7 | gamemodes/Y/RP/**/* 8 | !*/ 9 | !scriptfiles/Y/**/* 10 | !scriptfiles/YSI/**/* 11 | scriptfiles/YSI/test_ini 12 | scriptfiles/YSI/test_users 13 | scriptfiles/YSI/tests 14 | scriptfiles/YSI/text/core.* 15 | scriptfiles/YSI/YDBG 16 | scriptfiles/YSI/_temp_ysi_live_file_.ysi 17 | scriptfiles/YSI/alltests_config.ini 18 | scriptfiles/YSI/new test.txt 19 | scriptfiles/YSI/new_mode.EN 20 | scriptfiles/YSI/new_mode.PL 21 | scriptfiles/YSI/new_mode_format.YSI 22 | 23 | !README.md 24 | !CREDITS.md 25 | 26 | gamemodes/test.pwn -------------------------------------------------------------------------------- /CREDITS.md: -------------------------------------------------------------------------------- 1 | # Credits 2 | 3 | This gamemode would not exist without these wonderful people who put their time into creating their projects (and opensourcing it mostly). 4 | 5 | Y_Less - YSI, sscanf, contributions in almost every other project 6 | Slice - making Y_Less keep working on YSI 7 | Zeex - amx_assembly, crashdetect, pawncc 3.10, profiler 8 | BlueG - mysql plugin 9 | maddinat0r - turbocharged mysql plugin 10 | Incognito - streamer 11 | SPAWN_METAL - fast pawncc 3.10 12 | aoky - colourpicker 13 | 14 | 15 | And many more! -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Y Core 2 | 3 | This is an YSI-focused gamemode. It is extended by projects such as Y RP, but can be used as a standalone project. 4 | 5 | ## Conventions 6 | 7 | ### Player data 8 | 9 | For convinience, a macro was created to keep namespace clean and still allow easy access to data. 10 | Usage is simple and visible throught the project: 11 | 12 | ```pawn 13 | Player.RP[playerid][@name] 14 | ``` 15 | 16 | This means, if you want to add a new data category, you will have to adhere to the following naming convetion: 17 | 18 | ```pawn 19 | #define Category. OO_TYPE(CATEGORY,Category) 20 | 21 | enum E_CATEGORY_SUBCATEGORY { 22 | E_CATEGORY_Subcategory_id, 23 | E_CATEGORY_Subcategory_property 24 | } 25 | 26 | new CategorySubcategory[MAX_PLAYERS][OPTIONAL_DIMENSION][E_PLAYER_CATEGORY]; 27 | 28 | // Accesing 29 | new foo = Category.Subcategory[playerid][SOME_INDEX][@property]; 30 | ``` 31 | 32 | ### Coding style 33 | 34 | #### Indentation 35 | Tabs are used to keep in line with YSI style. 36 | 37 | #### Brackets 38 | 39 | Function block braces are put in a new line: 40 | ```pawn 41 | // Wrong 42 | Function() { 43 | 44 | } 45 | 46 | // Right 47 | Function() 48 | { 49 | 50 | } 51 | ``` 52 | 53 | This applies to inline functions as well. 54 | 55 | `if` directives however use 1TBS style 56 | 57 | 58 | #### Variable definitions 59 | 60 | When defining more than one variable, the following style is used: 61 | 62 | ```pawn 63 | new 64 | var1, 65 | var2 66 | ; 67 | ``` 68 | 69 | This allows quick new variable insertion without the risk of deleting semicolon. -------------------------------------------------------------------------------- /gamemodes/Y/Y.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_Y 2 | #undef _inc_Y 3 | #endif 4 | 5 | #if !defined Y_@@@@_HEADER 6 | #include "core\header" 7 | #include "db\header" 8 | #include "log\header" 9 | #include "debug\header" 10 | #include "utils\header" 11 | #include "language\header" 12 | 13 | #if defined Y_PLAYER_ENABLED 14 | #include "player\header" 15 | #endif 16 | 17 | #if defined Y_VEHICLE_ENABLED 18 | #include "vehicle\header" 19 | #endif 20 | 21 | #if defined Y_OBJECT_ENABLED 22 | #include "object\header" 23 | #endif 24 | 25 | #if defined Y_MODE_RP 26 | #include "RP\RP" 27 | #endif 28 | 29 | #define Y_@@@@_HEADER 30 | #elseif !defined Y_@@@@_END 31 | #include "core\impl" 32 | #include "db\impl" 33 | #include "debug\impl" 34 | #include "utils\impl" 35 | #include "language\impl" 36 | 37 | #if defined Y_PLAYER_ENABLED 38 | #include "player\impl" 39 | #endif 40 | 41 | #if defined Y_VEHICLE_ENABLED 42 | #include "vehicle\impl" 43 | #endif 44 | 45 | #if defined Y_OBJECT_ENABLED 46 | #include "object\impl" 47 | #endif 48 | 49 | #if defined Y_MODE_RP 50 | #include "RP\RP" 51 | #endif 52 | #define Y_@@@@_END 53 | #else 54 | #error Y core already set up 55 | #endif -------------------------------------------------------------------------------- /gamemodes/Y/core/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define OO_TYPE(%6,%7)%0[%1] (_:@vb:@va:%6:%7@%0[%1] 11 | #define @va:%6:%7@%0[%1][@%2] %7%0[%1])[E_%6_%0_%2] 12 | #define @vb:@va:%6:%7@%0[%1][%2][@%3] %7%0[%1])[%2][E_%6_%0_%3] 13 | 14 | #define SCM va_SendClientMessage 15 | 16 | #define ALS_DO_GroupInit<%0> %0(none:) 17 | 18 | new 19 | LoadedSystems = 0, 20 | TotalSystems = 0 21 | ; -------------------------------------------------------------------------------- /gamemodes/Y/core/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | #include 6 | 7 | hook OnGameModeInit() 8 | { 9 | Group_SetGlobalCommandDefault(false); 10 | 11 | SetColour("ERROR", X11_RED); 12 | SetColour("SUCCESS", X11_GREEN); 13 | SetColour("INFO", X11_LIGHT_BLUE); 14 | SetColour("NORMAL", X11_WHITE); 15 | 16 | defer onAllInitiated(); 17 | } 18 | 19 | timer onAllInitiated[100]() 20 | { 21 | call OnGroupInit(); 22 | } 23 | 24 | public OnQueryError(errorid, const error[], const callback[], const query[], MySQL:handle) 25 | { 26 | switch(errorid) { 27 | case CR_SERVER_GONE_ERROR: { 28 | err("Lost connection to server"); 29 | } 30 | case ER_SYNTAX_ERROR: { 31 | err("Something is wrong in your syntax, query: %s",query); 32 | } 33 | default: { 34 | err("Other mysql error %d %s (callback %s), query %s", errorid, error, callback, query); 35 | } 36 | } 37 | return 1; 38 | } 39 | 40 | FadeToWhite(colour, Float:percent) 41 | { 42 | if (percent <= 0.0) { 43 | return colour; 44 | } 45 | 46 | if (percent >= 1.0) { 47 | return 0xFFFFFF; 48 | } 49 | 50 | new 51 | r = (colour >> 16) & 0xFF, 52 | g = (colour >> 8) & 0xFF, 53 | b = colour & 0xFF, 54 | dr = floatround((0xFF - r) * percent), 55 | dg = floatround((0xFF - g) * percent), 56 | db = floatround((0xFF - b) * percent) 57 | ; 58 | 59 | return ((r + dr) << 16) + ((g + dg) << 8) + (b + db); 60 | } -------------------------------------------------------------------------------- /gamemodes/Y/db/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #include 6 | #include 7 | 8 | #define INVALID_DB_ID DBID:0 9 | 10 | static stock DBID:__DBID__; 11 | 12 | new MySQL:dbhandle; -------------------------------------------------------------------------------- /gamemodes/Y/db/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | #include 6 | 7 | hook OnGameModeInit() 8 | { 9 | mysql_log(ALL); 10 | 11 | new MySQLOpt:options = mysql_init_options(); 12 | mysql_set_option(options, POOL_SIZE, MYSQL_POOL_SIZE); 13 | 14 | dbhandle = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB, options); 15 | 16 | if (dbhandle == MYSQL_INVALID_HANDLE || mysql_errno(dbhandle) != 0) { 17 | print("MySQL connection failed. Server is shutting down."); 18 | SendRconCommand("exit"); 19 | } else { 20 | print("MySQL connection established"); 21 | } 22 | 23 | return 1; 24 | } 25 | 26 | hook OnGameModeExit() 27 | { 28 | mysql_close(dbhandle); 29 | 30 | return 1; 31 | } -------------------------------------------------------------------------------- /gamemodes/Y/debug/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #include -------------------------------------------------------------------------------- /gamemodes/Y/debug/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | #include 6 | 7 | hook OnGroupInit() 8 | { 9 | GROUP_ADD 10 | { 11 | @YCMD:setmoney; 12 | } 13 | 14 | return 1; 15 | } 16 | 17 | YCMD:setmoney(playerid, params[], help) 18 | { 19 | if(help) return SCM(playerid, -1, "Not supported"); 20 | new money; 21 | 22 | if (sscanf(params, "d", money)) return SCM(playerid, -1, "/setmoney [money]"); 23 | 24 | ResetPlayerMoney(playerid); 25 | GivePlayerMoney(playerid, money); 26 | 27 | return 1; 28 | } -------------------------------------------------------------------------------- /gamemodes/Y/language/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #include 6 | 7 | #define MAX_Y_LANGUAGES 5 8 | 9 | new 10 | Language:Languages[MAX_Y_LANGUAGES] = { NO_LANGUAGE, ... } 11 | ; -------------------------------------------------------------------------------- /gamemodes/Y/language/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | #include 6 | 7 | hook OnGameModeInit() 8 | { 9 | Languages[0] = Langs_Add("EN", "English"); 10 | 11 | return 1; 12 | } 13 | 14 | hook OnPlayerConnect(playerid) 15 | { 16 | Langs_SetPlayerLanguage(playerid, Languages[0]); 17 | 18 | return 1; 19 | } -------------------------------------------------------------------------------- /gamemodes/Y/language/tests.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Y-samp/Y-Core/aca42da9a604dccc394b7dc7fe331b4198a7946e/gamemodes/Y/language/tests.inc -------------------------------------------------------------------------------- /gamemodes/Y/log/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #if defined Y_DEBUG 6 | #define log printf 7 | #define err printf 8 | #else 9 | log(...) {} 10 | err(...) {} 11 | #endif -------------------------------------------------------------------------------- /gamemodes/Y/object/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #include 6 | 7 | #define MAX_OBJECT_NAME 32 8 | 9 | new 10 | TotalObjects = 0, 11 | LoadedObjects = 0 12 | ; 13 | 14 | enum E_OBJECT { 15 | DBID:E_OBJECT_id, 16 | E_OBJECT_model, 17 | Float:E_OBJECT_pos[3], 18 | Float:E_OBJECT_rot[3], 19 | E_OBJECT_int, 20 | E_OBJECT_world, 21 | E_OBJECT_object 22 | } 23 | 24 | new _Object[Y_OBJECT_TOTAL][E_OBJECT]; 25 | new Iterator:Object; 26 | 27 | #define Object[%1][@%2] _Object[%1][E_OBJECT_%2] 28 | 29 | #define ALS_DO_LoadObjects<%0> %0(none:) 30 | 31 | #define OBJECT_TABLE "objects" -------------------------------------------------------------------------------- /gamemodes/Y/object/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | #include 6 | 7 | hook OnGameModeInit() 8 | { 9 | defer CheckIfSystemsLoaded(); 10 | } 11 | 12 | CreateManagedObject(index) 13 | { 14 | Object[index][@object] = CreateDynamicObject( 15 | Object[index][@model], 16 | Object[index][@pos][0], 17 | Object[index][@pos][1], 18 | Object[index][@pos][2], 19 | Object[index][@rot][0], 20 | Object[index][@rot][1], 21 | Object[index][@rot][2], 22 | Object[index][@world], 23 | Object[index][@int] 24 | ); 25 | } 26 | 27 | timer CheckIfSystemsLoaded[500]() 28 | { 29 | if (TotalSystems != 0 && LoadedSystems == TotalSystems) { 30 | call OnLoadObjects(); 31 | 32 | return 1; 33 | } 34 | 35 | defer CheckIfSystemsLoaded(); 36 | 37 | return 1; 38 | } -------------------------------------------------------------------------------- /gamemodes/Y/player/admin/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | new Group:AdminGroup[Y_PLAYER_ADMIN_MAX_LEVEL]; -------------------------------------------------------------------------------- /gamemodes/Y/player/admin/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | #include 6 | 7 | loadtext y[core], y_players[admin]; 8 | 9 | hook OnGameModeInit() 10 | { 11 | CreateAdminGroups(); 12 | 13 | Command_AddAlt(YCMD:setadminlevel, "sal"); 14 | } 15 | 16 | hook OnGroupInit() 17 | { 18 | Group_AddChild(AdminGroup[0], DeveloperGroup); 19 | 20 | GROUP_ADD 21 | { 22 | @YCMD:setadminlevel; 23 | @YCMD:sal; 24 | } 25 | 26 | return 1; 27 | } 28 | 29 | // http://forum.sa-mp.com/showpost.php?p=2894606&postcount=3 30 | hook OnRconLoginAttempt(ip[], password[], success) 31 | { 32 | if (success) { 33 | defer RetrieveRconPlayer(ip); 34 | } 35 | 36 | return 1; 37 | } 38 | 39 | hook OnPlayerRconLogin(playerid) 40 | { 41 | SetAdminLevel(playerid, Y_PLAYER_ADMIN_MAX_LEVEL, true); 42 | 43 | return 1; 44 | } 45 | 46 | timer RetrieveRconPlayer[1000](string:ip[]) 47 | { 48 | new ip2 = IPToInt(ip); 49 | 50 | foreach(new player:Player) { 51 | if (Player.Status[player][@ip] == ip2 && IsPlayerAdmin(player)) { 52 | CallRemoteFunction("OnPlayerRconLogin", "i", player); 53 | 54 | return 1; 55 | } 56 | } 57 | 58 | return 1; 59 | } 60 | 61 | CreateAdminGroups() 62 | { 63 | for (new i = 0; i != Y_PLAYER_ADMIN_MAX_LEVEL; ++i) { 64 | new name[32]; 65 | format(name, sizeof name, "Admin level %d", i + 1); 66 | AdminGroup[i] = Group_Create(name); 67 | 68 | if (i > 0) { 69 | Group_AddChild(AdminGroup[i], AdminGroup[i - 1]); 70 | } 71 | } 72 | } 73 | 74 | ClearAdminLevel(playerid) 75 | { 76 | if (Player.Status[playerid][@admin] > 0) { 77 | Group_SetPlayer(AdminGroup[Player.Status[playerid][@admin] - 1], playerid, false); 78 | } 79 | } 80 | 81 | SetAdminLevel(playerid, level, bool:force = false) 82 | { 83 | if (!force && IsPlayerAdmin(playerid)) { 84 | return 2; 85 | } 86 | 87 | ClearAdminLevel(playerid); 88 | 89 | if (!(1 <= level <= Y_PLAYER_ADMIN_MAX_LEVEL)) { 90 | log("Player %d admin level cannot be set to %d", playerid, level); 91 | 92 | return 1; 93 | } 94 | 95 | Group_SetPlayer(AdminGroup[level - 1], playerid, true); 96 | Player.Status[playerid][@admin] = level; 97 | 98 | return 0; 99 | } 100 | 101 | bool:IsAdminLevel(playerid, level) 102 | { 103 | if (IsPlayerAdmin(playerid)) { 104 | return true; 105 | } 106 | 107 | if (1 <= level <= Y_PLAYER_ADMIN_MAX_LEVEL) { 108 | return Group_GetPlayer(AdminGroup[level - 1], playerid); 109 | } 110 | 111 | return false; 112 | } 113 | 114 | YCMD:setadminlevel(playerid, params[], help) 115 | { 116 | if(help) return SCM(playerid, -1, "Not supported"); 117 | 118 | new 119 | targetid, 120 | level, 121 | announce 122 | ; 123 | 124 | if (sscanf(params, "udD(0)", targetid, level, announce)) return Text_Send(playerid, $INVALID_COMMAND_PARAMS_SAL, YCMD:sal); 125 | if (targetid == playerid) return Text_Send(playerid, $CANNOT_USE_ON_SELF); 126 | if (!IsPlayerConnected(targetid)) return Text_Send(playerid, $INVALID_PLAYER_SPECIFIED); 127 | if (Player.Status[playerid][@admin] <= Player.Status[targetid][@admin]) return Text_Send(playerid, $UNAUTHORIZED_ACTION); 128 | 129 | new sal = SetAdminLevel(targetid, level); 130 | if(sal) { 131 | if (sal == 1) return Text_Send(playerid, $INVALID_LEVEL_SPECIFIED, 1, Y_PLAYER_ADMIN_MAX_LEVEL); 132 | else if (sal == 2) return Text_Send(playerid, $UNAUTHORIZED_ACTION); 133 | } 134 | 135 | Text_Send(playerid, $ACTION_SUCCESS); 136 | Text_Send(AdminGroup[0], $ADMIN_LEVEL_CHANGE, Player.Auth[targetid][@name], level, Player.Auth[playerid][@name]); 137 | 138 | if (announce) { 139 | Text_Send(LoggedGroup, $ADMIN_LEVEL_CHANGE, Player.Auth[targetid][@name], level, Player.Auth[playerid][@name]); 140 | } 141 | 142 | #if defined Y_PLAYER_REQUIRE_ACCOUNT 143 | new query[80]; 144 | mysql_format(dbhandle, query, sizeof query, "UPDATE player_statuses SET admin = %d WHERE player_id = %d", Player.Status[targetid][@admin], _:Player.Auth[targetid][@id]); 145 | mysql_pquery(dbhandle, query); 146 | #endif 147 | 148 | return 1; 149 | } -------------------------------------------------------------------------------- /gamemodes/Y/player/auth/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | enum E_PLAYER_AUTH { 10 | DBID:E_PLAYER_Auth_id, 11 | E_PLAYER_Auth_name[MAX_PLAYER_NAME + 1], 12 | E_PLAYER_Auth_password[64 + 1], 13 | E_PLAYER_Auth_salt[64 + 1] 14 | } 15 | 16 | new PlayerAuth[MAX_PLAYERS][E_PLAYER_AUTH]; 17 | 18 | new 19 | Group:LoggedGroup 20 | ; 21 | 22 | #define IsLoggedIn(%0) Group_GetPlayer(LoggedGroup, %0) 23 | 24 | #define PLAYER_TABLE "players" -------------------------------------------------------------------------------- /gamemodes/Y/player/auth/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | #include 6 | 7 | loadtext y_players[auth]; 8 | 9 | hook OnGameModeInit() 10 | { 11 | LoggedGroup = Group_Create("Logged in"); 12 | 13 | return 1; 14 | } 15 | 16 | hook OnPlayerConnect(playerid) 17 | { 18 | if (funcidx(Y_PLAYER_RESTRICT_NAME_FUNC) != -1) { 19 | new ret = CallLocalFunction(Y_PLAYER_RESTRICT_NAME_FUNC, "i", playerid); 20 | 21 | if(ret != 1) { 22 | return 1; 23 | } 24 | } 25 | 26 | #if defined Y_PLAYER_REQUIRE_ACCOUNT 27 | FetchPlayer(playerid); 28 | #else 29 | defer DelayedLogin(playerid); 30 | #endif 31 | 32 | SetSpawnInfo(playerid, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0); 33 | 34 | return 1; 35 | } 36 | 37 | hook OnPlayerLogin(playerid) 38 | { 39 | log("OPL Called"); 40 | Group_SetPlayer(LoggedGroup, playerid, true); 41 | SpawnPlayer(playerid); 42 | 43 | return 1; 44 | } 45 | 46 | hook OnPlayerRequestClass(playerid, classid) 47 | { 48 | #if defined Y_PLAYER_REQUIRE_ACCOUNT 49 | TogglePlayerSpectating(playerid, true); 50 | #endif 51 | 52 | return 1; 53 | } 54 | 55 | hook OnPlayerSpawn(playerid) 56 | { 57 | TogglePlayerSpectating(playerid, false); 58 | 59 | return 1; 60 | } 61 | 62 | GetPlayerIndexFromDBID(DBID:dbid) 63 | { 64 | foreach (new player:Player) { 65 | if (Player.Auth[player][@id] == dbid) { 66 | return _:player; 67 | } 68 | } 69 | 70 | return INVALID_PLAYER_ID; 71 | } 72 | 73 | #if defined Y_PLAYER_REQUIRE_ACCOUNT 74 | FetchPlayer(playerid) 75 | { 76 | new query[64 + MAX_PLAYER_NAME + 1]; 77 | new name[MAX_PLAYER_NAME + 1]; 78 | GetPlayerName(playerid, name, sizeof name); 79 | 80 | strcpy(Player.Auth[playerid][@name], name); 81 | 82 | mysql_format(dbhandle, query, sizeof query, "SELECT id, password, salt FROM " PLAYER_TABLE " WHERE name = '%e'", name); 83 | 84 | inline PlayerFetched() 85 | { 86 | if (cache_num_rows()) { 87 | cache_get_value_name_int(0, "id", _:Player.Auth[playerid][@id]); 88 | cache_get_value_name(0, "password", Player.Auth[playerid][@password]); 89 | cache_get_value_name(0, "salt", Player.Auth[playerid][@salt]); 90 | @return ShowLoginDialog(playerid); 91 | } 92 | 93 | #if defined Y_PLAYER_REGISTRATION 94 | @return ShowRegistrationDialog(playerid); 95 | #else 96 | Text_Send(playerid, $REGISTRAION_VIA_WEBSITE); 97 | defer TimedKick(playerid); 98 | @return 1; 99 | #endif 100 | } 101 | 102 | mysql_tquery_inline(dbhandle, query, using inline PlayerFetched); 103 | 104 | } 105 | #else 106 | timer DelayedLogin[100](playerid) 107 | { 108 | call OnPlayerLogin(playerid); 109 | } 110 | #endif -------------------------------------------------------------------------------- /gamemodes/Y/player/core/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #define Player. OO_TYPE(PLAYER,Player) 6 | 7 | // static stock @vb:foo; 8 | 9 | #define ALS_DO_PlayerEnter<%0> %0(end:playerid) 10 | 11 | new 12 | Group:DeveloperGroup 13 | ; 14 | 15 | #define IsDeveloper(%0) Group_GetPlayer(DeveloperGroup, %0) 16 | 17 | #define ALS_DO_PlayerStats<%0> %0(end:playerid) -------------------------------------------------------------------------------- /gamemodes/Y/player/core/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | #include 6 | 7 | hook OnGameModeInit() 8 | { 9 | DeveloperGroup = Group_Create("Developer"); 10 | 11 | return 1; 12 | } 13 | 14 | hook OnGroupInit() 15 | { 16 | GROUP_ADD 17 | { 18 | @YCMD:enter; 19 | } 20 | 21 | return 1; 22 | } 23 | 24 | YCMD:enter(playerid, params[], help) 25 | { 26 | if(help) return SCM(playerid, -1, "Not supported"); 27 | 28 | call OnPlayerEnter(playerid); 29 | 30 | return 1; 31 | } -------------------------------------------------------------------------------- /gamemodes/Y/player/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #include "auth\header" 6 | #include "core\header" 7 | 8 | #if defined Y_PLAYER_REQUIRE_ACCOUNT 9 | #include "login\header" 10 | #include "registration\header" 11 | #endif 12 | 13 | #include "status\header" 14 | 15 | #if defined Y_PLAYER_VEHICLE_ENABLED 16 | #include "vehicle\header" 17 | #endif 18 | 19 | #include "admin\header" -------------------------------------------------------------------------------- /gamemodes/Y/player/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | #include "auth\impl" 6 | #include "core\impl" 7 | 8 | #if defined Y_PLAYER_REQUIRE_ACCOUNT 9 | #include "login\impl" 10 | #include "registration\impl" 11 | #endif 12 | 13 | #include "status\impl" 14 | 15 | #if defined Y_PLAYER_VEHICLE_ENABLED 16 | #include "vehicle\impl" 17 | #endif 18 | 19 | #include "admin\impl" -------------------------------------------------------------------------------- /gamemodes/Y/player/login/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #include 6 | #include 7 | #include 8 | #include -------------------------------------------------------------------------------- /gamemodes/Y/player/login/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | #include 6 | 7 | loadtext y_players[auth]; 8 | 9 | static 10 | Timer:inactivityKick[MAX_PLAYERS] 11 | ; 12 | 13 | hook OnPlayerDisconnect(playerid, reason) 14 | { 15 | stop inactivityKick[playerid]; 16 | 17 | return 1; 18 | } 19 | 20 | hook OnPlayerLogin(playerid) 21 | { 22 | printf("Player %d logged in", playerid); 23 | ClearPlayerMeta(playerid); 24 | 25 | return 1; 26 | } 27 | 28 | timer KickOnInactivity[30000](playerid) 29 | { 30 | Text_Send(playerid, $INACTIVE_KICK); 31 | defer TimedKick(playerid); 32 | } 33 | 34 | timer LoginNextAttempt[500](playerid, attempt) 35 | { 36 | ShowLoginDialog(playerid, attempt); 37 | } 38 | 39 | ShowLoginDialog(playerid, attempt = 1) 40 | { 41 | new 42 | error[32] 43 | ; 44 | 45 | inactivityKick[playerid] = repeat KickOnInactivity[Y_PLAYER_LOGIN_TIMEOUT_KICK * 1000](playerid); 46 | 47 | if (attempt > 1) { 48 | Text_Format_Dialog(error, sizeof error, Langs_GetPlayerLanguage(playerid), $INVALID_PASSWORD); 49 | } 50 | 51 | if (attempt >= Y_PLAYER_LOGIN_MAX_ATTEMPTS) { 52 | Text_Send(playerid, $EXCEEDED_MAX_LOGIN_ATTEMPTS, Y_PLAYER_LOGIN_MAX_ATTEMPTS); 53 | defer TimedKick(playerid); 54 | } 55 | 56 | inline HandleLogin(pid, dialogid, response, listitem, string:inputtext[]) 57 | { 58 | #pragma unused pid, dialogid, listitem 59 | 60 | stop inactivityKick[playerid]; 61 | 62 | if (!response) { 63 | defer TimedKick(playerid); 64 | @return 1; 65 | } 66 | 67 | if (CheckUserPassword(playerid, inputtext)) { 68 | call OnPlayerLogin(playerid); 69 | } else { 70 | defer LoginNextAttempt[500](playerid, attempt + 1); 71 | } 72 | } 73 | 74 | Text_PasswordBox(playerid, using inline HandleLogin, $LOGIN_BOX_TITLE, $LOGIN_BOX_TEXT, $LOGIN_BOX_LOGIN, $LOGIN_BOX_EXIT, error, attempt, Y_PLAYER_LOGIN_MAX_ATTEMPTS); 75 | 76 | return 1; 77 | } 78 | 79 | CheckUserPassword(playerid, const password[]) 80 | { 81 | new 82 | peppered[128 + Y_PLAYER_PEPPER_SIZE + 1], 83 | hash[64 + 1] 84 | ; 85 | 86 | strcpy(peppered, Y_PLAYER_PASSWORD_PEPPER); 87 | strcat(peppered, password); 88 | 89 | SHA256_PassHash(peppered, Player.Auth[playerid][@salt], hash, sizeof hash); 90 | 91 | if (!strcmp(hash, Player.Auth[playerid][@password])) return true; 92 | 93 | return false; 94 | } 95 | 96 | ClearPlayerMeta(playerid) 97 | { 98 | memset(PlayerAuth[playerid][E_PLAYER_Auth_password], 0); 99 | memset(PlayerAuth[playerid][E_PLAYER_Auth_salt], 0); 100 | } -------------------------------------------------------------------------------- /gamemodes/Y/player/registration/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | enum e_ERROR_PASSWORD { 10 | e_ERROR_PASSWORD_NONE, 11 | e_ERROR_PASSWORD_EMPTY, 12 | e_ERROR_PASSWORD_SHORT, 13 | e_ERROR_PASSWORD_LONG 14 | } 15 | 16 | enum e_SALT { 17 | SALT_NONE, 18 | SALT_WEAK, 19 | SALT_REMOTE_STRONG 20 | } 21 | 22 | #if !defined Y_PLAYER_SALT_GENERATOR 23 | #define Y_PLAYER_SALT_GENERATOR SALT_WEAK 24 | #endif 25 | 26 | #define ALS_DO_PlayerRegister<%0> %0(end:playerid) 27 | -------------------------------------------------------------------------------- /gamemodes/Y/player/registration/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | #include 6 | 7 | loadtext y_players[auth]; 8 | 9 | hook OnPlayerRegister(playerid) 10 | { 11 | printf("Player %d registered", playerid); 12 | #if defined Y_PLAYER_LOGIN_AFTER_REG 13 | call OnPlayerLogin(playerid); 14 | #else 15 | FetchPlayer(playerid); 16 | #endif 17 | 18 | return 1; 19 | } 20 | 21 | ShowRegistrationDialog(playerid, e_ERROR_PASSWORD:errorCode = e_ERROR_PASSWORD_NONE) 22 | { 23 | new 24 | error[64] 25 | ; 26 | 27 | if (errorCode != e_ERROR_PASSWORD_NONE) { 28 | switch (errorCode) { 29 | case e_ERROR_PASSWORD_EMPTY: { 30 | Text_Format_Dialog(error, sizeof error, Langs_GetPlayerLanguage(playerid), $PASSWORD_EMPTY); 31 | } 32 | case e_ERROR_PASSWORD_SHORT: { 33 | Text_Format_Dialog(error, sizeof error, Langs_GetPlayerLanguage(playerid), $PASSWORD_TOO_SHORT, Y_PLAYER_REGISTRATION_MIN_PASS_LENGTH); 34 | } 35 | case e_ERROR_PASSWORD_LONG: { 36 | Text_Format_Dialog(error, sizeof error, Langs_GetPlayerLanguage(playerid), $PASSWORD_TOO_LONG, Y_PLAYER_REGISTRATION_MAX_PASS_LENGTH); 37 | } 38 | } 39 | } 40 | 41 | inline HandleRegistration(pid, dialogid, response, listitem, string:inputtext[]) 42 | { 43 | #pragma unused pid, dialogid, listitem 44 | 45 | if (!response) { 46 | defer TimedKick(playerid); 47 | @return 1; 48 | } 49 | 50 | CheckRegistrationPassword(playerid, inputtext); 51 | } 52 | 53 | Text_PasswordBox(playerid, using inline HandleRegistration, $REGISTRATION_BOX_TITLE, $REGISTRATION_BOX_TEXT, $REGISTRATION_BOX_REGISTER, $REGISTRATION_BOX_EXIT, error, Y_PLAYER_REGISTRATION_MIN_PASS_LENGTH, Y_PLAYER_REGISTRATION_MAX_PASS_LENGTH); 54 | 55 | return 1; 56 | } 57 | 58 | CheckRegistrationPassword(playerid, password[]) 59 | { 60 | new len = strlen(password); 61 | 62 | if (isnull(password)) { 63 | return ShowRegistrationDialog(playerid, e_ERROR_PASSWORD_EMPTY); 64 | } 65 | 66 | if (len < Y_PLAYER_REGISTRATION_MIN_PASS_LENGTH) { 67 | return ShowRegistrationDialog(playerid, e_ERROR_PASSWORD_SHORT); 68 | } 69 | 70 | if (len > Y_PLAYER_REGISTRATION_MAX_PASS_LENGTH) { 71 | return ShowRegistrationDialog(playerid, e_ERROR_PASSWORD_LONG); 72 | } 73 | 74 | return Register(playerid, password); 75 | } 76 | 77 | Register(playerid, const password[]) 78 | { 79 | new 80 | salt[32 + 1], 81 | peppered[128 + Y_PLAYER_PEPPER_SIZE + 1], 82 | hash[64 + 1] 83 | ; 84 | GenerateSalt(salt); 85 | 86 | strcpy(peppered, Y_PLAYER_PASSWORD_PEPPER); 87 | strcat(peppered, password); 88 | 89 | SHA256_PassHash(peppered, salt, hash, sizeof hash); 90 | 91 | strcpy(Player.Auth[playerid][@salt], salt); 92 | strcpy(Player.Auth[playerid][@password], hash); 93 | 94 | new 95 | query[256] 96 | ; 97 | 98 | mysql_format(dbhandle, query, sizeof query, "INSERT INTO players VALUES (null, '%e', '%e', '%e', NOW())", Player.Auth[playerid][@name], Player.Auth[playerid][@password], Player.Auth[playerid][@salt]); 99 | 100 | inline SavePlayer() 101 | { 102 | Player.Auth[playerid][@id] = DBID:cache_insert_id(); 103 | call OnPlayerRegister(playerid); 104 | } 105 | 106 | mysql_tquery_inline(dbhandle, query, using inline SavePlayer); 107 | 108 | return 1; 109 | } 110 | 111 | GenerateSalt(dest[], size = sizeof dest) 112 | { 113 | randomString(dest, size - 1); 114 | } -------------------------------------------------------------------------------- /gamemodes/Y/player/registration/tests.inc: -------------------------------------------------------------------------------- 1 | Test:generateSalt() 2 | { 3 | new dest[20 + 1]; 4 | GenerateSalt(dest); 5 | ASSERT(strlen(dest) == 20); 6 | } -------------------------------------------------------------------------------- /gamemodes/Y/player/status/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #include 6 | #include 7 | 8 | enum E_PLAYER_STATUS { 9 | E_PLAYER_Status_ip, 10 | E_PLAYER_Status_money, 11 | E_PLAYER_Status_vip, 12 | E_PLAYER_Status_admin, 13 | bool:E_PLAYER_Status_developer 14 | } 15 | 16 | new PlayerStatus[MAX_PLAYERS][E_PLAYER_STATUS]; -------------------------------------------------------------------------------- /gamemodes/Y/player/status/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | #include 6 | 7 | loadtext y_players[status]; 8 | 9 | hook OnGroupInit() 10 | { 11 | GROUP_ADD 12 | { 13 | @YCMD:stats; 14 | } 15 | } 16 | 17 | hook OnPlayerLogin(playerid) 18 | { 19 | #if defined Y_PLAYER_REQUIRE_ACCOUNT 20 | inline FetchedPlayerStatus() 21 | { 22 | if (!cache_num_rows()) { 23 | @return log("Did not find player %d status data", playerid); 24 | } 25 | 26 | cache_get_value_name_int(0, "vip", Player.Status[playerid][@vip]); 27 | cache_get_value_name_int(0, "money", Player.Status[playerid][@money]); 28 | 29 | new admin = 0; 30 | cache_get_value_name_int(0, "admin", admin); 31 | Player.Status[playerid][@admin] = admin; 32 | 33 | if (admin > 0) { 34 | Group_SetPlayer(AdminGroup[admin - 1], playerid, true); 35 | } 36 | 37 | new dev = 0; 38 | cache_get_value_name_int(0, "developer", dev); 39 | Player.Status[playerid][@developer] = !!dev; 40 | 41 | if (Player.Status[playerid][@developer]) { 42 | Group_SetPlayer(DeveloperGroup, playerid, true); 43 | } 44 | 45 | @return log("Loaded player %d status data", playerid); 46 | } 47 | 48 | new query[80]; 49 | mysql_format(dbhandle, query, sizeof query, "SELECT * FROM player_statuses WHERE player_id = %d LIMIT 1", _:Player.Auth[playerid][@id]); 50 | mysql_tquery_inline(dbhandle, query, using inline FetchedPlayerStatus); 51 | #endif 52 | 53 | new ip[16]; 54 | GetPlayerIp(playerid, ip, sizeof ip); 55 | Player.Status[playerid][@ip] = IPToInt(ip); 56 | 57 | return 1; 58 | } 59 | 60 | #if defined Y_PLAYER_REQUIRE_ACCOUNT 61 | hook OnPlayerRegister(playerid) 62 | { 63 | new query[128]; 64 | mysql_format(dbhandle, query, sizeof query, "INSERT INTO player_statuses(player_id) VALUES(%d)", _:Player.Auth[playerid][@id]); 65 | mysql_pquery(dbhandle, query); 66 | 67 | return 1; 68 | } 69 | #endif 70 | 71 | hook OnPlayerStats(playerid) 72 | { 73 | Text_Send(playerid, $PLAYER_STATS, Player.Status[playerid][@money], Player.Status[playerid][@developer] ? "Yes" : "No", Player.Status[playerid][@vip] ? "Yes" : "No", Player.Status[playerid][@admin]); 74 | 75 | return 1; 76 | } 77 | 78 | hook OnPlayerDisconnect(playerid, reason) 79 | { 80 | memset(PlayerStatus[playerid][E_PLAYER_STATUS:0], _:E_PLAYER_STATUS, 0); 81 | 82 | return 1; 83 | } 84 | 85 | YCMD:stats(playerid, params[], help) 86 | { 87 | if(help) return SCM(playerid, -1, "Not supported"); 88 | 89 | call OnPlayerStats(playerid); 90 | 91 | return 1; 92 | } -------------------------------------------------------------------------------- /gamemodes/Y/player/tests.inc: -------------------------------------------------------------------------------- 1 | #include "registration\headertests" -------------------------------------------------------------------------------- /gamemodes/Y/player/vehicle/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #if !defined Y_VEHICLE_ENABLED 6 | #error Player vehicles require Vehicles module to be enabled 7 | #endif 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | enum E_PLAYER_VEHICLE { 15 | E_PLAYER_Vehicle_index 16 | } 17 | 18 | new 19 | PlayerVehicle[MAX_PLAYERS][Y_PLAYER_VEHICLE_MAX_OWNED][E_PLAYER_VEHICLE], 20 | Iterator:PlayerVehicle[MAX_PLAYERS] 21 | ; -------------------------------------------------------------------------------- /gamemodes/Y/player/vehicle/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | #include 6 | 7 | loadtext y_vehicles[status]; 8 | 9 | #if defined Y_PLAYER_REQUIRE_ACCOUNT 10 | hook OnPlayerLogin(playerid) 11 | { 12 | inline FetchCars() { 13 | new rows = cache_num_rows(); 14 | if (!rows) @return 1; 15 | 16 | for (new row = 0; row != rows; ++row) { 17 | new idx = Iter_Free(PlayerVehicle[playerid]); 18 | if (idx == INVALID_ITERATOR_SLOT) { 19 | @return print("PlayerVehicles if full"); 20 | } 21 | 22 | new vid = GetFreeVehicleSlot(); 23 | Player.Vehicle[playerid][idx][@index] = vid; 24 | Iter_Add(PlayerVehicle[playerid], idx); 25 | 26 | cache_get_value_name_int(row, "id", _:Vehicle.Meta[vid][@id]); 27 | cache_get_value_name_int(row, "model", Vehicle.Meta[vid][@model]); 28 | cache_get_value_name_float(row, "X", Vehicle.Status[vid][@pos][0]); 29 | cache_get_value_name_float(row, "Y", Vehicle.Status[vid][@pos][1]); 30 | cache_get_value_name_float(row, "Z", Vehicle.Status[vid][@pos][2]); 31 | cache_get_value_name_float(row, "R", Vehicle.Status[vid][@rot]); 32 | cache_get_value_name_int(row, "color_1", Vehicle.Status[vid][@color][0]); 33 | cache_get_value_name_int(row, "color_2", Vehicle.Status[vid][@color][1]); 34 | 35 | CreateVehicle( 36 | Vehicle.Meta[vid][@model], 37 | Vehicle.Status[vid][@pos][0], 38 | Vehicle.Status[vid][@pos][1], 39 | Vehicle.Status[vid][@pos][2], 40 | Vehicle.Status[vid][@rot], 41 | -1, 42 | -1, 43 | -1 44 | ); 45 | 46 | log("Loaded player vehicle in slot %d (dbid %d)", idx, _:Vehicle.Meta[vid][@id]); 47 | } 48 | } 49 | 50 | new 51 | query[128] 52 | ; 53 | 54 | mysql_format(dbhandle, query, sizeof query, "SELECT * FROM vehicles WHERE player_id = %d", _:Player.Auth[playerid][@id]); 55 | mysql_tquery_inline(dbhandle, query, using inline FetchCars); 56 | 57 | return 1; 58 | } 59 | #endif 60 | 61 | hook OnPlayerDisconnect(playerid, reason) 62 | { 63 | foreach (new vehicle:PlayerVehicle[playerid]) { 64 | DestroyVehicle(Player.Vehicle[playerid][vehicle][@index]); 65 | } 66 | 67 | Iter_Clear(PlayerVehicle[playerid]); 68 | 69 | return 1; 70 | } 71 | 72 | hook OnPlayerStats(playerid) 73 | { 74 | new 75 | vehicles[144], 76 | i = 1 77 | ; 78 | 79 | foreach (new vehicle:PlayerVehicle[playerid]) { 80 | new 81 | str[32], 82 | id 83 | ; 84 | 85 | #if defined Y_PLAYER_REQUIRE_ACCOUNT 86 | id = _:Vehicle.Meta[Player.Vehicle[playerid][vehicle][@index]][@id]; 87 | #else 88 | id = Player.Vehicle[playerid][index][@vehicle]; 89 | #endif 90 | 91 | Text_Format_Client(str, sizeof str, Langs_GetPlayerLanguage(playerid), $VEHICLE_STATS, i, id); 92 | strcat(vehicles, str); 93 | i++; 94 | } 95 | 96 | if (vehicles[0] != EOS) { 97 | SCM(playerid, -1, vehicles); 98 | } 99 | 100 | return 1; 101 | } 102 | 103 | #if defined Y_PLAYER_REQUIRE_ACCOUNT 104 | SavePlayerVehicle(playerid, vehicleid) 105 | { 106 | inline SavedVehicle() 107 | { 108 | Vehicle.Meta[vehicleid][@id] = DBID:cache_insert_id(); 109 | } 110 | 111 | new query[128]; 112 | mysql_format( 113 | dbhandle, 114 | query, 115 | sizeof query, 116 | "INSERT INTO vehicles VALUES (null, %d, %d, %.2f, %.2f, %.2f, %.2f, %d, %d)", 117 | _:Player.Auth[playerid][@id], 118 | Vehicle.Meta[vehicleid][@model], Vehicle.Status[vehicleid][@pos][0], Vehicle.Status[vehicleid][@pos][1], Vehicle.Status[vehicleid][@pos][2], 119 | Vehicle.Status[vehicleid][@rot], Vehicle.Status[vehicleid][@color][0], Vehicle.Status[vehicleid][@color][1] 120 | ); 121 | mysql_tquery_inline(dbhandle, query, using inline SavedVehicle); 122 | 123 | return 1; 124 | } 125 | #endif -------------------------------------------------------------------------------- /gamemodes/Y/utils/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #include -------------------------------------------------------------------------------- /gamemodes/Y/utils/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | timer TimedKick[100](playerid) 6 | { 7 | return Kick(playerid); 8 | } 9 | 10 | stock randomString(dest[], len) 11 | { 12 | while(len--) { 13 | dest[len] = random(2) ? (random(26) + (random(2) ? 'a' : 'A')) : (random(10) + '0'); 14 | } 15 | } -------------------------------------------------------------------------------- /gamemodes/Y/utils/tests.inc: -------------------------------------------------------------------------------- 1 | Test:randomString() 2 | { 3 | new dst[32]; 4 | randomString(dst, 32); 5 | ASSERT(strlen(dst) == 32); 6 | } -------------------------------------------------------------------------------- /gamemodes/Y/vehicle/core/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #if !defined Y_PLAYER_ENABLED 6 | #error Y vehicle requires Y players to be enabled 7 | #endif 8 | 9 | #include 10 | #include 11 | 12 | #define Vehicle. OO_TYPE(VEHICLE,Vehicle) 13 | 14 | // Vehicle information that does not change 15 | enum E_VEHICLE_META { 16 | DBID:E_VEHICLE_Meta_id, 17 | E_VEHICLE_Meta_model 18 | } 19 | 20 | // Working using default Vehicle iterator 21 | new VehicleMeta[MAX_VEHICLES][E_VEHICLE_META]; -------------------------------------------------------------------------------- /gamemodes/Y/vehicle/core/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | #include 6 | 7 | loadtext y[core], y_vehicles[core]; 8 | 9 | hook OnGroupInit() 10 | { 11 | GROUP_ADD 12 | { 13 | @YCMD:setvcolor; 14 | } 15 | } 16 | 17 | GetVehicleIDFromDBID(DBID:dbid) 18 | { 19 | foreach (new vehicle:Vehicle) { 20 | if (Vehicle.Meta[vehicle][@id] == dbid) { 21 | return _:vehicle; 22 | } 23 | } 24 | 25 | return INVALID_VEHICLE_ID; 26 | } 27 | 28 | GetFreeVehicleSlot() 29 | { 30 | Iter_Add(Vehicle, 0); 31 | new slot = Iter_Free(Vehicle); 32 | Iter_Remove(Vehicle, 0); 33 | 34 | return slot; 35 | } 36 | 37 | GetModelPrice(model) 38 | { 39 | if(model == 400) return 40000; 40 | else if(model == 401) return 30000; 41 | else if(model == 402) return 100000; 42 | else if(model == 403) return 90000; 43 | else if(model == 404) return 25000; 44 | else if(model == 405) return 40000; 45 | else if(model == 406) return 200000; 46 | else if(model == 408) return 80000; 47 | else if(model == 409) return 90000; 48 | else if(model == 410) return 25000; 49 | else if(model == 411) return 150000; 50 | else if(model == 412) return 60000; 51 | else if(model == 413) return 55000; 52 | else if(model == 414) return 75000; 53 | else if(model == 415) return 100000; 54 | else if(model == 417) return 250000; 55 | else if(model == 418) return 20000; 56 | else if(model == 419) return 30000; 57 | else if(model == 421) return 75000; 58 | else if(model == 422) return 60000; 59 | else if(model == 423) return 100000; 60 | else if(model == 424) return 85000; 61 | else if(model == 426) return 80000; 62 | else if(model == 428) return 40000; 63 | else if(model == 429) return 125000; 64 | else if(model == 434) return 150000; 65 | else if(model == 436) return 45000; 66 | else if(model == 439) return 55000; 67 | else if(model == 443) return 100000; 68 | else if(model == 444) return 175000; 69 | else if(model == 445) return 75000; 70 | else if(model == 446) return 175000; 71 | else if(model == 451) return 150000; 72 | else if(model == 452) return 175000; 73 | else if(model == 453) return 125000; 74 | else if(model == 454) return 130000; 75 | else if(model == 455) return 80000; 76 | else if(model == 456) return 70000; 77 | else if(model == 457) return 85000; 78 | else if(model == 458) return 50000; 79 | else if(model == 459) return 60000; 80 | else if(model == 460) return 215000; 81 | else if(model == 461) return 40000; 82 | else if(model == 462) return 20000; 83 | else if(model == 463) return 35000; 84 | else if(model == 466) return 70000; 85 | else if(model == 467) return 70000; 86 | else if(model == 468) return 35000; 87 | else if(model == 469) return 175000; 88 | else if(model == 471) return 15000; 89 | else if(model == 473) return 125000; 90 | else if(model == 474) return 65000; 91 | else if(model == 475) return 65000; 92 | else if(model == 477) return 100000; 93 | else if(model == 478) return 40000; 94 | else if(model == 479) return 75000; 95 | else if(model == 480) return 150000; 96 | else if(model == 481) return 5000; 97 | else if(model == 482) return 65000; 98 | else if(model == 483) return 70000; 99 | else if(model == 484) return 125000; 100 | else if(model == 485) return 30000; 101 | else if(model == 486) return 150000; 102 | else if(model == 487) return 200000; 103 | else if(model == 489) return 75000; 104 | else if(model == 491) return 60000; 105 | else if(model == 492) return 70000; 106 | else if(model == 493) return 200000; 107 | else if(model == 494) return 100000; 108 | else if(model == 495) return 90000; 109 | else if(model == 496) return 60000; 110 | else if(model == 498) return 80000; 111 | else if(model == 499) return 80000; 112 | else if(model == 500) return 70000; 113 | else if(model == 502) return 100000; 114 | else if(model == 503) return 100000; 115 | else if(model == 504) return 100000; 116 | else if(model == 505) return 75000; 117 | else if(model == 506) return 115000; 118 | else if(model == 507) return 75000; 119 | else if(model == 508) return 50000; 120 | else if(model == 509) return 2500; 121 | else if(model == 510) return 10000; 122 | else if(model == 511) return 215000; 123 | else if(model == 512) return 200000; 124 | else if(model == 513) return 220000; 125 | else if(model == 514) return 90000; 126 | else if(model == 515) return 90000; 127 | else if(model == 516) return 67500; 128 | else if(model == 517) return 70000; 129 | else if(model == 518) return 65000; 130 | else if(model == 519) return 300000; 131 | else if(model == 521) return 35000; 132 | else if(model == 522) return 75000; 133 | else if(model == 524) return 80000; 134 | else if(model == 526) return 65000; 135 | else if(model == 527) return 65000; 136 | else if(model == 529) return 70000; 137 | else if(model == 530) return 90000; 138 | else if(model == 531) return 40000; 139 | else if(model == 532) return 200000; 140 | else if(model == 533) return 70000; 141 | else if(model == 534) return 76000; 142 | else if(model == 535) return 80000; 143 | else if(model == 536) return 75000; 144 | else if(model == 539) return 150000; 145 | else if(model == 540) return 70000; 146 | else if(model == 541) return 150000; 147 | else if(model == 542) return 80000; 148 | else if(model == 543) return 50000; 149 | else if(model == 545) return 125000; 150 | else if(model == 546) return 70000; 151 | else if(model == 547) return 70000; 152 | else if(model == 549) return 60000; 153 | else if(model == 550) return 90000; 154 | else if(model == 551) return 80000; 155 | else if(model == 552) return 30000; 156 | else if(model == 553) return 250000; 157 | else if(model == 554) return 50000; 158 | else if(model == 555) return 50000; 159 | else if(model == 556) return 200000; 160 | else if(model == 557) return 200000; 161 | else if(model == 558) return 70000; 162 | else if(model == 559) return 70000; 163 | else if(model == 560) return 115000; 164 | else if(model == 561) return 50000; 165 | else if(model == 562) return 95000; 166 | else if(model == 563) return 200000; 167 | else if(model == 565) return 90000; 168 | else if(model == 566) return 70000; 169 | else if(model == 567) return 75000; 170 | else if(model == 568) return 50000; 171 | else if(model == 571) return 85000; 172 | else if(model == 572) return 15000; 173 | else if(model == 573) return 90000; 174 | else if(model == 575) return 80000; 175 | else if(model == 576) return 65000; 176 | else if(model == 578) return 90000; 177 | else if(model == 579) return 90000; 178 | else if(model == 580) return 75000; 179 | else if(model == 581) return 30000; 180 | else if(model == 583) return 25000; 181 | else if(model == 585) return 35000; 182 | else if(model == 586) return 20000; 183 | else if(model == 587) return 90000; 184 | else if(model == 588) return 90000; 185 | else if(model == 589) return 90000; 186 | else if(model == 592) return 350000; 187 | else if(model == 593) return 225000; 188 | else if(model == 600) return 50000; 189 | else if(model == 602) return 75000; 190 | else if(model == 603) return 100000; 191 | else if(model == 609) return 85000; 192 | else return 0; 193 | } 194 | 195 | YCMD:setvcolor(playerid, params[], help) 196 | { 197 | if(help) return SCM(playerid, -1, "Not supported"); 198 | 199 | new 200 | index, 201 | color[2] 202 | ; 203 | 204 | if (sscanf(params, "ddd", index, color[0], color[1])) return Text_Send(playerid, $INVALID_COMMAND_PARAMS_SETVCOLOR, YCMD:setvcolor); 205 | 206 | new id; 207 | #if defined Y_PLAYER_VEHICLE_ENABLED && !defined Y_PLAYER_REQUIRE_ACCOUNT 208 | if (!(1 <= index <= Iter_Size(PlayerVehicle[playerid]))) return Text_Send(playerid, $INVALID_VEHICLE_INDEX, 1, Iter_Size(PlayerVehicle[playerid])); 209 | if (!Iter_Contains(PlayerVehicle[playerid], index - 1)) return Text_Send(playerid, $INVALID_VEHICLE_INDEX_EMPTY); 210 | 211 | id = Player.Vehicle[playerid][index][@index - 1]; 212 | #elseif defined Y_PLAYER_VEHICLE_ENABLED && defined Y_PLAYER_REQUIRE_ACCOUNT 213 | id = GetVehicleIDFromDBID(DBID:index); 214 | if (id == INVALID_VEHICLE_ID) return Text_Send(playerid, $INVALID_VEHICLE_INDEX_EMPTY); 215 | #else 216 | id = index; 217 | #endif 218 | 219 | ChangeVehicleColor(id, color[0], color[1]); 220 | 221 | Text_Send(playerid, $ACTION_SUCCESS); 222 | 223 | return 1; 224 | } -------------------------------------------------------------------------------- /gamemodes/Y/vehicle/dealership/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #define INVALID_DEALERSHIP (E_DEALERSHIP_PLACE:-1) 10 | #define INVALID_DEALERSHIP_CAR (-1) 11 | #define MAX_DEALERSHIP_CARS (31) 12 | 13 | enum E_DEALERSHIP 14 | { 15 | E_DEALERSHIP_NAME[32], 16 | Float:E_DEALERSHIP_ENTRANCE[3], 17 | Float:E_DEALERSHIP_VEHICLE_SPAWN[4], 18 | Float:E_DEALERSHIP_VEHICLE_POSITION[4], 19 | Float:E_DEALERSHIP_CAMERA_POS_FRONT[3], 20 | Float:E_DEALERSHIP_CAMERA_POS_SIDE[3], 21 | Float:E_DEALERSHIP_CAMERA_POS_BACK[3], 22 | E_DEALERSHIP_TOTAL_VEHICLES 23 | } 24 | 25 | enum E_DEALERSHIP_CAR 26 | { 27 | E_DEALERSHIP_CAR_MODEL 28 | } 29 | 30 | enum E_DEALERSHIP_CAMERA 31 | { 32 | E_DEALERSHIP_CAMERA_FRONT, 33 | E_DEALERSHIP_CAMERA_SIDE, 34 | E_DEALERSHIP_CAMERA_BACK 35 | } 36 | 37 | enum E_DEALERSHIP_PLACE 38 | { 39 | E_DEALERSHIP_PLACE_SPORTS, 40 | E_DEALERSHIP_PLACE_LOWRIDERS, 41 | E_DEALERSHIP_PLACE_SALOONS_1, 42 | E_DEALERSHIP_PLACE_SALOONS_2, 43 | E_DEALERSHIP_PLACE_OFFROAD, 44 | E_DEALERSHIP_PLACE_AIRCRAFTS, 45 | E_DEALERSHIP_PLACE_BOATS, 46 | E_DEALERSHIP_PLACE_TRUCKS, 47 | E_DEALERSHIP_PLACE_MOTORBIKES, 48 | E_DEALERSHIP_PLACE_VIP 49 | } 50 | 51 | new 52 | Text:DealershipBuyButton, 53 | Text:DealershipBuyButtonBg, 54 | Text:DealershipNextButton, 55 | Text:DealershipNextButtonBg, 56 | Text:DealershipPreviousButton, 57 | Text:DealershipPreviousButtonBg, 58 | Text:DealershipRotateButton, 59 | Text:DealershipRotateButtonBg, 60 | Text:DealershipVipDiscount, 61 | PlayerText:DealershipModelName[MAX_PLAYERS], 62 | PlayerText:DealershipPrice[MAX_PLAYERS] 63 | ; 64 | 65 | new 66 | E_DEALERSHIP_PLACE:PlayerDealership[MAX_PLAYERS] = { INVALID_DEALERSHIP, ... }, 67 | PlayerDealershipVehicle[MAX_PLAYERS] = { INVALID_DEALERSHIP_CAR, ... }, 68 | E_DEALERSHIP_CAMERA:PlayerDealershipCamera[MAX_PLAYERS] = { E_DEALERSHIP_CAMERA_FRONT, ... }, 69 | Dealership[E_DEALERSHIP_PLACE][E_DEALERSHIP] = { 70 | { 71 | "Sports", 72 | { 544.2350,-1290.2289,17.2422 }, 73 | { 555.9735,-1265.5007,17.2422,1.4152 }, 74 | { -1950.4407, 264.6349, 41.0471, 181.4166 }, 75 | { -1950.6555, 256.2453, 41.0534 }, 76 | { -1958.0184, 265.1506, 41.0471 }, 77 | { -1950.2700, 274.1118, 41.0471 }, 78 | 20 79 | }, 80 | { 81 | "Lowriders", 82 | { 300.2710, -1519.6945, 24.6007 }, // lowrider start 83 | { 307.6008, -1507.6388, 24.5938, 323.4597 }, 84 | { -1950.4407, 264.6349, 41.0471, 181.4166 }, 85 | { -1950.6555, 256.2453, 41.0534 }, 86 | { -1958.0184, 265.1506, 41.0471 }, 87 | { -1950.2700, 274.1118, 41.0471 }, 88 | 9 89 | }, 90 | { 91 | "Saloons C&S", 92 | { 2131.6594, -1149.7532, 24.2308 }, // saloons enter 93 | { 2125.4016, -1129.4315, 25.4972, 0.9348 }, 94 | { -1950.4407, 264.6349, 41.0471, 181.4166 }, 95 | { -1950.6555, 256.2453, 41.0534 }, 96 | { -1958.0184, 265.1506, 41.0471 }, 97 | { -1950.2700, 274.1118, 41.0471 }, 98 | 12 99 | }, 100 | { 101 | "Saloons Pick and Go", 102 | { 2139.4172, -1168.7051, 23.9922 }, // saloons enter 103 | { 2160.9226, -1168.2184, 23.8200, 88.9221 }, 104 | { -1950.4407, 264.6349, 41.0471, 181.4166 }, 105 | { -1950.6555, 256.2453, 41.0534 }, 106 | { -1958.0184, 265.1506, 41.0471 }, 107 | { -1950.2700, 274.1118, 41.0471 }, 108 | 23 109 | }, 110 | { 111 | "Offroad", 112 | { 2520.2568, -1519.0847, 23.9407 }, // offroad enter 113 | { 2504.7729, -1520.4708, 23.8900, 4.9220 }, 114 | { -1950.4407, 264.6349, 41.0471, 181.4166 }, 115 | { -1950.6555, 256.2453, 41.0534 }, 116 | { -1958.0184, 265.1506, 41.0471 }, 117 | { -1950.2700, 274.1118, 41.0471 }, 118 | 21 119 | }, 120 | { 121 | "Aircrafts", 122 | { 1749.5895, -2548.6216, 13.5469 }, // aircraft enter 123 | { 1766.0347, -2547.2693, 13.5469, 273.1562 }, // aircraft spawn 124 | { 1805.4435, -2546.9824, 13.8294, 90.4264 }, 125 | { 1819.3917, -2547.7112, 13.5469 }, 126 | { 1803.8776, -2562.4329, 13.5469 }, 127 | { 1789.4686, -2548.0947, 13.5469 }, 128 | 13 129 | }, 130 | { 131 | "Boats", 132 | { 2499.2412, -2261.8318, 3.0000 }, // boats enter 133 | { 2499.6501, -2268.9026, 2.1963, 268.9758 }, 134 | { 2519.6501, -2268.9026, 2.1963, 268.9758 }, 135 | { 2485.3464, -2268.2927, 3.4805 }, 136 | { 2497.6040, -2275.4026, 3.6807 }, 137 | { 2513.3428, -2269.8833, 3.3132 }, 138 | 5 139 | }, 140 | { 141 | "Trucks", 142 | { 1099.9951, -1202.0293, 17.8047 }, // trucks enter 143 | { 1092.7864, -1207.6033, 17.8047, 90.5855 }, // trucks spawn 144 | { -1950.4407, 264.6349, 41.0471, 181.4166 }, 145 | { -1950.6555, 256.2453, 41.0534 }, 146 | { -1958.0184, 265.1506, 41.0471 }, 147 | { -1950.2700, 274.1118, 41.0471 }, 148 | 14 149 | }, 150 | { 151 | "Motorbikes", 152 | { 2794.6833, -1619.2235, 10.9219 }, // motorbikes enter 153 | { 2793.7437, -1608.5442, 10.9219, 346.3281 }, // motorbikes spawn 154 | { -1950.4407, 264.6349, 41.0471, 181.4166 }, 155 | { -1950.6555, 256.2453, 41.0534 }, 156 | { -1958.0184, 265.1506, 41.0471 }, 157 | { -1950.2700, 274.1118, 41.0471 }, 158 | 11 159 | }, 160 | { 161 | "VIP", 162 | { 1024.8635, -982.9116, 42.6615 }, // vip enter 163 | { 1036.0011, -975.7188, 42.5649, 318.8642 }, // vip spawn 164 | { -1950.4407, 264.6349, 41.0471, 181.4166 }, 165 | { -1950.6555, 256.2453, 41.0534 }, 166 | { -1958.0184, 265.1506, 41.0471 }, 167 | { -1950.2700, 274.1118, 41.0471 }, 168 | 9 169 | } 170 | }, 171 | DealershipVehicles[E_DEALERSHIP_PLACE][MAX_DEALERSHIP_CARS][E_DEALERSHIP_CAR] = { 172 | { { 587 }, { 589 }, { 429 }, { 602 }, { 402 }, { 559 }, { 603 }, { 558 }, { 458 }, { 475 }, { 565 }, { 415 }, { 541 }, { 477 }, { 496 }, { 545 }, { 480 }, { 533 }, { 439 }, { 555 }, { -1 }, { -1 }, ... }, 173 | { { 536 }, { 561 }, { 575 }, { 567 }, { 534 }, { 576 }, { 412 }, { 535 }, { 566 }, { -1 }, { -1 }, ... }, 174 | { { 418 }, { 527 }, { 507 }, { 542 }, { 562 }, { 445 }, { 419 }, { 585 }, { 518 }, { 504 }, { 401 }, { 479 }, { -1 }, { -1 }, ... }, 175 | { { 404 }, { 526 }, { 540 }, { 491 }, { 529 }, { 549 }, { 466 }, { 551 }, { 516 }, { 410 }, { 426 }, { 436 }, { 580 }, { 405 }, { 547 }, { 560 }, { 517 }, { 546 }, { 474 }, { 550 }, { 492 }, { 567 }, { 421 }, { -1 }, { -1 }, ... }, 176 | { { 422 }, { 543 }, { 413 }, { 600 }, { 459 }, { 552 }, { 554 }, { 568 }, { 424 }, { 400 }, { 579 }, { 505 }, { 489 }, { 500 }, { 588 }, { 573 }, { 508 }, { 495 }, { 483 }, { 434 }, { 423 }, { -1 }, { -1 }, ... }, 177 | { { 519 }, { 511 }, { 487 }, { 469 }, { 563 }, { 447 }, { 417 }, { 513 }, { 512 }, { 553 }, { 577 }, { 592 }, { 593 }, { -1 }, { -1 }, ... }, 178 | { { 484 }, { 452 }, { 454 }, { 473 }, { 446 }, { -1 }, { -1 }, ... }, 179 | { { 609 }, { 498 }, { 578 }, { 414 }, { 524 }, { 455 }, { 403 }, { 514 }, { 515 }, { 428 }, { 456 }, { 443 }, { 485 }, { 583 }, { -1 }, { -1 }, ... }, 180 | { { 586 }, { 468 }, { 463 }, { 471 }, { 457 }, { 509 }, { 481 }, { 510 }, { 521 }, { 461 }, { 581 }, { -1 }, { -1 }, ... }, 181 | { { 494 }, { 502 }, { 503 }, { 539 }, { 571 }, { 556 }, { 557 }, { 444 }, { 522 }, { -1 }, { -1 }, ... } 182 | }, 183 | DealershipVehicle[MAX_PLAYERS] = { INVALID_VEHICLE_ID, ... } 184 | ; -------------------------------------------------------------------------------- /gamemodes/Y/vehicle/dealership/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | #include 6 | 7 | hook OnGroupInit() 8 | { 9 | GROUP_ADD 10 | { 11 | @YCMD:gotodealership; 12 | } 13 | } 14 | 15 | hook OnScriptInit() 16 | { 17 | new text[128]; 18 | 19 | for (new place = 0; place != _:E_DEALERSHIP_PLACE; ++place) { 20 | format(text, sizeof text, "[%s dealership]", Dealership[E_DEALERSHIP_PLACE:place][E_DEALERSHIP_NAME]); 21 | CreateDynamic3DTextLabel(text, 0xFFFFFFFF, Dealership[E_DEALERSHIP_PLACE:place][E_DEALERSHIP_ENTRANCE][0], Dealership[E_DEALERSHIP_PLACE:place][E_DEALERSHIP_ENTRANCE][1], Dealership[E_DEALERSHIP_PLACE:place][E_DEALERSHIP_ENTRANCE][2] + 0.5, 20.0, .worldid = 0, .interiorid = 0); 22 | CreateDynamicPickup(1239, 1, Dealership[E_DEALERSHIP_PLACE:place][E_DEALERSHIP_ENTRANCE][0], Dealership[E_DEALERSHIP_PLACE:place][E_DEALERSHIP_ENTRANCE][1], Dealership[E_DEALERSHIP_PLACE:place][E_DEALERSHIP_ENTRANCE][2], 0, 0); 23 | } 24 | 25 | DealershipBuyButtonBg = TextDrawCreate(560.0, 180.0, "_"); 26 | TextDrawUseBox(DealershipBuyButtonBg, 1); 27 | TextDrawTextSize(DealershipBuyButtonBg, 620.0, 30.0); 28 | TextDrawBoxColor(DealershipBuyButtonBg, 0xFFFFFF33); 29 | TextDrawLetterSize(DealershipBuyButtonBg, 5.2, 30.0 * 0.135); 30 | TextDrawSetSelectable(DealershipBuyButtonBg, 1); 31 | 32 | DealershipBuyButton = TextDrawCreate(590.0, 190.0, "BUY"); 33 | TextDrawSetOutline(DealershipBuyButton, 2); 34 | TextDrawLetterSize(DealershipBuyButton, 0.6, 1.8); 35 | TextDrawFont(DealershipBuyButton, 2); 36 | TextDrawAlignment(DealershipBuyButton, 2); 37 | TextDrawBackgroundColor(DealershipBuyButton, 0x000000FF); 38 | 39 | DealershipPreviousButtonBg = TextDrawCreate(70.0, 370.0, "_"); 40 | TextDrawUseBox(DealershipPreviousButtonBg, 1); 41 | TextDrawTextSize(DealershipPreviousButtonBg, 170.0, 30.0); 42 | TextDrawBoxColor(DealershipPreviousButtonBg, 0xFFFFFF33); 43 | TextDrawLetterSize(DealershipPreviousButtonBg, 5.2, 30.0 * 0.135); 44 | TextDrawSetSelectable(DealershipPreviousButtonBg, 1); 45 | 46 | DealershipPreviousButton = TextDrawCreate(120.0, 380.0, "<"); 47 | TextDrawSetOutline(DealershipPreviousButton, 2); 48 | TextDrawLetterSize(DealershipPreviousButton, 0.3, 1.8); 49 | TextDrawFont(DealershipPreviousButton, 2); 50 | TextDrawAlignment(DealershipPreviousButton, 2); 51 | TextDrawBackgroundColor(DealershipPreviousButton, 0x000000FF); 52 | 53 | DealershipNextButtonBg = TextDrawCreate(470.0, 370.0, "_"); 54 | TextDrawUseBox(DealershipNextButtonBg, 1); 55 | TextDrawTextSize(DealershipNextButtonBg, 570.0, 30.0); 56 | TextDrawBoxColor(DealershipNextButtonBg, 0xFFFFFF33); 57 | TextDrawLetterSize(DealershipNextButtonBg, 5.2, 30.0 * 0.135); 58 | TextDrawSetSelectable(DealershipNextButtonBg, 1); 59 | 60 | DealershipNextButton = TextDrawCreate(520.0, 380.0, ">"); 61 | TextDrawSetOutline(DealershipNextButton, 2); 62 | TextDrawLetterSize(DealershipNextButton, 0.3, 1.8); 63 | TextDrawFont(DealershipNextButton, 2); 64 | TextDrawAlignment(DealershipNextButton, 2); 65 | TextDrawBackgroundColor(DealershipNextButton, 0x000000FF); 66 | 67 | DealershipRotateButtonBg = TextDrawCreate(250.0, 370.0, "_"); 68 | TextDrawUseBox(DealershipRotateButtonBg, 1); 69 | TextDrawTextSize(DealershipRotateButtonBg, 390.0, 30.0); 70 | TextDrawBoxColor(DealershipRotateButtonBg, 0xFFFFFF33); 71 | TextDrawLetterSize(DealershipRotateButtonBg, 5.2, 30.0 * 0.135); 72 | TextDrawSetSelectable(DealershipRotateButtonBg, 1); 73 | 74 | DealershipRotateButton = TextDrawCreate(320.0, 380.0, "Rotate"); 75 | TextDrawSetOutline(DealershipRotateButton, 2); 76 | TextDrawLetterSize(DealershipRotateButton, 0.5, 1.2); 77 | TextDrawFont(DealershipRotateButton, 2); 78 | TextDrawAlignment(DealershipRotateButton, 2); 79 | TextDrawBackgroundColor(DealershipRotateButton, 0x000000FF); 80 | 81 | DealershipVipDiscount = TextDrawCreate(620.0, 160.0, "-10% VIP discount"); 82 | TextDrawSetOutline(DealershipVipDiscount, 2); 83 | TextDrawLetterSize(DealershipVipDiscount, 0.4, 0.9); 84 | TextDrawFont(DealershipVipDiscount, 3); 85 | TextDrawAlignment(DealershipVipDiscount, 3); 86 | TextDrawBackgroundColor(DealershipVipDiscount, 0x000000FF); 87 | 88 | return 1; 89 | } 90 | 91 | hook OnPlayerClickTextDraw(playerid, Text:clickedid) 92 | { 93 | if (clickedid == DealershipRotateButtonBg) { 94 | new E_DEALERSHIP_CAMERA:mode; 95 | if (PlayerDealershipCamera[playerid] == E_DEALERSHIP_CAMERA_BACK) { 96 | mode = E_DEALERSHIP_CAMERA_FRONT; 97 | } else { 98 | mode = E_DEALERSHIP_CAMERA:(_:PlayerDealershipCamera[playerid] + 1); 99 | } 100 | 101 | DealershipSetCamera(playerid, mode); 102 | 103 | return 1; 104 | } 105 | 106 | if (clickedid == DealershipNextButtonBg) { 107 | DealershipGetVehicle(playerid, PlayerDealershipVehicle[playerid] + 1); 108 | return 1; 109 | } 110 | if (clickedid == DealershipPreviousButtonBg) { 111 | DealershipGetVehicle(playerid, PlayerDealershipVehicle[playerid] - 1); 112 | return 1; 113 | } 114 | if (clickedid == DealershipBuyButtonBg) { 115 | DealershipBuyVehicle(playerid); 116 | return 1; 117 | } 118 | 119 | return 1; 120 | } 121 | 122 | hook OnPlayerConnect(playerid) 123 | { 124 | DealershipModelName[playerid] = CreatePlayerTextDraw(playerid, 620.0, 110.0, "ModelName"); 125 | PlayerTextDrawSetOutline(playerid, DealershipModelName[playerid], 2); 126 | PlayerTextDrawLetterSize(playerid, DealershipModelName[playerid], 0.6, 1.5); 127 | PlayerTextDrawFont(playerid, DealershipModelName[playerid], 3); 128 | PlayerTextDrawAlignment(playerid, DealershipModelName[playerid], 3); 129 | PlayerTextDrawBackgroundColor(playerid, DealershipModelName[playerid], 0x000000FF); 130 | 131 | DealershipPrice[playerid] = CreatePlayerTextDraw(playerid, 620.0, 130.0, "$0"); 132 | PlayerTextDrawSetOutline(playerid, DealershipPrice[playerid], 2); 133 | PlayerTextDrawLetterSize(playerid, DealershipPrice[playerid], 0.6, 1.8); 134 | PlayerTextDrawFont(playerid, DealershipPrice[playerid], 3); 135 | PlayerTextDrawAlignment(playerid, DealershipPrice[playerid], 3); 136 | PlayerTextDrawBackgroundColor(playerid, DealershipPrice[playerid], 0x000000FF); 137 | PlayerTextDrawColor(playerid, DealershipPrice[playerid], 0x2DCC0AFF); 138 | } 139 | 140 | hook OnPlayerDisconnect(playerid, reason) 141 | { 142 | PlayerTextDrawDestroy(playerid, DealershipModelName[playerid]); 143 | PlayerTextDrawDestroy(playerid, DealershipPrice[playerid]); 144 | 145 | if (DealershipVehicle[playerid] != INVALID_VEHICLE_ID) { 146 | DestroyVehicle(DealershipVehicle[playerid]); 147 | DealershipVehicle[playerid] = INVALID_VEHICLE_ID; 148 | } 149 | } 150 | 151 | hook OnPlayerEnter(playerid) 152 | { 153 | for (new place = 0; place != _:E_DEALERSHIP_PLACE; ++place) { 154 | if (IsPlayerInRangeOfPoint(playerid, 7.0, Dealership[E_DEALERSHIP_PLACE:place][E_DEALERSHIP_ENTRANCE][0], Dealership[E_DEALERSHIP_PLACE:place][E_DEALERSHIP_ENTRANCE][1], Dealership[E_DEALERSHIP_PLACE:place][E_DEALERSHIP_ENTRANCE][2]) && GetPlayerVirtualWorld(playerid) == 0) { 155 | DealershipEnter(playerid, E_DEALERSHIP_PLACE:place); 156 | 157 | return Y_HOOKS_BREAK_RETURN_1; 158 | } 159 | } 160 | 161 | return 1; 162 | } 163 | 164 | hook OnPlayerExit(playerid) 165 | { 166 | if (PlayerDealership[playerid] != INVALID_DEALERSHIP) { 167 | DealershipExit(playerid); 168 | } 169 | 170 | return 1; 171 | } 172 | 173 | #define CurrentDealership Dealership[PlayerDealership[playerid]] 174 | #define CurrentDealershipVehicle DealershipVehicles[PlayerDealership[playerid]][PlayerDealershipVehicle[playerid]] 175 | DealershipEnter(playerid, E_DEALERSHIP_PLACE:index) 176 | { 177 | PlayerDealership[playerid] = index; 178 | SCM(playerid, -1, "Entered %s dealership", CurrentDealership[E_DEALERSHIP_NAME]); 179 | TogglePlayerSpectating(playerid, 1); 180 | SetPlayerVirtualWorld(playerid, MAX_PLAYERS + playerid); 181 | SetPlayerPos(playerid, 1187.8796, -1322.4230, 13.5665); 182 | 183 | defer DealershipFixSpectate(playerid); 184 | SelectTextDraw(playerid, 0x000000CC); 185 | 186 | DealershipGetVehicle(playerid, 0); 187 | 188 | TextDrawShowForPlayer(playerid, DealershipBuyButtonBg); 189 | TextDrawShowForPlayer(playerid, DealershipBuyButton); 190 | TextDrawShowForPlayer(playerid, DealershipNextButtonBg); 191 | TextDrawShowForPlayer(playerid, DealershipNextButton); 192 | TextDrawShowForPlayer(playerid, DealershipPreviousButtonBg); 193 | TextDrawShowForPlayer(playerid, DealershipPreviousButton); 194 | TextDrawShowForPlayer(playerid, DealershipRotateButtonBg); 195 | TextDrawShowForPlayer(playerid, DealershipRotateButton); 196 | 197 | #if defined Y_PLAYER_REQUIRE_ACCOUNT 198 | if (Player.Status[playerid][@vip]) { 199 | TextDrawShowForPlayer(playerid, DealershipVipDiscount); 200 | } 201 | #endif 202 | 203 | PlayerTextDrawShow(playerid, DealershipModelName[playerid]); 204 | PlayerTextDrawShow(playerid, DealershipPrice[playerid]); 205 | } 206 | 207 | DealershipExit(playerid) 208 | { 209 | SetCameraBehindPlayer(playerid); 210 | TogglePlayerSpectating(playerid, 0); 211 | 212 | SetPlayerVirtualWorld(playerid, 0); 213 | CancelSelectTextDraw(playerid); 214 | 215 | SetPlayerPos(playerid, CurrentDealership[E_DEALERSHIP_ENTRANCE][0], CurrentDealership[E_DEALERSHIP_ENTRANCE][1], CurrentDealership[E_DEALERSHIP_ENTRANCE][2]); 216 | 217 | if (DealershipVehicle[playerid] != INVALID_VEHICLE_ID) { 218 | DestroyVehicle(DealershipVehicle[playerid]); 219 | DealershipVehicle[playerid] = INVALID_VEHICLE_ID; 220 | } 221 | 222 | TextDrawHideForPlayer(playerid, DealershipBuyButtonBg); 223 | TextDrawHideForPlayer(playerid, DealershipBuyButton); 224 | TextDrawHideForPlayer(playerid, DealershipNextButtonBg); 225 | TextDrawHideForPlayer(playerid, DealershipNextButton); 226 | TextDrawHideForPlayer(playerid, DealershipPreviousButtonBg); 227 | TextDrawHideForPlayer(playerid, DealershipPreviousButton); 228 | TextDrawHideForPlayer(playerid, DealershipRotateButtonBg); 229 | TextDrawHideForPlayer(playerid, DealershipRotateButton); 230 | 231 | #if defined Y_PLAYER_REQUIRE_ACCOUNT 232 | if (Player.Status[playerid][@vip]) { 233 | TextDrawHideForPlayer(playerid, DealershipVipDiscount); 234 | } 235 | #endif 236 | 237 | PlayerTextDrawHide(playerid, DealershipModelName[playerid]); 238 | PlayerTextDrawHide(playerid, DealershipPrice[playerid]); 239 | 240 | PlayerDealership[playerid] = INVALID_DEALERSHIP; 241 | } 242 | 243 | DealershipGetVehicle(playerid, index) 244 | { 245 | if (DealershipVehicle[playerid] != INVALID_VEHICLE_ID) { 246 | DestroyVehicle(DealershipVehicle[playerid]); 247 | } 248 | 249 | PlayerDealershipVehicle[playerid] = index; 250 | 251 | if (index == CurrentDealership[E_DEALERSHIP_TOTAL_VEHICLES]) { 252 | PlayerDealershipVehicle[playerid] = 0; 253 | } else if (index < 0) { 254 | PlayerDealershipVehicle[playerid] = CurrentDealership[E_DEALERSHIP_TOTAL_VEHICLES] - 1; 255 | } 256 | 257 | PlayerTextDrawSetString(playerid, DealershipModelName[playerid], Model_Name(CurrentDealershipVehicle[E_DEALERSHIP_CAR_MODEL])); 258 | 259 | new 260 | price = GetModelPrice(CurrentDealershipVehicle[E_DEALERSHIP_CAR_MODEL]), 261 | priceText[64] 262 | ; 263 | 264 | format(priceText, sizeof priceText, "$%d", price); 265 | 266 | PlayerTextDrawColor(playerid, DealershipPrice[playerid], GetPlayerMoney(playerid) < DealershipGetPrice(playerid) ? 0xD60606FF : 0x52B700FF); 267 | 268 | PlayerTextDrawSetString(playerid, DealershipPrice[playerid], priceText); 269 | PlayerTextDrawHide(playerid, DealershipModelName[playerid]); 270 | PlayerTextDrawHide(playerid, DealershipPrice[playerid]); 271 | PlayerTextDrawShow(playerid, DealershipModelName[playerid]); 272 | PlayerTextDrawShow(playerid, DealershipPrice[playerid]); 273 | 274 | DealershipVehicle[playerid] = CreateVehicle(CurrentDealershipVehicle[E_DEALERSHIP_CAR_MODEL], CurrentDealership[E_DEALERSHIP_VEHICLE_POSITION][0], CurrentDealership[E_DEALERSHIP_VEHICLE_POSITION][1], CurrentDealership[E_DEALERSHIP_VEHICLE_POSITION][2], CurrentDealership[E_DEALERSHIP_VEHICLE_POSITION][3], 0, 0, -1); 275 | SetVehicleVirtualWorld(DealershipVehicle[playerid], MAX_PLAYERS + playerid); 276 | } 277 | 278 | DealershipGetPrice(playerid) 279 | { 280 | new price = GetModelPrice(CurrentDealershipVehicle[E_DEALERSHIP_CAR_MODEL]); 281 | 282 | #if defined Y_PLAYER_REQUIRE_ACCOUNT 283 | if (Player.Status[playerid][@vip]) { 284 | price -= floatround(price * 0.1); 285 | } 286 | #endif 287 | 288 | return price; 289 | } 290 | 291 | DealershipSetCamera(playerid, E_DEALERSHIP_CAMERA:mode = E_DEALERSHIP_CAMERA_FRONT) 292 | { 293 | PlayerDealershipCamera[playerid] = mode; 294 | 295 | switch(mode) 296 | { 297 | case E_DEALERSHIP_CAMERA_FRONT: { 298 | SetPlayerCameraPos(playerid, CurrentDealership[E_DEALERSHIP_CAMERA_POS_FRONT][0], CurrentDealership[E_DEALERSHIP_CAMERA_POS_FRONT][1], CurrentDealership[E_DEALERSHIP_CAMERA_POS_FRONT][2]); 299 | } 300 | case E_DEALERSHIP_CAMERA_SIDE: { 301 | SetPlayerCameraPos(playerid, CurrentDealership[E_DEALERSHIP_CAMERA_POS_SIDE][0], CurrentDealership[E_DEALERSHIP_CAMERA_POS_SIDE][1], CurrentDealership[E_DEALERSHIP_CAMERA_POS_SIDE][2]); 302 | } 303 | case E_DEALERSHIP_CAMERA_BACK: { 304 | SetPlayerCameraPos(playerid, CurrentDealership[E_DEALERSHIP_CAMERA_POS_BACK][0], CurrentDealership[E_DEALERSHIP_CAMERA_POS_BACK][1], CurrentDealership[E_DEALERSHIP_CAMERA_POS_BACK][2]); 305 | } 306 | } 307 | 308 | SetPlayerCameraLookAt(playerid, CurrentDealership[E_DEALERSHIP_VEHICLE_POSITION][0], CurrentDealership[E_DEALERSHIP_VEHICLE_POSITION][1], CurrentDealership[E_DEALERSHIP_VEHICLE_POSITION][2]); 309 | } 310 | 311 | DealershipBuyVehicle(playerid) 312 | { 313 | new price = DealershipGetPrice(playerid); 314 | 315 | if (GetPlayerMoney(playerid) < price) { 316 | return SCM(playerid, -1, "You can't afford that vehicle"); 317 | } 318 | 319 | #if defined Y_PLAYER_VEHICLE_ENABLED 320 | new slot = Iter_Free(PlayerVehicle[playerid]); 321 | if(slot == INVALID_ITERATOR_SLOT) { 322 | return SCM(playerid, -1, "You already own maximum number of vehicles!"); 323 | } 324 | #endif 325 | 326 | GivePlayerMoney(playerid, -price); 327 | 328 | new vehicle = GetFreeVehicleSlot(); 329 | 330 | log("Vehicle bought for %d with index %d", playerid, vehicle); 331 | 332 | #if defined Y_PLAYER_VEHICLE_ENABLED 333 | Player.Vehicle[playerid][slot][@index] = vehicle; 334 | Iter_Add(PlayerVehicle[playerid], slot); 335 | #endif 336 | 337 | Vehicle.Status[vehicle][@pos][0] = CurrentDealership[E_DEALERSHIP_VEHICLE_SPAWN][0]; 338 | Vehicle.Status[vehicle][@pos][1] = CurrentDealership[E_DEALERSHIP_VEHICLE_SPAWN][1]; 339 | Vehicle.Status[vehicle][@pos][2] = CurrentDealership[E_DEALERSHIP_VEHICLE_SPAWN][2]; 340 | Vehicle.Status[vehicle][@rot] = CurrentDealership[E_DEALERSHIP_VEHICLE_SPAWN][3]; 341 | Vehicle.Meta[vehicle][@model] = CurrentDealershipVehicle[E_DEALERSHIP_CAR_MODEL]; 342 | 343 | SCM(playerid, -1, ":_______VEHICLE PURCHASED_______:"); 344 | SCM(playerid, -1, "REMEMBER: Leaving your vehicle in the delivery point can get your vehicle deleted by the administration without refund!"); 345 | 346 | CreateVehicle( 347 | Vehicle.Meta[vehicle][@model], 348 | Vehicle.Status[vehicle][@pos][0], Vehicle.Status[vehicle][@pos][1], Vehicle.Status[vehicle][@pos][2], 349 | Vehicle.Status[vehicle][@rot], 350 | 1, 1, -1 351 | ); 352 | 353 | #if defined Y_PLAYER_REQUIRE_ACCOUNT && defined Y_PLAYER_VEHICLE_ENABLED 354 | SavePlayerVehicle(playerid, vehicle); 355 | #endif 356 | 357 | DealershipExit(playerid); 358 | PutPlayerInVehicle(playerid, vehicle, 0); 359 | 360 | return 1; 361 | } 362 | 363 | timer DealershipFixSpectate[200](playerid) 364 | { 365 | DealershipSetCamera(playerid); 366 | } 367 | 368 | #undef CurrentDealership 369 | #undef CurrentDealershipVehicle 370 | 371 | YCMD:gotodealership(playerid, params[], help) 372 | { 373 | if(help) return SCM(playerid, -1, "Not supported"); 374 | 375 | new list[128]; 376 | strcpy(list, "1\tSports\n2\tLowriders\n3\tSaloons C&S\n4\tSaloons Pick and Go\n5\tOff Road\n6\tAircrafts\n7\tBoats\n8\tTrucks\n9\tMotorbikes"); 377 | 378 | #if defined Y_PLAYER_REQUIRE_ACCOUNT 379 | if (Player.Status[playerid][@vip]) { 380 | strcat(list, "\n10\tVIP"); 381 | } 382 | #endif 383 | 384 | inline Response(pid, dialogid, response, listitem, string:inputtext[]) 385 | { 386 | #pragma unused pid, dialogid, response, listitem, inputtext 387 | 388 | if(!response) continue; 389 | 390 | if (GetPlayerState(playerid) == 2) 391 | { 392 | new tmpcar = GetPlayerVehicleID(playerid); 393 | SetVehiclePos(tmpcar, Dealership[E_DEALERSHIP_PLACE:listitem][E_DEALERSHIP_ENTRANCE][0], Dealership[E_DEALERSHIP_PLACE:listitem][E_DEALERSHIP_ENTRANCE][1], Dealership[E_DEALERSHIP_PLACE:listitem][E_DEALERSHIP_ENTRANCE][2]); 394 | } 395 | else 396 | { 397 | SetPlayerPos(playerid, Dealership[E_DEALERSHIP_PLACE:listitem][E_DEALERSHIP_ENTRANCE][0], Dealership[E_DEALERSHIP_PLACE:listitem][E_DEALERSHIP_ENTRANCE][1], Dealership[E_DEALERSHIP_PLACE:listitem][E_DEALERSHIP_ENTRANCE][2]); 398 | SetPlayerVirtualWorld(playerid, 0); 399 | } 400 | } 401 | 402 | Dialog_ShowCallback(playerid, using inline Response, DIALOG_STYLE_LIST,"Dealerships:",list,"Tele","Cancel"); 403 | 404 | return 1; 405 | } -------------------------------------------------------------------------------- /gamemodes/Y/vehicle/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #include "core\header" 6 | #include "status\header" 7 | 8 | #if defined Y_VEHICLE_DEALERSHIP_ENABLED 9 | #include "dealership\header" 10 | #endif -------------------------------------------------------------------------------- /gamemodes/Y/vehicle/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | #include "core\impl" 6 | #include "status\impl" 7 | 8 | #if defined Y_VEHICLE_DEALERSHIP_ENABLED 9 | #include "dealership\impl" 10 | #endif -------------------------------------------------------------------------------- /gamemodes/Y/vehicle/status/header.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_header 2 | #undef _inc_header 3 | #endif 4 | 5 | #include 6 | 7 | enum E_VEHICLE_STATUS { 8 | Float:E_VEHICLE_Status_pos[3], 9 | Float:E_VEHICLE_Status_rot, 10 | E_VEHICLE_Status_color[2] 11 | } 12 | 13 | new VehicleStatus[MAX_VEHICLES][E_VEHICLE_STATUS]; -------------------------------------------------------------------------------- /gamemodes/Y/vehicle/status/impl.inc: -------------------------------------------------------------------------------- 1 | #if defined _inc_impl 2 | #undef _inc_impl 3 | #endif 4 | 5 | #include 6 | 7 | hook OnGroupInit() 8 | { 9 | GROUP_ADD 10 | { 11 | #if defined Y_PLAYER_REQUIRE_ACCOUNT 12 | @YCMD:vpark; 13 | #endif 14 | } 15 | 16 | return 1; 17 | } 18 | 19 | #if defined Y_PLAYER_REQUIRE_ACCOUNT 20 | UpdateVehicleStatus(vehicleid) 21 | { 22 | new Float:pos[3], Float:rot; 23 | GetVehiclePos(vehicleid, pos[0], pos[1], pos[2]); 24 | GetVehicleZAngle(vehicleid, rot); 25 | 26 | Vehicle.Status[vehicleid][@pos] = pos; 27 | Vehicle.Status[vehicleid][@rot] = rot; 28 | 29 | new query[256]; 30 | mysql_format( 31 | dbhandle, 32 | query, 33 | sizeof query, 34 | "UPDATE vehicles SET X = %.2f, Y = %.2f, Z = %.2f, R = %.2f, color_1 = %d, color_2 = %d WHERE id = %d", 35 | Vehicle.Status[vehicleid][@pos][0], Vehicle.Status[vehicleid][@pos][1], Vehicle.Status[vehicleid][@pos][2], 36 | Vehicle.Status[vehicleid][@rot], 37 | Vehicle.Status[vehicleid][@color][0], Vehicle.Status[vehicleid][@color][1], 38 | _:Vehicle.Meta[vehicleid][@id] 39 | ); 40 | mysql_tquery(dbhandle, query); 41 | } 42 | 43 | YCMD:vpark(playerid, params[], help) 44 | { 45 | if(help) return SCM(playerid, -1, "Not supported"); 46 | 47 | new vid = GetPlayerVehicleID(playerid); 48 | if (vid == INVALID_VEHICLE_ID) { 49 | return SCM(playerid, -1, "You are not in a vehicle"); 50 | } 51 | 52 | UpdateVehicleStatus(vid); 53 | 54 | return 1; 55 | } 56 | #endif -------------------------------------------------------------------------------- /gamemodes/config.inc.template: -------------------------------------------------------------------------------- 1 | // #define Y_DEBUG 2 | 3 | // #define _DEBUG 7 4 | // #define RUN_TESTS 5 | 6 | #define MYSQL_HOST "127.0.0.1" 7 | #define MYSQL_USER "root" 8 | #define MYSQL_PASSWORD "" 9 | #define MYSQL_DB "y" 10 | #define MYSQL_LOG ALL 11 | #define MYSQL_POOL_SIZE 5 12 | 13 | #define Y_PLAYER_ENABLED 14 | #define Y_PLAYER_REQUIRE_ACCOUNT 15 | #define Y_PLAYER_LOGIN_AFTER_REG 16 | 17 | #define Y_PLAYER_RESTRICT_NAME_FUNC "PlayerRestrictName" 18 | 19 | #define Y_PLAYER_PASSWORD_PEPPER "LR^#os7rIqYQhz0ozrmvMTyLG!ot8WLS" 20 | #define Y_PLAYER_PEPPER_SIZE 32 21 | 22 | #define Y_PLAYER_LOGIN_MAX_ATTEMPTS 5 23 | // #define Y_PLAYER_LOGIN_TIMEOUT_KICK 30 24 | #define Y_PLAYER_LOGIN_TIMEOUT_KICK 30000 25 | 26 | #define Y_PLAYER_REGISTRATION 27 | #define Y_PLAYER_REGISTRATION_MIN_PASS_LENGTH 8 28 | #define Y_PLAYER_REGISTRATION_MAX_PASS_LENGTH 128 29 | #define Y_PLAYER_SALT_GENERATOR SALT_WEAK 30 | 31 | #define Y_VEHICLE_ENABLED 32 | 33 | #define Y_PLAYER_VEHICLE_ENABLED 34 | #define Y_PLAYER_VEHICLE_MAX_OWNED 5 35 | 36 | #define Y_VEHICLE_DEALERSHIP_ENABLED 37 | 38 | #define Y_PLAYER_ADMIN_MAX_LEVEL 5 39 | 40 | #define Y_OBJECT_ENABLED 41 | #define Y_OBJECT_TOTAL 10000 42 | 43 | #define Y_MODE_RP 44 | 45 | #define Y_RP_FACTION 46 | #define Y_RP_FACTION_LIMIT 64 47 | #define Y_RP_FACTION_MAX_NAME 64 48 | #define Y_RP_FACTION_MAX_RANK 8 49 | #define Y_RP_FACTION_MAX_RANK_NAME 16 50 | #define Y_RP_FACTION_MEMBER_LIMIT 32 51 | #define Y_RP_FACTION_OBJECT_LIMIT 200 52 | #define Y_RP_FACTION_MAX_DEBT -100000 53 | #define Y_RP_FACTION_MAX_MONEY 100000000 54 | 55 | #define Y_RP_FACTION_ALLOW_MULTIPLE 56 | 57 | #define Y_RP_FACTION_ADMIN_MANAGE_LEVEL 4 58 | #define Y_RP_FACTION_MANAGE_PLAYER_LEVEL 4 59 | #define Y_RP_FACTION_MANAGE_RANK_LEVEL 7 60 | #define Y_RP_FACTION_CHANGE_COLOUR_LEVEL 7 61 | #define Y_RP_FACTION_CHANGE_RANK_LEVEL 6 62 | #define Y_RP_FACTION_CHANGE_NAME_LEVEL 7 -------------------------------------------------------------------------------- /gamemodes/install.pwn: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "config" 4 | #include "Y\db" 5 | 6 | public OnGameModeInit() 7 | { 8 | print("Loading players table"); 9 | if(!mysql_tquery_file(dbhandle, "Y/migrations/players.sql", "OnPlayersLoaded")) { 10 | print("Loading players failed"); 11 | } 12 | 13 | return 1; 14 | } 15 | 16 | forward OnPlayersLoaded(); 17 | public OnPlayersLoaded() 18 | { 19 | print("Players table loaded"); 20 | return 1; 21 | } 22 | 23 | public OnQueryError(errorid, const error[], const callback[], const query[], MySQL:handle) 24 | { 25 | switch(errorid) { 26 | case CR_SERVER_GONE_ERROR: { 27 | print("Lost connection to server"); 28 | } 29 | case ER_SYNTAX_ERROR: { 30 | printf("Something is wrong in your syntax, query: %s",query); 31 | } 32 | default: { 33 | printf("Other error %d %s", errorid, error); 34 | } 35 | } 36 | return 1; 37 | } -------------------------------------------------------------------------------- /gamemodes/ycore.pwn: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "config" 8 | 9 | #if defined RUN_TESTS 10 | #include 11 | #endif 12 | 13 | #include "Y\Y" 14 | 15 | // Here is place for custom logic 16 | 17 | #include "Y\Y" 18 | 19 | main () { 20 | print("====== Y-Core ======"); 21 | } -------------------------------------------------------------------------------- /scriptfiles/Y/migrations/players.sql: -------------------------------------------------------------------------------- 1 | 2 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 3 | /*!40101 SET NAMES utf8mb4 */; 4 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 5 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 6 | 7 | CREATE TABLE IF NOT EXISTS `objects` ( 8 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, 9 | `model` bigint(20) unsigned NOT NULL DEFAULT '0', 10 | `X` float NOT NULL DEFAULT '0', 11 | `Y` float NOT NULL DEFAULT '0', 12 | `Z` float NOT NULL DEFAULT '0', 13 | `RX` float NOT NULL DEFAULT '0', 14 | `RY` float NOT NULL DEFAULT '0', 15 | `RZ` float NOT NULL DEFAULT '0', 16 | `world` int(11) NOT NULL DEFAULT '-1', 17 | `interior` int(11) NOT NULL DEFAULT '-1', 18 | PRIMARY KEY (`id`) 19 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; 20 | 21 | /*!40000 ALTER TABLE `objects` DISABLE KEYS */; 22 | INSERT INTO `objects` (`id`, `model`, `X`, `Y`, `Z`, `RX`, `RY`, `RZ`, `world`, `interior`) VALUES 23 | (1, 2152, 0, 0, 15, 0, 0, 0, 0, 0), 24 | (2, 2152, 5, 0, 10, 0, 0, 0, 0, 0); 25 | /*!40000 ALTER TABLE `objects` ENABLE KEYS */; 26 | 27 | 28 | CREATE TABLE IF NOT EXISTS `players` ( 29 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, 30 | `name` varchar(25) NOT NULL, 31 | `password` varchar(64) NOT NULL, 32 | `salt` varchar(64) NOT NULL, 33 | `created_at` datetime NOT NULL, 34 | PRIMARY KEY (`id`) 35 | ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; 36 | 37 | /*!40000 ALTER TABLE `players` DISABLE KEYS */; 38 | INSERT INTO `players` (`id`, `name`, `password`, `salt`, `created_at`) VALUES 39 | (6, 'Misiur_Tarter', '291D7E2FD2CE65F4BA4AF939CE4E2C59F2B4E0A96C7FB95FD7B50BC1EE1122AB', 'Ixp01U5iE655Y35qe2G79UUr357aI41C', '2017-08-30 21:55:46'), 40 | (7, 'mega_man', '4C0D7DC42647D2C6588FCFF14DF801AD03809CE3C05BF55478CC14757E752CEE', 'D3uu3SA97D878twe2s07cM17V41pHc91', '2017-08-30 21:57:47'); 41 | /*!40000 ALTER TABLE `players` ENABLE KEYS */; 42 | 43 | 44 | CREATE TABLE IF NOT EXISTS `player_statuses` ( 45 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, 46 | `player_id` bigint(20) unsigned NOT NULL DEFAULT '0', 47 | `developer` tinyint(1) unsigned NOT NULL DEFAULT '0', 48 | `admin` tinyint(1) unsigned NOT NULL DEFAULT '0', 49 | `money` int(10) unsigned NOT NULL DEFAULT '0', 50 | `vip` tinyint(3) unsigned NOT NULL DEFAULT '0', 51 | PRIMARY KEY (`id`), 52 | KEY `player_id` (`player_id`), 53 | CONSTRAINT `player_id` FOREIGN KEY (`player_id`) REFERENCES `players` (`id`) 54 | ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; 55 | 56 | /*!40000 ALTER TABLE `player_statuses` DISABLE KEYS */; 57 | INSERT INTO `player_statuses` (`id`, `player_id`, `developer`, `admin`, `money`, `vip`) VALUES 58 | (2, 6, 0, 5, 0, 0), 59 | (3, 7, 0, 0, 0, 0); 60 | /*!40000 ALTER TABLE `player_statuses` ENABLE KEYS */; 61 | 62 | 63 | CREATE TABLE IF NOT EXISTS `rp_factions` ( 64 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, 65 | `creator_id` bigint(20) unsigned NOT NULL DEFAULT '0', 66 | `owner_id` bigint(20) unsigned NOT NULL DEFAULT '0', 67 | `name` varchar(32) NOT NULL DEFAULT '0', 68 | `money` bigint(20) NOT NULL DEFAULT '0', 69 | PRIMARY KEY (`id`), 70 | KEY `player_id` (`owner_id`), 71 | KEY `owner_id` (`creator_id`), 72 | CONSTRAINT `FK_factions_players` FOREIGN KEY (`owner_id`) REFERENCES `players` (`id`), 73 | CONSTRAINT `FK_factions_players_2` FOREIGN KEY (`creator_id`) REFERENCES `players` (`id`) 74 | ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; 75 | 76 | /*!40000 ALTER TABLE `rp_factions` DISABLE KEYS */; 77 | INSERT INTO `rp_factions` (`id`, `creator_id`, `owner_id`, `name`, `money`) VALUES 78 | (5, 6, 6, 'Very good boys', 123), 79 | (6, 6, 6, 'Hello world faction', 10000), 80 | (7, 6, 6, 'Empty membership', 100000); 81 | /*!40000 ALTER TABLE `rp_factions` ENABLE KEYS */; 82 | 83 | 84 | CREATE TABLE IF NOT EXISTS `rp_faction_members` ( 85 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, 86 | `faction_id` bigint(20) unsigned NOT NULL DEFAULT '0', 87 | `player_id` bigint(20) unsigned NOT NULL DEFAULT '0', 88 | `rank` tinyint(3) unsigned NOT NULL DEFAULT '0', 89 | PRIMARY KEY (`id`), 90 | UNIQUE KEY `faction_id_player_id` (`faction_id`,`player_id`), 91 | KEY `faction_id` (`faction_id`), 92 | KEY `player_id` (`player_id`), 93 | CONSTRAINT `FK__factions` FOREIGN KEY (`faction_id`) REFERENCES `rp_factions` (`id`), 94 | CONSTRAINT `FK__players` FOREIGN KEY (`player_id`) REFERENCES `players` (`id`) 95 | ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; 96 | 97 | /*!40000 ALTER TABLE `rp_faction_members` DISABLE KEYS */; 98 | INSERT INTO `rp_faction_members` (`id`, `faction_id`, `player_id`, `rank`) VALUES 99 | (2, 6, 7, 0), 100 | (12, 5, 6, 0); 101 | /*!40000 ALTER TABLE `rp_faction_members` ENABLE KEYS */; 102 | 103 | 104 | CREATE TABLE IF NOT EXISTS `rp_faction_objects` ( 105 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, 106 | `name` varchar(50) DEFAULT NULL, 107 | `faction_id` bigint(20) unsigned NOT NULL DEFAULT '0', 108 | `object_id` bigint(20) unsigned NOT NULL DEFAULT '0', 109 | PRIMARY KEY (`id`), 110 | UNIQUE KEY `object_id_uq` (`object_id`), 111 | KEY `faction_id` (`faction_id`), 112 | KEY `object_id` (`object_id`), 113 | CONSTRAINT `FK_faction_objects_factions` FOREIGN KEY (`faction_id`) REFERENCES `rp_factions` (`id`), 114 | CONSTRAINT `FK_faction_objects_objects` FOREIGN KEY (`object_id`) REFERENCES `objects` (`id`) 115 | ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; 116 | 117 | /*!40000 ALTER TABLE `rp_faction_objects` DISABLE KEYS */; 118 | INSERT INTO `rp_faction_objects` (`id`, `name`, `faction_id`, `object_id`) VALUES 119 | (3, NULL, 5, 1), 120 | (5, NULL, 5, 2); 121 | /*!40000 ALTER TABLE `rp_faction_objects` ENABLE KEYS */; 122 | 123 | 124 | CREATE TABLE IF NOT EXISTS `vehicles` ( 125 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, 126 | `player_id` bigint(20) unsigned NOT NULL, 127 | `model` mediumint(8) unsigned NOT NULL, 128 | `X` float NOT NULL, 129 | `Y` float NOT NULL, 130 | `Z` float NOT NULL, 131 | `R` float NOT NULL, 132 | `color_1` smallint(6) NOT NULL, 133 | `color_2` smallint(6) NOT NULL, 134 | PRIMARY KEY (`id`), 135 | KEY `player_id` (`player_id`), 136 | CONSTRAINT `FK_vehicles_players` FOREIGN KEY (`player_id`) REFERENCES `players` (`id`) 137 | ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; 138 | 139 | /*!40000 ALTER TABLE `vehicles` DISABLE KEYS */; 140 | INSERT INTO `vehicles` (`id`, `player_id`, `model`, `X`, `Y`, `Z`, `R`, `color_1`, `color_2`) VALUES 141 | (11, 6, 587, 555.97, -1265.5, 17.24, 1.42, 0, 0); 142 | /*!40000 ALTER TABLE `vehicles` ENABLE KEYS */; 143 | /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; 144 | /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; 145 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 146 | -------------------------------------------------------------------------------- /scriptfiles/YSI/core_LANG_DATA.yml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /scriptfiles/YSI/new text.txt: -------------------------------------------------------------------------------- 1 | YSI_PROP_ANN = %s bought %s 2 | YSI_LOGIN_ENTER = You must enter a password. 3 | YSI_LOGIN_LENGTH = You must enter a password at least 6 characters long. 4 | YSI_PROP_MAX = You cannot buy any more properties. 5 | YSI_PROP_BUY_HOUSE = Type "/%n" to buy this house for $%d 6 | YSI_PROP_MAX_HOUSE = You cannot buy any more houses. 7 | 8 | 9 | YSI_ENTER_HELP_1 = Lets you into one of your houses 10 | YSI_ENTER_HELP_2 = Type this outside to get in 11 | YSI_ENTER_NOT_YOURS = You cannot enter properties you don't own 12 | YSI_ENTER_NO_HOUSE = There is no house here to enter 13 | 14 | 15 | [ysi_groups] 16 | YSI_CONGRP_HELP_1 = Usage: "/%n " OR: 17 | YSI_CONGRP_HELP_2 = "/%n " 18 | YSI_CONGRP_HELP_3 = First option to assign a player to a group 19 | YSI_CONGRP_HELP_4 = Second option to view the list of groups 20 | YSI_CONGRP_HELP_5 = If add is 1 they will be added to the specified 21 | YSI_CONGRP_HELP_6 = group, otherwise they'll be removed. 22 | YSI_GROUP_LIST_NAME = Group %d: "%s" 23 | YSI_GROUP_LIST_TEMP = Group %d: 24 | YSI_GROUP_LIST_PAGES = Use "/%n " where is 1 - %d to list 25 | YSI_GROUP_LIST_MORE = More than 8 groups found 26 | YSI_GROUP_LIST_ASS = Or "/%n " to assign a group 27 | YSI_CONGRP_ASSIGNED = Player %d's group assigned 28 | YSI_CONGRP_INVALID = Invalid playerid or groupid 29 | -------------------------------------------------------------------------------- /scriptfiles/YSI/text/y.EN: -------------------------------------------------------------------------------- 1 | [core] 2 | INVALID_PLAYER_SPECIFIED = {ERROR}Invalid player specified 3 | UNAUTHORIZED_ACTION = {ERROR}Unauthorized action 4 | CANNOT_USE_ON_SELF = {INFO}You can't use this action on yourself 5 | ACTION_SUCCESS = {SUCCESS}Action performed successfully 6 | INVALID_LEVEL_SPECIFIED = {ERROR}Invalid level specified. {INFO}Available levels range is between %d and %d 7 | OK = OK 8 | CLOSE = Close 9 | BACK = Back 10 | INSPECT = Inspect 11 | SELECT = Select 12 | INTERNAL_ERROR = {ERROR}Internal server error -------------------------------------------------------------------------------- /scriptfiles/YSI/text/y_players.EN: -------------------------------------------------------------------------------- 1 | [auth] 2 | LOGIN_BOX_TITLE = Please login 3 | LOGIN_BOX_TEXT = %s{WHITE}Please enter your passphrase.\nAttempt{/} {GRAY}%d/{/}{ERROR}%d{/} 4 | LOGIN_BOX_LOGIN = Login 5 | LOGIN_BOX_EXIT = Exit 6 | INVALID_PASSWORD = {ERROR}Invalid passphrase\n\n{/} 7 | INACTIVE_KICK = You have been kicked for not logging in 8 | EXCEEDED_MAX_LOGIN_ATTEMPTS = You have failed to login after %d attempts 9 | 10 | REGISTRAION_VIA_WEBSITE = This server does not allow registering in-game. Please check our website 11 | REGISTRATION_BOX_TITLE = Registration 12 | REGISTRATION_BOX_TEXT = %s{WHITE}Welcome new player!\nType in your new passphrase\nIt has to be between %d and %d characters long 13 | REGISTRATION_BOX_REGISTER = Register 14 | REGISTRATION_BOX_EXIT = Exit 15 | 16 | PASSWORD_EMPTY = {ERROR}Passphrase cannot be empty\n\n{/} 17 | PASSWORD_TOO_SHORT = {ERROR}Passphrase must be at least %d characters long\n\n{/} 18 | PASSWORD_TOO_LONG = {ERROR}Passphrase can be at most %d characters long\n\n{/} 19 | 20 | [admin] 21 | INVALID_COMMAND_PARAMS_SAL = {ERROR}Invalid parameters. {INFO}Usage: /%n () 22 | ADMIN_LEVEL_CHANGE = {INFO}Admin level of player %s was changed to %d by admin %s 23 | 24 | [status] 25 | PLAYER_STATS = {INFO}[Money] {NORMAL}%d {INFO}[Developer] {NORMAL}%s {INFO}[VIP] {NORMAL}%s {INFO}[Admin level] {NORMAL}%d -------------------------------------------------------------------------------- /scriptfiles/YSI/text/y_rp_factions.EN: -------------------------------------------------------------------------------- 1 | [core] 2 | FACTIONS = Factions 3 | INVALID_COMMAND_PARAMS_CF = {ERROR}Invalid parameters. {INFO}Usage: /%n 4 | FACTIONS_LIMIT_REACHED = {ERROR}Factions limit reached. Remove some factions first to continue. 5 | OWNER_FACTION = {NORMAL}You are now an owner of faction {INFO}%s. {NORMAL}Your budget is {SUCCESS}$%d 6 | NEW_FACTION = {NORMAL}A faction {INFO}%s{NORMAL} was just created by {INFO}%s{NORMAL}. The owner is {INFO}%s 7 | NOT_IN_ANY_FACTION = {ERROR}You are not in any faction 8 | 9 | INVALID_COMMAND_PARAMS_F = {ERROR}Invalid parameters. {INFO}Usage: /%n 10 | 11 | FACTIONS_LIST_TITLE = Factions list 12 | FACTIONS_LIST_HEADERS = Name%sNum members%sOwner 13 | FACTIONS_LIST_HEADERS_ADMIN = Name%sNum members%sOwner%sMoney 14 | FACTIONS_LIST_EMPTY = No factions found 15 | FACTIONS_LIST_NOT_YOURS = {ERROR}You can't inspect not your faction 16 | 17 | INVALID_COMMAND_PARAMS_SFM = {ERROR}Invalid parameters. {INFO}Usage: /%n 18 | INVALID_FACTION_ID_ERROR = {ERROR}Invalid faction id 19 | 20 | FACTIONS_INSPECT_TITLE = Choose an action 21 | FACTIONS_INSPECT_OPTIONS = Name\nMoney\nMembers\nRanks\nColour 22 | 23 | FACTIONS_RENAME_TITLE = Rename the faction 24 | FACTIONS_RENAME_BODY = %s{NORMAL}Renaming faction {INFO}%s{NORMAL}. Choose a new name 25 | FACTIONS_RENAME_ERROR = {ERROR}Name must be between {INFO}%d{ERROR} and {INFO}%d{ERROR} characters long\n\n 26 | FACTIONS_RENAMED = {SUCCESS}Faction renamed to {INFO}%s 27 | 28 | FACTIONS_SET_MONEY_TITLE = Set faction money 29 | FACTIONS_SET_MONEY_BODY = %s{NORMAL}Setting faction {INFO}%s{NORMAL} money. Select amount 30 | FACTIONS_SET_MONEY_ERROR = {ERROR}Money amount must be between {INFO}%d{ERROR} and {INFO}%d{ERROR}\n\n 31 | FACTIONS_SET_MONEY_DONE = {SUCCESS}Faction money set to {INFO}%d 32 | 33 | FACTIONS_MEMBERS_LIST_TITLE = Faction members 34 | FACTIONS_MEMBERS_LIST_HEADER = Name%sRank%sOnline 35 | FACTIONS_MEMBERS_LIST_ADD = Add a new member 36 | 37 | FACTIONS_MEMBERS_ADD_TITLE = Add a new member 38 | FACTIONS_MEMBERS_ADD_BODY = %s{NORMAL}Please input the new member {INFO}id{NORMAL} or {INFO}name{NORMAL} (if online), or {INFO}name{NORMAL} if offline. 39 | FACTIONS_MEMBERS_ADD_FULL = {ERROR}No more empty member slots in this faction 40 | FACTIONS_MEMBERS_ADD_ERROR_PLAYER = {ERROR}Specified player does not exist\n\n 41 | FACTIONS_MEMBERS_ADD_ERROR_ALREADY_IN_FACTION = {ERROR}This player already is in some faction\n\n 42 | FACTIONS_MEMBERS_ADD_ERROR_ALREADY_ADDED = {ERROR}This player already is in this faction\n\n 43 | FACTIONS_MEMBERS_ADDED = {SUCCESS}You have added player {INFO}%s{SUCCESS} to faction {INFO}%s 44 | FACTIONS_MEMBERS_ADDED_YOU = {NORMAL}Player {INFO}%s {NORMAL}added you to faction {INFO}%s 45 | 46 | FACTION_INSPECT_MEMBER_TITLE = Inspect member 47 | FACTION_INSPECT_MEMBER_BODY = Change player rank\nRemove player from faction 48 | 49 | FACTION_INSPECT_MEMBER_REMOVE_TITLE = Do you really want to remove this player? 50 | FACTION_INSPECT_MEMBER_REMOVE_BODY = {NORMAL}Confirm that you want to remove player {INFO}%s 51 | FACTION_INSPECT_MEMBER_REMOVED = {NORMAL}You removed player {INFO}%s {NORMAL}from faction {INFO}%s 52 | FACTION_INSPECT_MEMBER_REMOVED_YOU = {NORMAL}You have been removed from faction {INFO}%s {NORMAL}by {INFO}%s 53 | 54 | FACTION_INSPECT_MEMBER_CHANGE_RANK_TITLE = Change player faction rank 55 | FACTION_INSPECT_MEMBER_CHANGE_RANK_INVALID = {ERROR}Rank is not in the correct range\n\n 56 | FACTION_INSPECT_MEMBER_CHANGE_RANK_BODY = %s{NORMAL}Select a rank for player {INFO}%s{NORMAL} between {ERROR}%d{NORMAL} and {ERROR}%d 57 | FACTION_MEMBER_CHANGED_RANK = {NORMAL}You have changed {INFO}%s's{NORMAL} rank to {INFO}%d 58 | FACTION_MEMBER_CHANGED_RANK_YOU = {INFO}%s{NORMAL} changed your rank to {INFO}%d 59 | 60 | FACTIONS_RANKS_TITLE = Manage faction ranks 61 | 62 | FACTIONS_RANK_INSPECT_TITLE = Manage faction rank 63 | FACTIONS_RANK_INSPECT_OPTIONS = Change name 64 | 65 | FACTIONS_RANK_CHANGE_NAME_TITLE = Change rank name 66 | FACTIONS_RANK_CHANGE_NAME_BODY = %s{NORMAL}Select the new name for rank {INFO}%s 67 | FACTIONS_RANK_CHANGE_NAME_ERROR_EMPTY = {ERROR}Rank name cannot be empty\n\n 68 | FACTIONS_RANK_CHANGE_NAME_ERROR_LONG = {ERROR}Rank name can be at most {INFO}%d{ERROR} characters long\n\n 69 | 70 | FACTIONS_RANK_CHANGEED_NAME = {SUCCESS}Changed rank name to {INFO}%s 71 | 72 | FACTIONS_COLOURS_TITLE = Change faction colours -------------------------------------------------------------------------------- /scriptfiles/YSI/text/y_rp_players.EN: -------------------------------------------------------------------------------- 1 | [auth] 2 | INVALID_USERNAME = {WHITE}Your username is in an {/}{RED}invalid{/}{WHITE} format. It must be in form of {/}{INFO}"Firstname_Lastname"{/} 3 | 4 | [admin] 5 | ADUTY_ON = {SUCCESS}You are now on admin duty 6 | ADUTY_OFF = {SUCCESS}You are now not on admin duty 7 | ADUTY_BROADCAST_ON = {WHITE}[[ Admin %s is now on duty ]] 8 | ADUTY_BROADCAST_OFF = {WHITE}[[ Admin %s is no longer on duty ]] 9 | 10 | -------------------------------------------------------------------------------- /scriptfiles/YSI/text/y_vehicles.EN: -------------------------------------------------------------------------------- 1 | [core] 2 | INVALID_COMMAND_PARAMS_SETVCOLOR = {ERROR}Invalid parameters. {INFO}Usage: /%n 3 | INVALID_VEHICLE_INDEX = {ERROR}Invalid vehicle index.{INFO} Available range is %d to %d 4 | INVALID_VEHICLE_INDEX_EMPTY = {ERROR}You don't have a vehicle in this slot 5 | 6 | [status] 7 | VEHICLE_STATS = {INFO}[Vehicle %d] {NORMAL}%d 8 | -------------------------------------------------------------------------------- /scriptfiles/YSI/y_LANG_DATA.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Y-samp/Y-Core/aca42da9a604dccc394b7dc7fe331b4198a7946e/scriptfiles/YSI/y_LANG_DATA.yml -------------------------------------------------------------------------------- /scriptfiles/YSI/y_core_LANG_DATA.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Y-samp/Y-Core/aca42da9a604dccc394b7dc7fe331b4198a7946e/scriptfiles/YSI/y_core_LANG_DATA.yml -------------------------------------------------------------------------------- /scriptfiles/YSI/y_player_LANG_DATA.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Y-samp/Y-Core/aca42da9a604dccc394b7dc7fe331b4198a7946e/scriptfiles/YSI/y_player_LANG_DATA.yml -------------------------------------------------------------------------------- /scriptfiles/YSI/y_players_LANG_DATA.yml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /scriptfiles/YSI/y_rp_factions_LANG_DATA.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Y-samp/Y-Core/aca42da9a604dccc394b7dc7fe331b4198a7946e/scriptfiles/YSI/y_rp_factions_LANG_DATA.yml -------------------------------------------------------------------------------- /scriptfiles/YSI/y_rp_players_LANG_DATA.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Y-samp/Y-Core/aca42da9a604dccc394b7dc7fe331b4198a7946e/scriptfiles/YSI/y_rp_players_LANG_DATA.yml -------------------------------------------------------------------------------- /scriptfiles/YSI/y_vehicles_LANG_DATA.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Y-samp/Y-Core/aca42da9a604dccc394b7dc7fe331b4198a7946e/scriptfiles/YSI/y_vehicles_LANG_DATA.yml --------------------------------------------------------------------------------