5 posts in this topic

Спойлер

b896baa12061.png

При желании спидометр можно будет перевести на русский язык, однако при этом обязательно использование плагина CRP, иначе русские буквы просто не появятся! 

Перейдем к установке текстдрава и самого спидометра. 


Ко всем new: 

Спойлер

new Text:SBox;
new Text:SBox1;
new PlayerText:CarSpeed[MAX_PLAYERS];
new PlayerText:CarFuel[MAX_PLAYERS];
new PlayerText:CarMilliage[MAX_PLAYERS];
new PlayerText:CarLights[MAX_PLAYERS];
new PlayerText:CarEngine[MAX_PLAYERS];
new SpeedTimer[MAX_PLAYERS]; // таймер для спидометра
num vInfo
{
        vEngine,
        Float:vFuel,
        Float:vMilliage,
        vLights,
        Float:vPosx,Float:vPosy,Float:vPosz
};
new VehicleInfo[MAX_VEHICLES][vInfo];

 

В OnGameModeInit: 
 

Спойлер

SBox = TextDrawCreate(626.000000, 384.540008, "usebox");
TextDrawLetterSize(SBox, 0.000000, 5.905555);
TextDrawTextSize(SBox, 430.799987, 0.000000);
TextDrawAlignment(SBox, 1);
TextDrawColor(SBox, 0);
TextDrawUseBox(SBox, true);
TextDrawBoxColor(SBox, 102);
TextDrawSetShadow(SBox, 0);
TextDrawSetOutline(SBox, 0);
TextDrawFont(SBox, 0);

SBox1 = TextDrawCreate(601.875000, 383.250061, "LD_SPAC:white");
TextDrawLetterSize(SBox1, 0.000000, 0.000000);
TextDrawTextSize(SBox1, 21.250000, 57.166625);
TextDrawAlignment(SBox1, 1);
TextDrawColor(SBox1, 255);
TextDrawSetShadow(SBox1, 0);
TextDrawSetOutline(SBox1, 0);
TextDrawFont(SBox1, 4);

 

В OnPlayerConnect: 
 

Спойлер

CarSpeed[playerid] = CreatePlayerTextDraw(playerid, 442.399963, 386.026580, "SPEED: 100");
PlayerTextDrawLetterSize(playerid, CarSpeed[playerid], 0.401249, 1.430832);
PlayerTextDrawAlignment(playerid, CarSpeed[playerid], 1);
PlayerTextDrawColor(playerid, CarSpeed[playerid], -1);
PlayerTextDrawSetShadow(playerid, CarSpeed[playerid], 0);
PlayerTextDrawSetOutline(playerid, CarSpeed[playerid], 1);
PlayerTextDrawBackgroundColor(playerid, CarSpeed[playerid], 51);
PlayerTextDrawFont(playerid, CarSpeed[playerid], 1);
PlayerTextDrawSetProportional(playerid, CarSpeed[playerid], 1);

CarFuel[playerid] = CreatePlayerTextDraw(playerid, 442.149963, 401.026672, "FUEL: 1000");
PlayerTextDrawLetterSize(playerid, CarFuel[playerid], 0.401249, 1.430832);
PlayerTextDrawAlignment(playerid, CarFuel[playerid], 1);
PlayerTextDrawColor(playerid, CarFuel[playerid], -1);
PlayerTextDrawSetShadow(playerid, CarFuel[playerid], 0);
PlayerTextDrawSetOutline(playerid, CarFuel[playerid], 1);
PlayerTextDrawBackgroundColor(playerid, CarFuel[playerid], 51);
PlayerTextDrawFont(playerid, CarFuel[playerid], 1);
PlayerTextDrawSetProportional(playerid, CarFuel[playerid], 1);

CarMilliage[playerid] = CreatePlayerTextDraw(playerid, 441.899963, 416.610015, "MILLIAGE: 10000");
PlayerTextDrawLetterSize(playerid, CarMilliage[playerid], 0.401249, 1.430832);
PlayerTextDrawAlignment(playerid, CarMilliage[playerid], 1);
PlayerTextDrawColor(playerid, CarMilliage[playerid], -1);
PlayerTextDrawSetShadow(playerid, CarMilliage[playerid], 0);
PlayerTextDrawSetOutline(playerid, CarMilliage[playerid], 1);
PlayerTextDrawBackgroundColor(playerid, CarMilliage[playerid], 51);
PlayerTextDrawFont(playerid, CarMilliage[playerid], 1);
PlayerTextDrawSetProportional(playerid, CarMilliage[playerid], 1);

CarLights[playerid] = CreatePlayerTextDraw(playerid, 608.125000, 386.166625, "L");
PlayerTextDrawLetterSize(playerid, CarLights[playerid], 0.449999, 1.600000);
PlayerTextDrawAlignment(playerid, CarLights[playerid], 1);
PlayerTextDrawColor(playerid, CarLights[playerid], -1);
PlayerTextDrawSetShadow(playerid, CarLights[playerid], 0);
PlayerTextDrawSetOutline(playerid, CarLights[playerid], 1);
PlayerTextDrawBackgroundColor(playerid, CarLights[playerid], 51);
PlayerTextDrawFont(playerid, CarLights[playerid], 1);
PlayerTextDrawSetProportional(playerid, CarLights[playerid], 1);

CarEngine[playerid] = CreatePlayerTextDraw(playerid, 609.125000, 413.416778, "E");
PlayerTextDrawLetterSize(playerid, CarEngine[playerid], 0.449999, 1.600000);
PlayerTextDrawAlignment(playerid, CarEngine[playerid], 1);
PlayerTextDrawColor(playerid, CarEngine[playerid], -1);
PlayerTextDrawSetShadow(playerid, CarEngine[playerid], 0);
PlayerTextDrawSetOutline(playerid, CarEngine[playerid], 1);
PlayerTextDrawBackgroundColor(playerid, CarEngine[playerid], 51);
PlayerTextDrawFont(playerid, CarEngine[playerid], 1);
PlayerTextDrawSetProportional(playerid, CarEngine[playerid], 1);

 

В OnPlayerStateChange: 

Спойлер

if(newstate == PLAYER_STATE_DRIVER)
{
    if(!noeng(GetPlayerVehicleID(playerid)))
    {
        new v = GetPlayerVehicleID(playerid);
        VehicleInfo[v][vFuel] = 50.0;
        GetPlayerPos(playerid, VehicleInfo[v][vPosx],VehicleInfo[v][vPosy],VehicleInfo[v][vPosz]);
        TextDrawShowForPlayer(playerid, SBox);
        TextDrawShowForPlayer(playerid, SBox1);
        PlayerTextDrawShow(playerid, CarSpeed[playerid]);
        PlayerTextDrawShow(playerid, CarFuel[playerid]);
        PlayerTextDrawShow(playerid, CarMilliage[playerid]);
        PlayerTextDrawShow(playerid, CarLights[playerid]);
        PlayerTextDrawShow(playerid, CarEngine[playerid]);
        SpeedTimer[playerid] = SetTimerEx("UpdateSpeed",200,1,"d",playerid);
        return 1;
    }
}
if(oldstate == PLAYER_STATE_DRIVER)
{
    TextDrawHideForPlayer(playerid, SBox);
    TextDrawHideForPlayer(playerid, SBox1);
    PlayerTextDrawHide(playerid, CarSpeed[playerid]);
    PlayerTextDrawHide(playerid, CarFuel[playerid]);
    PlayerTextDrawHide(playerid, CarMilliage[playerid]);
    PlayerTextDrawHide(playerid, CarLights[playerid]);
    PlayerTextDrawHide(playerid, CarEngine[playerid]);
    KillTimer(SpeedTimer[playerid]);
    return 1;
}

 

В конец / середину мода создаем паблик: 

Спойлер

forward UpdateSpeed(playerid);
public UpdateSpeed(playerid)
{
        new string[256];
        new v = GetPlayerVehicleID(playerid);
        format(string,sizeof(string),"SPEED: %d",SpeedVehicle(playerid));
        PlayerTextDrawSetString(playerid, CarSpeed[playerid], string);
        format(string,sizeof(string),"FUEL: %d",floatround(VehicleInfo[v][vFuel]));
        PlayerTextDrawSetString(playerid, CarFuel[playerid], string);
        format(string,sizeof(string),"MILLIAGE: %d",floatround(VehicleInfo[v][vMilliage]));
        PlayerTextDrawSetString(playerid, CarMilliage[playerid], string);
        switch(VehicleInfo[v][vLights])
        {
            case 0: PlayerTextDrawSetString(playerid, CarLights[playerid], "~w~L");
            case 1: PlayerTextDrawSetString(playerid, CarLights[playerid], "~b~L");
        }
        if(VehicleInfo[v][vEngine]) PlayerTextDrawSetString(playerid, CarEngine[playerid], "~b~E");
        else PlayerTextDrawSetString(playerid, CarEngine[playerid],"~w~E");
        if(VehicleInfo[v][vFuel] <= 0)
        {
            VehicleInfo[v][vEngine] = 0;
            VehicleInfo[v][vFuel] = 0.0;
            SetVehicleParamsEx(v, VehicleInfo[v][vEngine], VehicleInfo[v][vLights],0,0,0,0,0);
        }
        if(GetPlayerDistanceFromPoint(playerid, VehicleInfo[v][vPosx], VehicleInfo[v][vPosy], VehicleInfo[v][vPosz]) > 50.0)
        {
            VehicleInfo[v][vMilliage] += 0.1;
            VehicleInfo[v][vFuel] -= 0.05;
            GetPlayerPos(playerid, VehicleInfo[v][vPosx],VehicleInfo[v][vPosy],VehicleInfo[v][
vPosz]);
        }
        return 1;
}

 

В OnPlayerKeyStateChange: 

Спойлер

if(newkeys & KEY_ACTION)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new v = GetPlayerVehicleID(playerid);
        if(!noeng(v))
        {
            if(!VehicleInfo[v][vFuel]) return 1;
            if(!VehicleInfo[v][vEngine]) VehicleInfo[v][vEngine] = 1;
            else VehicleInfo[v][vEngine] = 0;
            SetVehicleParamsEx(v, VehicleInfo[v][vEngine], VehicleInfo[v][vLights], 0, 0, 0, 0, 0);
            return 1;
        }
    }
}

 

В конец мода / ко всем стокам: 

Спойлер

stock noeng(carid)
{
        new model = GetVehicleModel(carid);
        if(model == 462||model == 448||model == 509|| model == 510||model == 481||model==468||model == 471 ||
        model == 511 || model == 512||model == 593||model == 520||model == 577||model == 476||model == 519 ||
        model == 460 || model == 513||model == 472||model==473||model == 493||model == 595 || model == 484 ||
        model == 430 || model == 453||model == 452||model == 446||model == 454 ||model == 548 ||model == 425||
        model == 417||model == 487||model == 488||model == 497||model == 563||model == 447||model == 469||model == 553) return 1;
        return 0;
}
stock SpeedVehicle(playerid)
{
    new Float:ST[4];
    if(IsPlayerInAnyVehicle(playerid))
        GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
        else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 100.3;
    return floatround(ST[3]);
}

 

Автор: wAx

Share this post


Link to post
Share on other sites

взял себе

Share this post


Link to post
Share on other sites

Ранее такого не видел, простенький и оригинальный

Share this post


Link to post
Share on other sites
19 минут назад, Гость Гость сказал:

2013 год pawn-wiki.Мда.

ты бы ещё через 30 лет ответил

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • Dworkin
      By Dworkin
      Привет. Мне тяжело дается понимание строк в pawn из за не динамических массивов.
      #include enum pInfo { pRangName[25] } new players[MAX_PLAYERS][pInfo]; new string[20]; main() { format(string, sizeof(string), "Салага"); printf(string); players[0][pRangName] = string; } выдает ошибку "error 047: array sizes do not match, or destination array is too small" на строку "players[0][pRangName] = string;"
      Я понимаю что в ошибке говорится что размер не совпадает, но не могу понять как это сделать в павне
    • Ero33
      By Ero33
      Помогите решить проблему всё сделал, mysql подклучен но не открывается окно регистрациа ---------- Loaded log file: "server_log.txt". ---------- SA-MP Dedicated Server ---------------------- v0.3.7-R2, (C)2005-2015 SA-MP Team [20:35:47] [20:35:47] Server Plugins [20:35:47] -------------- [20:35:47] Loading plugin: crashdetect.so [20:35:47] CrashDetect plugin 4.19.4 [20:35:47] Loaded. [20:35:47] Loading plugin: filemanager.so [20:35:47] ****************** [20:35:47] ** FILE MANAGER ** [20:35:47] ** Loaded ** [20:35:47] ** Version 1.5 ** [20:35:47] ****************** [20:35:47] Loaded. [20:35:47] Loading plugin: gvar.so [20:35:47] *** GVar Plugin v1.3 by Incognito loaded *** [20:35:47] Loaded. [20:35:47] Loading plugin: mysql.so [20:35:47] >> plugin.mysql: R41-4 successfully loaded. [20:35:47] Loaded. [20:35:47] Loading plugin: pawncmd.so [20:35:47] Pawn.CMD plugin v3.2.0 by urShadow has been loaded [20:35:47] Loaded. [20:35:47] Loading plugin: pawnraknet.so [20:35:47] [Pawn.RakNet] | Pawn.RakNet 1.4.1 | 2016 - 2020 |-------------------------------- | Author and maintainer: urShadow | Compiled: Jun 18 2020 at 11:28:17 |-------------------------------------------------------------- | Forum thread: https://forum.sa-mp.com/showthread.php?t=640306 |-------------------------------------------------------------- | Repository: https://github.com/urShadow/Pawn.RakNet |-------------------------------------------------------------- | Wiki: https://github.com/urShadow/Pawn.RakNet/wiki [20:35:47] Loaded. [20:35:47] Loading plugin: pawnregex.so [20:35:47] [Pawn.Regex] plugin v1.1.3 by urShadow loaded [20:35:47] Loaded. [20:35:47] Loading plugin: profiler.so [20:35:47] Profiler plugin 2.15.3 [20:35:47] Loaded. [20:35:47] Loading plugin: sscanf.so [20:35:47] [20:35:47] =============================== [20:35:47] sscanf plugin loaded. [20:35:47] Version: 2.8.3 [20:35:47] (c) 2018 Alex "Y_Less" Cole [20:35:47] =============================== [20:35:47] Loaded. [20:35:47] Loading plugin: streamer.so [20:35:47] *** Streamer Plugin v2.9.4 by Incognito loaded *** [20:35:47] Loaded. [20:35:47] Loading plugin: TOTP.so [20:35:47] TOTP plugin v1.0.1 by Games loaded. [20:35:47] Loaded. [20:35:47] Loaded 11 plugins. [20:35:47] [20:35:47] Filterscripts [20:35:47] --------------- [20:35:47] Loading filterscript 'rega_KYPE.amx'... [20:35:47] Loaded 1 filterscripts. [20:35:48] [20:35:48] -------------------------------------- [20:35:48] ������� Nex-AC ��������! [20:35:48] ������ ��������: 1.9.53 [20:35:48] �����: Nexius [20:35:48] -------------------------------------- [20:35:48] [�������� ...] �� MYSQL ������� ���������! (������ [��������] | 1) [20:35:48] [�������� ...] ��������� ������� �������� (0 ��.) [20:35:48] [�������� ...] �� ������� ������� ��������� (0 ��.) [20:35:48] [�������� ...] ���� ����/����� ������� �������� (0 ��.) [20:35:48] ����� � ���� �� ������� [20:35:48] [�������� ...] ���� ������� ��������� (0 ��.) [20:35:48] ������ � ���� �� ������� [20:35:48] [�������� ...] ����� ������� ��������� (0 ��.) [20:35:48] ��������� � ���� �� ������� [20:35:48] [�������� ...] ��������� ������� ��������� (0 ��.) [20:35:48] [�������� ...] ��������� ������� ��������� (0 ��.) [20:35:48] ����� � ���� �� ������� [20:35:48] [�������� ...] ����� ������� ��������� (0 ��.) [20:35:48] ������� � ������ � ���� �� ������� [20:35:48] [�������� ...] ������� � ����� ������� ��������� (0 ��.) [20:35:48] ���-�� ����'�� � ���� �� ��������� � �������������� ����������� [20:35:48] [�������� ...] ��������� �������� ������� ��������� (0 ��.) [20:35:48] �� ���������� func �������� � ���� [20:35:48] [�������� ...] ������� ������� ������� ��������� (0 ��.) [20:35:48] �� ���������� �������� � ���� [20:35:48] [�������� ...] ������� ������� ��������� (0 ��.) [20:35:48] [�������� ...] ������� ���� ������� ��������� (0 ��.) [20:35:48] [�������� ...] �������� ������� ��������� (0 ��.) [20:35:48] [�������� ...] ������� ������� ��������� (0 ��.) [20:35:48] [�������� ...] ���������� ������� ��������� (0 ��.) [20:35:48] [�������� ...] ������� ������� �������� (0 ��.) [20:35:48] [�������� ...] ������ ����� ������� �������� (0 ��.) [20:35:48] [�������� ...] ����������� ������� ��������� (0 ��.) [20:35:48] [�������� ...] ��������� ������� ��������� [20:35:48] �� ���������� ATMS � ���� [20:35:48] [�������� ...] ��������� ������� ��������� (0 ��.) [20:35:48] [�������� ...] ����������� ��������� [20:35:48] [�������� ...] ������ ������� ������� ��������� [20:35:48] �������� �� ������� [20:35:48] [������� ...] ������������ ��������: (19832 ��.) [20:35:48] [������� ...] ����������� ��������: (120 ��.) [20:35:48] _______________________________________________________ [20:35:48] [20:35:48] dev by: glvde. | vk.com/way_dev [20:35:48] aurora project � 2021, inc. all rights reserved. [20:35:48] _______________________________________________________ [20:35:48] Number of vehicle models: 109 [20:35:48] [OnQueryError] SQL ERROR. QUERY: [20:35:48] SET CHARACTER SET 'utf8' [20:35:48] [OnQueryError] SQL ERROR. QUERY: [20:35:48] SET NAMES 'utf8' [20:35:48] [OnQueryError] SQL ERROR. QUERY: [20:35:48] SET character_set_client = 'cp1251' [20:35:48] [OnQueryError] SQL ERROR. QUERY: [20:35:48] SET character_set_connection = 'cp1251' [20:35:48] [OnQueryError] SQL ERROR. QUERY: [20:35:48] SET character_set_results = 'cp1251' [20:35:48] [OnQueryError] SQL ERROR. QUERY: [20:35:48] SET SESSION collation_connection = 'utf8_general_ci' [20:35:48] [OnQueryError] SQL ERROR. QUERY: [20:35:48] UPDATE `accounts` SET `online_status` = '1001' [20:35:48] [OnQueryError] SQL ERROR. QUERY: [20:35:48] ALTER TABLE `accounts` ALTER `pCash` SET DEFAULT '0' [20:35:48] [OnQueryError] SQL ERROR. QUERY: [20:35:48] ALTER TABLE `accounts` ALTER `pLevel` SET DEFAULT '0' [20:35:48] [OnQueryError] SQL ERROR. QUERY: [20:35:48] UPDATE `reports` SET `count` = '0' WHERE `id` = 1