PDA

Просмотр полной версии : [Вопрос] PlayerTextDrawSetString



_MegaMix_
30.12.2016, 14:17
Здравствуйте, появилась такая проблема, создаю текстдрав по стандарту он пустой(" "), потом в 1-секундном таймере формат, где присваивается значение от GetPlayerScore(playerid), и потом это значение присваиваю текстдраву, но проблема в том, что когда начали тестировать(2 игрока), у 1 показывает, а у второго нет. В чём может быть проблема?


new PlayerText:dlscore[MAX_PLAYERS][6];

disconnect:

for(new l = 0; l < 6; l++)
PlayerTextDrawHide(playerid,dlscore[playerid][l]);

spawn:
for(new l = 0; l < 6; l++)
PlayerTextDrawShow(playerid,dlscore[playerid][l]);

connect:

dlscore[playerid][0] = CreatePlayerTextDraw(playerid,487.101013, 102.000022, "=");//5
PlayerTextDrawLetterSize(playerid,dlscore[playerid][0], 4.863469, 0.608331);
PlayerTextDrawAlignment(playerid,dlscore[playerid][0], 1);
PlayerTextDrawColor(playerid,dlscore[playerid][0], 16711935);
PlayerTextDrawSetShadow(playerid,dlscore[playerid][0], 0);
PlayerTextDrawSetOutline(playerid,dlscore[playerid][0], 0);
PlayerTextDrawBackgroundColor(playerid,dlscore[playerid][0], 51);
PlayerTextDrawFont(playerid,dlscore[playerid][0], 2);
PlayerTextDrawSetProportional(playerid,dlscore[playerid][0], 1);

dlscore[playerid][1] = CreatePlayerTextDraw(playerid,487.101013, 120.749992, "=");//5
PlayerTextDrawLetterSize(playerid,dlscore[playerid][1], 4.863469, 0.608331);
PlayerTextDrawAlignment(playerid,dlscore[playerid][1], 1);
PlayerTextDrawColor(playerid,dlscore[playerid][1], 16711935);
PlayerTextDrawSetShadow(playerid,dlscore[playerid][1], 0);
PlayerTextDrawSetOutline(playerid,dlscore[playerid][1], 1);
PlayerTextDrawBackgroundColor(playerid,dlscore[playerid][1], 51);
PlayerTextDrawFont(playerid,dlscore[playerid][1], 2);
PlayerTextDrawSetProportional(playerid,dlscore[playerid][1], 1);

dlscore[playerid][2] = CreatePlayerTextDraw(playerid,497.101013, 106.166671, "LD_SPAC:white");
PlayerTextDrawLetterSize(playerid,dlscore[playerid][2], 0.000000, 0.000000);
PlayerTextDrawTextSize(playerid,dlscore[playerid][2], 111.508056, 16.333328);
PlayerTextDrawAlignment(playerid,dlscore[playerid][2], 1);
PlayerTextDrawColor(playerid,dlscore[playerid][2], -2147483393);
PlayerTextDrawSetShadow(playerid,dlscore[playerid][2], 0);
PlayerTextDrawSetOutline(playerid,dlscore[playerid][2], 0);
PlayerTextDrawBackgroundColor(playerid,dlscore[playerid][2], -1378294017);
PlayerTextDrawFont(playerid,dlscore[playerid][2], 4);

//этот текстдрав который не обновляется
dlscore[playerid][3] = CreatePlayerTextDraw(playerid,499.443725, 106.750007, "");//этот текстдрав который не обновляется
PlayerTextDrawLetterSize(playerid,dlscore[playerid][3], 0.207304, 1.471662);
PlayerTextDrawAlignment(playerid,dlscore[playerid][3], 1);
PlayerTextDrawColor(playerid,dlscore[playerid][3], -1);
PlayerTextDrawSetShadow(playerid,dlscore[playerid][3], 0);
PlayerTextDrawSetOutline(playerid,dlscore[playerid][3], 1);
PlayerTextDrawBackgroundColor(playerid,dlscore[playerid][3], 255);
PlayerTextDrawFont(playerid,dlscore[playerid][3], 2);
PlayerTextDrawSetProportional(playerid,dlscore[playerid][3], 1);

dlscore[playerid][4] = CreatePlayerTextDraw(playerid,497.622272, 278.250030, "");
PlayerTextDrawLetterSize(playerid,dlscore[playerid][4], 0.270556, 1.564999);
PlayerTextDrawAlignment(playerid,dlscore[playerid][4], 1);
PlayerTextDrawColor(playerid,dlscore[playerid][4], -1);
PlayerTextDrawSetShadow(playerid,dlscore[playerid][4], 0);
PlayerTextDrawSetOutline(playerid,dlscore[playerid][4], 1);
PlayerTextDrawBackgroundColor(playerid,dlscore[playerid][4], 51);
PlayerTextDrawFont(playerid,dlscore[playerid][4], 2);
PlayerTextDrawSetProportional(playerid,dlscore[playerid][4], 1);

dlscore[playerid][5] = CreatePlayerTextDraw(playerid,497.811131, 296.916656, "");
PlayerTextDrawLetterSize(playerid,dlscore[playerid][5], 0.263059, 1.529999);
PlayerTextDrawAlignment(playerid,dlscore[playerid][5], 1);
PlayerTextDrawColor(playerid,dlscore[playerid][5], -1);
PlayerTextDrawSetShadow(playerid,dlscore[playerid][5], 0);
PlayerTextDrawSetOutline(playerid,dlscore[playerid][5], 1);
PlayerTextDrawBackgroundColor(playerid,dlscore[playerid][5], 51);
PlayerTextDrawFont(playerid,dlscore[playerid][5], 2);
PlayerTextDrawSetProportional(playerid,dlscore[playerid][5], 1);

В Таймер:

new hex[36];
format(hex,sizeof(hex),".:SCR: %d / LVL: %d:.",GetPlayerScore(playerid),GetPVarInt(playerid,"Kills_Lvl"));
PlayerTextDrawSetString(playerid,dlscore[playerid][3], hex);

DeimoS
30.12.2016, 14:38
Покажи запуск таймера

_MegaMix_
30.12.2016, 14:48
Покажи запуск таймера


new
MainProcessorTimer;

MainProcessorTimer = SetTimer("ModProcessor", 1000, true); //в ongamemodeinit

DeimoS
30.12.2016, 15:18
А в самом паблике ModProcessor у тебя цикл или ты просто объявил его так?

forward ModProcessor(playerid);
public ModProcessor(playerid)
Если второй вариант, то естественно ничего работать не будет. Либо делай цикл, либо запускай индивидуальные таймеры для каждого игрока

_MegaMix_
30.12.2016, 15:21
А в самом паблике ModProcessor у тебя цикл или ты просто объявил его так?

forward ModProcessor(playerid);
public ModProcessor(playerid)
Если второй вариант, то естественно ничего работать не будет. Либо делай цикл, либо запускай индивидуальные таймеры для каждого игрока


for(new playerid = GetPlayerPoolSize(); playerid >= 0; playerid--)
{
if((!IsPlayerConnected(playerid)) || (GetPVarInt(playerid,"IsPlayerSpawned") != 1))return true;
остальной код
}

Таймер то как раз и работает, все остальное в нём обновляется и отзывается, но обновление данного текстдрава только для 1 игрока

qwezert
30.12.2016, 16:18
for(new playerid = GetPlayerPoolSize(); playerid >= 0; playerid--)
{
if((!IsPlayerConnected(playerid)) || (GetPVarInt(playerid,"IsPlayerSpawned") != 1))return true;
остальной код
}

Таймер то как раз и работает, все остальное в нём обновляется и отзывается, но обновление данного текстдрава только для 1 игрока

Ты проверь, может сам текстрав не показывает просто? Обновлятся - он может обновляется, но игрок его просто не видит. Цикл где ты показываешь текстдрав игроку покажи

_MegaMix_
30.12.2016, 16:29
Ты проверь, может сам текстрав не показывает просто? Обновлятся - он может обновляется, но игрок его просто не видит. Цикл где ты показываешь текстдрав игроку покажи

Он у меня показывается 1 раз - в спавне


spawn:
for(new l = 0; l < 6; l++)
PlayerTextDrawShow(playerid,dlscore[playerid][l]);

Nexius_Tailer
30.12.2016, 16:46
После обновления строки попробуй заново показывать игроку текстдрав

_MegaMix_
30.12.2016, 16:59
После обновления строки попробуй заново показывать игроку текстдрав

Сейчас вообще ни у кого нет(((

qwezert
30.12.2016, 17:49
Я вот только сейчас обратил внимание. А зачем такая конструкция - dlscore[playerid][0] ?
CreatePlayerTextDraw создает текстдрав и так для каждого игрока. Это у тебя получилась инвалидная коляска а не костыль.
Должно быть так

dlscore[0] = CreatePlayerTextDraw(playerid,487.101013, 102.000022, "=");//5
PlayerTextDrawLetterSize(playerid,dlscore[0], 4.863469, 0.608331);
PlayerTextDrawAlignment(playerid,dlscore[0], 1);
.....
for(new l = 0; l < 6; l++)
PlayerTextDrawShow(playerid,dlscore[l]);

Отредактируй, проблема может быть решена таким способом.

Nexius_Tailer
30.12.2016, 17:49
Решил посмотреть выложенный код детальнее.



for(new playerid = GetPlayerPoolSize(); playerid >= 0; playerid--)
{
if((!IsPlayerConnected(playerid)) || (GetPVarInt(playerid,"IsPlayerSpawned") != 1))return true;
остальной код
}

Таймер то как раз и работает, все остальное в нём обновляется и отзывается, но обновление данного текстдрава только для 1 игрока

А именно:

if((!IsPlayerConnected(playerid)) || (GetPVarInt(playerid,"IsPlayerSpawned") != 1))return true;
Здесь ошибка, цикл прервётся полностью после нахождения хотя-бы одного пустого слота. Вместо "return true;" юзай "continue;", для начала.

_MegaMix_
30.12.2016, 18:29
Я вот только сейчас обратил внимание. А зачем такая конструкция - dlscore[playerid][0] ?
CreatePlayerTextDraw создает текстдрав и так для каждого игрока. Это у тебя получилась инвалидная коляска а не костыль.
Должно быть так

dlscore[0] = CreatePlayerTextDraw(playerid,487.101013, 102.000022, "=");//5
PlayerTextDrawLetterSize(playerid,dlscore[0], 4.863469, 0.608331);
PlayerTextDrawAlignment(playerid,dlscore[0], 1);
.....
for(new l = 0; l < 6; l++)
PlayerTextDrawShow(playerid,dlscore[l]);

Отредактируй, проблема может быть решена таким способом.

Сделал, но по прежнему 2 игрок не видит,(видит игрок под идом 0 получается)

- - - Добавлено - - -


Решил посмотреть выложенный код детальнее.



А именно:

if((!IsPlayerConnected(playerid)) || (GetPVarInt(playerid,"IsPlayerSpawned") != 1))return true;
Здесь ошибка, цикл прервётся полностью после нахождения хотя-бы одного пустого слота. Вместо "return true;" юзай "continue;", для начала.

Сделал вот так, но всё равно не виден для игрока (
Причём другие системы все работают и обновляются

if((!IsPlayerConnected(playerid)) && (GetPVarInt(playerid,"IsPlayerSpawned") == 0))continue;

_MegaMix_
30.12.2016, 19:45
Для интереса сделал вывод в консоль, у моего игрока выводит и обновляет, а у второго не передаётся значение и в консоль ничего не выводит

new str[32];
format(str,sizeof(str),".:SCR: %d / LVL: %d:.",GetPlayerScore(playerid), GetPVarInt(playerid,"Kills_Lvl"));
printf("вывод %s",str);

DeimoS
31.12.2016, 01:07
Почему ты так боишься дать полный код? По этим огрызкам трудно что-то понять.

_MegaMix_
31.12.2016, 07:54
Почему ты так боишься дать полный код? По этим огрызкам трудно что-то понять.


public ModProcessor()
{
CheckProcessorTimer++;

new hour, minute;
gettime(hour,minute,_);

new clock[17];
format(clock, sizeof(clock), "%02d:%02d", hour, minute);
TextDrawSetString(Clock, clock);


for(new i = GetPlayerPoolSize(); i >= 0; i--)
{
//if((!IsPlayerConnected(i)) || (GetPVarInt(i,"IsPlayerSpawned") != 1))return true;
if(!IsPlayerConnected(i)) continue;
if(GetPVarInt(i,"IsPlayerSpawned") == 1)
{
SetPVarInt(i, "AFKTime", GetPVarInt(i, "AFKTime") + 1);
if(GetPVarInt(i, "AFKTime") >= 4)
{
new afkstring[18];
if(GetPVarInt(i, "AFKTime") > 3599) return format(afkstring, sizeof(afkstring), "На паузе %d:%02d:%02d", floatround(GetPVarInt(i, "AFKTime") / 3600), floatround((GetPVarInt(i, "AFKTime") - 3600) / 60), GetPVarInt(i, "AFKTime") - 3600);
else if(GetPVarInt(i, "AFKTime") > 59) format(afkstring, sizeof(afkstring), "На паузе %d:%02d", floatround(GetPVarInt(i, "AFKTime") / 60), GetPVarInt(i, "AFKTime") - 60);
else format(afkstring, sizeof(afkstring), "На паузе %d сек.", GetPVarInt(i, "AFKTime"));
SetPlayerChatBubble(i, afkstring, yellow, 10.0, 1000);
}

if(SI[i][Time] == -1)
return SetPlayerTime(i,hour,minute);

if(GetPVarInt(i,"ACWorld") > 0)
if(GetPlayerVirtualWorld(i) != AW)
return SetPlayerVirtualWorld(i,AW);

if ( GetPVarInt ( i, "Mute" ) > 0 )
{
SetPVarInt ( i, "Mute", GetPVarInt (i, "Mute" ) -1 );
if ( GetPVarInt ( i, "Mute" ) == 0 )
return SendClientMessage (i, red, "Вы снова можете писать в чат!" );
}
if(GetPVarInt(i,"DMZONES") != 1 && GetPVarInt(i,"ACWorld") != 1 && GetPlayerVirtualWorld(i) != AW)
{
if(GetPlayerWeapon(i) == 38 || GetPlayerWeapon(i) == 44 || GetPlayerWeapon(i) == 45 || GetPlayerWeapon(i) == 35 || GetPlayerWeapon(i) == 36 || GetPlayerWeapon(i) == 37)
{
new string[108];
format(string,sizeof(string),"{819FF7}.:: Игрок %s(%d) отправлен в Читерский Мир. Причина: Weapon-Hack ::..",PlayerInfo[i][pName],i);
MessageToAdmins2(orange,string);
SaveIn("Chitmir",string);
SetPlayerVirtualWorld(i,AW);
SetPVarInt(i,"ACWorld",1);
return SendClientMessage(i,yellow,"[RDD]: {81DAF5}Вы были отправлены в Читерский Мир!. Причина: Weapon-Hack");
}
}
switch(GetPlayerScore(i)/100)
{
case 0..19: SetPVarInt(i,"Kills_Lvl",1);
case 20..29: SetPVarInt(i,"Kills_Lvl",2);
case 30..39: SetPVarInt(i,"Kills_Lvl",3);
case 40..49: SetPVarInt(i,"Kills_Lvl",4);
case 50..59: SetPVarInt(i,"Kills_Lvl",5);
case 60..69: SetPVarInt(i,"Kills_Lvl",6);
case 70..79: SetPVarInt(i,"Kills_Lvl",7);
case 80..89: SetPVarInt(i,"Kills_Lvl",8);
case 90..99: SetPVarInt(i,"Kills_Lvl",9);
case 100..119: SetPVarInt(i,"Kills_Lvl",10);
case 120..139: SetPVarInt(i,"Kills_Lvl",11);
case 140..159: SetPVarInt(i,"Kills_Lvl",12);
case 160..179: SetPVarInt(i,"Kills_Lvl",13);
case 180..199: SetPVarInt(i,"Kills_Lvl",14);
case 200..219: SetPVarInt(i,"Kills_Lvl",15);
case 220..239: SetPVarInt(i,"Kills_Lvl",16);
case 240..259: SetPVarInt(i,"Kills_Lvl",17);
case 260..279: SetPVarInt(i,"Kills_Lvl",18);
case 280..299: SetPVarInt(i,"Kills_Lvl",19);
case 300..349: SetPVarInt(i,"Kills_Lvl",20);
case 350..399: SetPVarInt(i,"Kills_Lvl",21);
case 400..449: SetPVarInt(i,"Kills_Lvl",22);
case 450..499: SetPVarInt(i,"Kills_Lvl",23);
case 500..549: SetPVarInt(i,"Kills_Lvl",24);
case 550..599: SetPVarInt(i,"Kills_Lvl",25);
case 600..649: SetPVarInt(i,"Kills_Lvl",26);
case 650..749: SetPVarInt(i,"Kills_Lvl",27);
case 750..899: SetPVarInt(i,"Kills_Lvl",28);
case 900..999: SetPVarInt(i,"Kills_Lvl",29);
case 1000..1599: SetPVarInt(i,"Kills_Lvl",30);
case 1600..2199: SetPVarInt(i,"Kills_Lvl",31);
case 2200..2799: SetPVarInt(i,"Kills_Lvl",32);
case 2800..3399: SetPVarInt(i,"Kills_Lvl",33);
case 3400..3999: SetPVarInt(i,"Kills_Lvl",34);
default: SetPVarInt(i,"Kills_Lvl",35);
}

new str[32];
format(str,sizeof(str),".:SCR: %d / LVL: %d:.",GetPlayerScore(i), GetPVarInt(i,"Kills_Lvl"));
PlayerTextDrawSetString(i,dlscore[3], str);
PlayerTextDrawShow(i,dlscore[3]);

if(GetPlayerDistanceFromPoint(i, 256.8835,-1855.9874,5.8387) <= 70.0)
{
if(GetPVarInt(i,"DISKOTEKA") == 0 && GetPVarInt(i,"DiscoOn") == 1)
{
SetPlayerTime(i,2,0);
SetPlayerWeather(i,17);
SetPVarInt(i,"DISKOTEKA",1);
PlayAudioStreamForPlayer(i, MusicURL, 256.8835,-1855.9874,5.8387,70,true);
}
}
else if(GetPlayerDistanceFromPoint(i, 256.8835,-1855.9874,5.8387) > 70.0)
if(GetPVarInt(i,"DISKOTEKA") == 1)
SetPVarInt(i,"DISKOTEKA",0), StopAudioStreamForPlayer(i);
}
}
if(CheckProcessorTimer % (60*8) == 0) ReklamaAndWeather();
if(CheckProcessorTimer % (60*60) == 0)
{
for(new playerida = GetPlayerPoolSize(); playerida >= 0; playerida--)
if(IsPlayerConnected(playerida))
SavePlayerStats(playerida);
HousePay();
MoneyForBusiness();
}
if(CheckProcessorTimer % (60*60*24) == 0) CheckProcessorTimer = 0;
return 1;
}

- - - Добавлено - - -


Я вчера в другой таймер добавил это обновление и как ни странно, оно разработало, а тут почему-то не хочет

DeimoS
31.12.2016, 12:53
Ну так может потому что ты используешь return везде, где ни попадя? Ознакомься (http://pro-pawn.ru/showthread.php?6662-%D0%9E%D0%BF%D0%B5%D1%80%D0%B0%D1%82%D0%BE%D1%80-%D0%B2%D0%BE%D0%B7%D0%B2%D1%80%D0%B0%D1%82%D0%B0-%28return%29).



public ModProcessor()
{
CheckProcessorTimer++;

new hour, minute;
gettime(hour,minute,_);

new clock[17];
format(clock, sizeof(clock), "%02d:%02d", hour, minute);
TextDrawSetString(Clock, clock);


for(new i = GetPlayerPoolSize(); i >= 0; i--)
{
if(!GetPVarInt(playerid,"IsPlayerSpawned"))
continue;
SetPVarInt(i, "AFKTime", GetPVarInt(i, "AFKTime") + 1);
if(GetPVarInt(i, "AFKTime") >= 4)
{
new afkstring[18];
if(GetPVarInt(i, "AFKTime") > 3599)
format(afkstring, sizeof(afkstring), "На паузе %d:%02d:%02d", floatround(GetPVarInt(i, "AFKTime") / 3600), floatround((GetPVarInt(i, "AFKTime") - 3600) / 60), GetPVarInt(i, "AFKTime") - 3600);
else if(GetPVarInt(i, "AFKTime") > 59)
format(afkstring, sizeof(afkstring), "На паузе %d:%02d", floatround(GetPVarInt(i, "AFKTime") / 60), GetPVarInt(i, "AFKTime") - 60);
else
format(afkstring, sizeof(afkstring), "На паузе %d сек.", GetPVarInt(i, "AFKTime"));
SetPlayerChatBubble(i, afkstring, yellow, 10.0, 1000);
}

if(SI[i][Time] == -1)
SetPlayerTime(i,hour,minute);

if(GetPVarInt(i,"ACWorld") > 0)
if(GetPlayerVirtualWorld(i) != AW)
SetPlayerVirtualWorld(i,AW);

if ( GetPVarInt ( i, "Mute" ) > 0 )
{
SetPVarInt ( i, "Mute", GetPVarInt (i, "Mute" ) -1 );
if ( GetPVarInt ( i, "Mute" ) == 0 )
SendClientMessage (i, red, "Вы снова можете писать в чат!" );
}
if(GetPVarInt(i,"DMZONES") != 1 && GetPVarInt(i,"ACWorld") != 1 && GetPlayerVirtualWorld(i) != AW)
{
if(GetPlayerWeapon(i) == 38 || GetPlayerWeapon(i) == 44 || GetPlayerWeapon(i) == 45 || GetPlayerWeapon(i) == 35 || GetPlayerWeapon(i) == 36 || GetPlayerWeapon(i) == 37)
{
new string[108];
format(string,sizeof(string),"{819FF7}.:: Игрок %s(%d) отправлен в Читерский Мир. Причина: Weapon-Hack ::..",PlayerInfo[i][pName],i);
MessageToAdmins2(orange,string);
SaveIn("Chitmir",string);
SetPlayerVirtualWorld(i,AW);
SetPVarInt(i,"ACWorld",1);
SendClientMessage(i,yellow,"[RDD]: {81DAF5}Вы были отправлены в Читерский Мир!. Причина: Weapon-Hack");
}
}
switch(GetPlayerScore(i)/100)
{
case 0..19: SetPVarInt(i,"Kills_Lvl",1);
case 20..29: SetPVarInt(i,"Kills_Lvl",2);
case 30..39: SetPVarInt(i,"Kills_Lvl",3);
case 40..49: SetPVarInt(i,"Kills_Lvl",4);
case 50..59: SetPVarInt(i,"Kills_Lvl",5);
case 60..69: SetPVarInt(i,"Kills_Lvl",6);
case 70..79: SetPVarInt(i,"Kills_Lvl",7);
case 80..89: SetPVarInt(i,"Kills_Lvl",8);
case 90..99: SetPVarInt(i,"Kills_Lvl",9);
case 100..119: SetPVarInt(i,"Kills_Lvl",10);
case 120..139: SetPVarInt(i,"Kills_Lvl",11);
case 140..159: SetPVarInt(i,"Kills_Lvl",12);
case 160..179: SetPVarInt(i,"Kills_Lvl",13);
case 180..199: SetPVarInt(i,"Kills_Lvl",14);
case 200..219: SetPVarInt(i,"Kills_Lvl",15);
case 220..239: SetPVarInt(i,"Kills_Lvl",16);
case 240..259: SetPVarInt(i,"Kills_Lvl",17);
case 260..279: SetPVarInt(i,"Kills_Lvl",18);
case 280..299: SetPVarInt(i,"Kills_Lvl",19);
case 300..349: SetPVarInt(i,"Kills_Lvl",20);
case 350..399: SetPVarInt(i,"Kills_Lvl",21);
case 400..449: SetPVarInt(i,"Kills_Lvl",22);
case 450..499: SetPVarInt(i,"Kills_Lvl",23);
case 500..549: SetPVarInt(i,"Kills_Lvl",24);
case 550..599: SetPVarInt(i,"Kills_Lvl",25);
case 600..649: SetPVarInt(i,"Kills_Lvl",26);
case 650..749: SetPVarInt(i,"Kills_Lvl",27);
case 750..899: SetPVarInt(i,"Kills_Lvl",28);
case 900..999: SetPVarInt(i,"Kills_Lvl",29);
case 1000..1599: SetPVarInt(i,"Kills_Lvl",30);
case 1600..2199: SetPVarInt(i,"Kills_Lvl",31);
case 2200..2799: SetPVarInt(i,"Kills_Lvl",32);
case 2800..3399: SetPVarInt(i,"Kills_Lvl",33);
case 3400..3999: SetPVarInt(i,"Kills_Lvl",34);
default: SetPVarInt(i,"Kills_Lvl",35);
}

new str[32];
format(str,sizeof(str),".:SCR: %d / LVL: %d:.",GetPlayerScore(i), GetPVarInt(i,"Kills_Lvl"));
PlayerTextDrawSetString(i,dlscore[3], str);
PlayerTextDrawShow(i,dlscore[3]);

if(GetPlayerDistanceFromPoint(i, 256.8835,-1855.9874,5.8387) <= 70.0)
{
if(GetPVarInt(i,"DISKOTEKA") == 0 && GetPVarInt(i,"DiscoOn") == 1)
{
SetPlayerTime(i,2,0);
SetPlayerWeather(i,17);
SetPVarInt(i,"DISKOTEKA",1);
PlayAudioStreamForPlayer(i, MusicURL, 256.8835,-1855.9874,5.8387,70,true);
}
}
else if(GetPlayerDistanceFromPoint(i, 256.8835,-1855.9874,5.8387) > 70.0)
if(GetPVarInt(i,"DISKOTEKA") == 1)
SetPVarInt(i,"DISKOTEKA",0), StopAudioStreamForPlayer(i);
}
if(CheckProcessorTimer % (60*8) == 0) ReklamaAndWeather();
if(CheckProcessorTimer % (60*60) == 0)
{
for(new playerida = GetPlayerPoolSize(); playerida >= 0; playerida--)
if(IsPlayerConnected(playerida))
SavePlayerStats(playerida);
HousePay();
MoneyForBusiness();
}
if(CheckProcessorTimer % (60*60*24) == 0) CheckProcessorTimer = 0;
return 1;
}

vovandolg
31.12.2016, 14:34
if(CheckProcessorTimer % (60*8) == 0) ReklamaAndWeather();
if(CheckProcessorTimer % (60*60) == 0)
{
for(new playerida = GetPlayerPoolSize(); playerida >= 0; playerida--)
if(IsPlayerConnected(playerida))
SavePlayerStats(playerida);
HousePay();
MoneyForBusiness();
}
if(CheckProcessorTimer % (60*60*24) == 0) CheckProcessorTimer = 0;


Дикий ужас творится на этом участке кода, по моему лишний перебор игроков можно всё было сделать в одном
А те проверки остальные можно было бы вызывать за пределами изначального перебора...

_MegaMix_
31.12.2016, 15:40
Ну так может потому что ты используешь return везде, где ни попадя? Ознакомься (http://pro-pawn.ru/showthread.php?6662-%D0%9E%D0%BF%D0%B5%D1%80%D0%B0%D1%82%D0%BE%D1%80-%D0%B2%D0%BE%D0%B7%D0%B2%D1%80%D0%B0%D1%82%D0%B0-%28return%29).



public ModProcessor()
{
CheckProcessorTimer++;

new hour, minute;
gettime(hour,minute,_);

new clock[17];
format(clock, sizeof(clock), "%02d:%02d", hour, minute);
TextDrawSetString(Clock, clock);


for(new i = GetPlayerPoolSize(); i >= 0; i--)
{
if(!GetPVarInt(playerid,"IsPlayerSpawned"))
continue;
SetPVarInt(i, "AFKTime", GetPVarInt(i, "AFKTime") + 1);
if(GetPVarInt(i, "AFKTime") >= 4)
{
new afkstring[18];
if(GetPVarInt(i, "AFKTime") > 3599)
format(afkstring, sizeof(afkstring), "На паузе %d:%02d:%02d", floatround(GetPVarInt(i, "AFKTime") / 3600), floatround((GetPVarInt(i, "AFKTime") - 3600) / 60), GetPVarInt(i, "AFKTime") - 3600);
else if(GetPVarInt(i, "AFKTime") > 59)
format(afkstring, sizeof(afkstring), "На паузе %d:%02d", floatround(GetPVarInt(i, "AFKTime") / 60), GetPVarInt(i, "AFKTime") - 60);
else
format(afkstring, sizeof(afkstring), "На паузе %d сек.", GetPVarInt(i, "AFKTime"));
SetPlayerChatBubble(i, afkstring, yellow, 10.0, 1000);
}

if(SI[i][Time] == -1)
SetPlayerTime(i,hour,minute);

if(GetPVarInt(i,"ACWorld") > 0)
if(GetPlayerVirtualWorld(i) != AW)
SetPlayerVirtualWorld(i,AW);

if ( GetPVarInt ( i, "Mute" ) > 0 )
{
SetPVarInt ( i, "Mute", GetPVarInt (i, "Mute" ) -1 );
if ( GetPVarInt ( i, "Mute" ) == 0 )
SendClientMessage (i, red, "Вы снова можете писать в чат!" );
}
if(GetPVarInt(i,"DMZONES") != 1 && GetPVarInt(i,"ACWorld") != 1 && GetPlayerVirtualWorld(i) != AW)
{
if(GetPlayerWeapon(i) == 38 || GetPlayerWeapon(i) == 44 || GetPlayerWeapon(i) == 45 || GetPlayerWeapon(i) == 35 || GetPlayerWeapon(i) == 36 || GetPlayerWeapon(i) == 37)
{
new string[108];
format(string,sizeof(string),"{819FF7}.:: Игрок %s(%d) отправлен в Читерский Мир. Причина: Weapon-Hack ::..",PlayerInfo[i][pName],i);
MessageToAdmins2(orange,string);
SaveIn("Chitmir",string);
SetPlayerVirtualWorld(i,AW);
SetPVarInt(i,"ACWorld",1);
SendClientMessage(i,yellow,"[RDD]: {81DAF5}Вы были отправлены в Читерский Мир!. Причина: Weapon-Hack");
}
}
switch(GetPlayerScore(i)/100)
{
case 0..19: SetPVarInt(i,"Kills_Lvl",1);
case 20..29: SetPVarInt(i,"Kills_Lvl",2);
case 30..39: SetPVarInt(i,"Kills_Lvl",3);
case 40..49: SetPVarInt(i,"Kills_Lvl",4);
case 50..59: SetPVarInt(i,"Kills_Lvl",5);
case 60..69: SetPVarInt(i,"Kills_Lvl",6);
case 70..79: SetPVarInt(i,"Kills_Lvl",7);
case 80..89: SetPVarInt(i,"Kills_Lvl",8);
case 90..99: SetPVarInt(i,"Kills_Lvl",9);
case 100..119: SetPVarInt(i,"Kills_Lvl",10);
case 120..139: SetPVarInt(i,"Kills_Lvl",11);
case 140..159: SetPVarInt(i,"Kills_Lvl",12);
case 160..179: SetPVarInt(i,"Kills_Lvl",13);
case 180..199: SetPVarInt(i,"Kills_Lvl",14);
case 200..219: SetPVarInt(i,"Kills_Lvl",15);
case 220..239: SetPVarInt(i,"Kills_Lvl",16);
case 240..259: SetPVarInt(i,"Kills_Lvl",17);
case 260..279: SetPVarInt(i,"Kills_Lvl",18);
case 280..299: SetPVarInt(i,"Kills_Lvl",19);
case 300..349: SetPVarInt(i,"Kills_Lvl",20);
case 350..399: SetPVarInt(i,"Kills_Lvl",21);
case 400..449: SetPVarInt(i,"Kills_Lvl",22);
case 450..499: SetPVarInt(i,"Kills_Lvl",23);
case 500..549: SetPVarInt(i,"Kills_Lvl",24);
case 550..599: SetPVarInt(i,"Kills_Lvl",25);
case 600..649: SetPVarInt(i,"Kills_Lvl",26);
case 650..749: SetPVarInt(i,"Kills_Lvl",27);
case 750..899: SetPVarInt(i,"Kills_Lvl",28);
case 900..999: SetPVarInt(i,"Kills_Lvl",29);
case 1000..1599: SetPVarInt(i,"Kills_Lvl",30);
case 1600..2199: SetPVarInt(i,"Kills_Lvl",31);
case 2200..2799: SetPVarInt(i,"Kills_Lvl",32);
case 2800..3399: SetPVarInt(i,"Kills_Lvl",33);
case 3400..3999: SetPVarInt(i,"Kills_Lvl",34);
default: SetPVarInt(i,"Kills_Lvl",35);
}

new str[32];
format(str,sizeof(str),".:SCR: %d / LVL: %d:.",GetPlayerScore(i), GetPVarInt(i,"Kills_Lvl"));
PlayerTextDrawSetString(i,dlscore[3], str);
PlayerTextDrawShow(i,dlscore[3]);

if(GetPlayerDistanceFromPoint(i, 256.8835,-1855.9874,5.8387) <= 70.0)
{
if(GetPVarInt(i,"DISKOTEKA") == 0 && GetPVarInt(i,"DiscoOn") == 1)
{
SetPlayerTime(i,2,0);
SetPlayerWeather(i,17);
SetPVarInt(i,"DISKOTEKA",1);
PlayAudioStreamForPlayer(i, MusicURL, 256.8835,-1855.9874,5.8387,70,true);
}
}
else if(GetPlayerDistanceFromPoint(i, 256.8835,-1855.9874,5.8387) > 70.0)
if(GetPVarInt(i,"DISKOTEKA") == 1)
SetPVarInt(i,"DISKOTEKA",0), StopAudioStreamForPlayer(i);
}
if(CheckProcessorTimer % (60*8) == 0) ReklamaAndWeather();
if(CheckProcessorTimer % (60*60) == 0)
{
for(new playerida = GetPlayerPoolSize(); playerida >= 0; playerida--)
if(IsPlayerConnected(playerida))
SavePlayerStats(playerida);
HousePay();
MoneyForBusiness();
}
if(CheckProcessorTimer % (60*60*24) == 0) CheckProcessorTimer = 0;
return 1;
}

Спасибо большое, сейчас всё работает!)