SA-MP Forums Archive
Проблемы с YSF - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Русский/Russian (https://sampforum.blast.hk/forumdisplay.php?fid=32)
+---- Thread: Проблемы с YSF (/showthread.php?tid=602369)



Проблемы с YSF - themakar - 06.03.2016

Поставил себе плагин YSF из за расширенных функций с TD и других нужных функций.
В ходе использования почему-то функция IsValidPlayerTextDraw возвращает не ожидаемые значения.

Полная система в которой использую её:
PHP код:
UpdateVehicleDamage(playeridvehicleid)
{
    new 
        
color1,
        
color2,
        
modelid,
        
Float:health,
        
Float:progress
    
;
    
GetVehicleHealth(vehicleidhealth);
    
modelid GetVehicleModel(vehicleid);
    
GetVehicleColor(vehicleidcolor1color2);
    
    
progress = ((health-300.0) * 100.0 700.0) * 0.4;
    
    
printf("%f"progress);
    
    if (
progress 0.0progress 0.0;
    else if (
progress 40.0progress 40.0;
    
    if (!
IsValidPlayerTextDraw(playeridSpeedoTextDraws[playerid][8]))
    {
        
SpeedoTextDraws[playerid][8] = CreatePlayerTextDraw(playerid540.000000420.000000"LD_SPAC:white");
        
PlayerTextDrawLetterSize(playeridSpeedoTextDraws[playerid][8], 0.0000000.000000);
        
PlayerTextDrawTextSize(playeridSpeedoTextDraws[playerid][8], 40.000000, -progress);
        
PlayerTextDrawAlignment(playeridSpeedoTextDraws[playerid][8], 1);
        
PlayerTextDrawColor(playeridSpeedoTextDraws[playerid][8], 0x9CC254FF);
        
PlayerTextDrawSetShadow(playeridSpeedoTextDraws[playerid][8], 0);
        
PlayerTextDrawSetOutline(playeridSpeedoTextDraws[playerid][8], 0);
        
PlayerTextDrawBackgroundColor(playeridSpeedoTextDraws[playerid][8], 255);
        
PlayerTextDrawFont(playeridSpeedoTextDraws[playerid][8], 4);
        
PlayerTextDrawSetProportional(playeridSpeedoTextDraws[playerid][8], 0);
        
PlayerTextDrawSetShadow(playeridSpeedoTextDraws[playerid][8], 0);
        
PlayerTextDrawShow(playeridSpeedoTextDraws[playerid][8]);
        print(
"TD 8 Не создан");
    }
    else
    {
        
PlayerTextDrawTextSize(playeridSpeedoTextDraws[playerid][8], 40.000000, -progress);
        
PlayerTextDrawShow(playeridSpeedoTextDraws[playerid][8]);
        print(
"TD 8 создан");
    }
    if (!
IsValidPlayerTextDraw(playeridSpeedoTextDraws[playerid][9]))
    {    
        
SpeedoTextDraws[playerid][9] = CreatePlayerTextDraw(playerid540.000000380.000000"");
        
PlayerTextDrawLetterSize(playeridSpeedoTextDraws[playerid][9], 0.0000000.000000);
        
PlayerTextDrawTextSize(playeridSpeedoTextDraws[playerid][9], 40.00000040.000000);
        
PlayerTextDrawAlignment(playeridSpeedoTextDraws[playerid][9], 1);
        
PlayerTextDrawColor(playeridSpeedoTextDraws[playerid][9], -1);
        
PlayerTextDrawSetShadow(playeridSpeedoTextDraws[playerid][9], 0);
        
PlayerTextDrawSetOutline(playeridSpeedoTextDraws[playerid][9], 0);
        
PlayerTextDrawBackgroundColor(playeridSpeedoTextDraws[playerid][9], 0);
        
PlayerTextDrawFont(playeridSpeedoTextDraws[playerid][9], 5);
        
PlayerTextDrawSetProportional(playeridSpeedoTextDraws[playerid][9], 0);
        
PlayerTextDrawSetShadow(playeridSpeedoTextDraws[playerid][9], 0);
        
PlayerTextDrawSetPreviewModel(playeridSpeedoTextDraws[playerid][9], modelid);
        
PlayerTextDrawSetPreviewRot(playeridSpeedoTextDraws[playerid][9], -10.0000000.0000000.0000000.800000);
        
PlayerTextDrawSetPreviewVehCol(playeridSpeedoTextDraws[playerid][9], color1color2);
        
PlayerTextDrawShow(playeridSpeedoTextDraws[playerid][9]);
        print(
"TD 9 Не создан");
    }
    return 
true;

Вызов:
PHP код:
public OnPlayerUpdate(playerid)
{
    if ((new 
vehicleid GetPlayerVehicleID(playerid)) != && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        
UpdateVehicleDamage(playeridvehicleid);
    }
    
#if defined speedo_OnPlayerUpdate
        
return speedo_OnPlayerUpdate(playerid);
    
#else
            
return false;
    
#endif
}
#if defined _ALS_OnPlayerUpdate
    #undef OnPlayerUpdate
#else
    #define _ALS_OnPlayerUpdate
#endif
#define OnPlayerUpdate speedo_OnPlayerUpdate
#if defined speedo_OnPlayerUpdate
    
forward speedo_OnPlayerUpdate(playerid);
#endif 
Сервер лог:
PHP код:
[14:54:0240.000000
[14:54:02TD 8 Не создан
[14:54:02TD 9 Не создан
[14:54:0240.000000
[14:54:02TD 8 Не создан
[14:54:02TD 9 Не создан
[14:54:0240.000000
[14:54:02TD 8 Не создан
[14:54:02TD 9 Не создан
[14:54:0240.000000
[14:54:02TD 8 Не создан
[14:54:02TD 9 Не создан
[14:54:0240.000000
[14:54:02TD 8 Не создан
[14:54:02TD 9 Не создан 
UPD: Мде, еще год назад в теме писали, что не работает эта функция, так и не исправлено. Тему можно закрыть/удалить.


Re: Проблемы с YSF - ZiGGi - 06.03.2016

Должна работать. Не пробовал вызывать UpdateVehicleDamage с задержкой (лучше в таймере, а не в OnPlayerUpdate)?


Re: Проблемы с YSF - themakar - 06.03.2016

Quote:
Originally Posted by ZiGGi
Посмотреть сообщение
Должна работать. Не пробовал вызывать UpdateVehicleDamage с задержкой (лучше в таймере, а не в OnPlayerUpdate)?
Да пробовал вызвать командой, ситуация не изменялась.

Да я уже по другому это реализовал, когда узнал что эта функция не рабочая (версия плагина R14-2, более новая версия не хочет запускаться и во все).