22.02.2016, 05:59
3D HUD
22.02.2016, 06:06
Ага.
22.02.2016, 06:24
22.02.2016, 10:48
Нужно самому писать.
22.02.2016, 10:50
22.02.2016, 11:45
Через персональные объекты, аттач объекта к игроку и материал.
22.02.2016, 11:50
22.02.2016, 12:33
22.02.2016, 12:44
22.02.2016, 13:30
Ну так ищи в чем причина краша сервера с YSF при подключении нового игрока. Ищи и исправляй. В чем проблема? Нет проблемы.
22.02.2016, 13:44
22.02.2016, 13:56
Плагин здесь не при чем. Проблема в тебе.
22.02.2016, 14:01
22.02.2016, 19:23
Ну так узнавай, почему происходит краш.
22.02.2016, 19:57
Я не думаю что проблема в плагине. Скорей всего проблема в вашем коде которого вы не выложили но помимо этого просите помощи.
23.02.2016, 11:25
(
Последний раз редактировалось me1m; 24.02.2016 в 22:37.
)
При подключении второго игрока краш сампа
PHP код:
#include <a_samp>
#include <YSF>
#include <streamer>
main(){}
forward UpdateHealthEx();
new po_health[MAX_PLAYERS];
public OnGameModeInit()
{
SetTimer("UpdateHealthEx", 1000, true);
return 1;
}
public OnPlayerConnect(playerid)
{
po_health[playerid] = INVALID_OBJECT_ID;
return 1;
}
public OnPlayerSpawn(playerid)
{
po_health[playerid] = INVALID_OBJECT_ID;
if(po_health[playerid] == INVALID_OBJECT_ID)
po_health[playerid] = CreateDynamicObject(19475, -100.0, -100.0, -100.0, 0.0, 0.0, 0.0);
SetPVarInt(playerid, "spawned", 1);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
SetPVarInt(playerid, "spawned", 0);
if(po_health[playerid] != INVALID_OBJECT_ID)
DestroyDynamicObject(po_health[playerid]);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
SetPVarInt(playerid, "spawned", 0);
if(po_health[playerid] != INVALID_OBJECT_ID)
DestroyDynamicObject(po_health[playerid]);
return 1;
}
public UpdateHealthEx()
{
for(new p = 0, all = (GetMaxPlayers()+1); p != all; p++)
{
if(IsPlayerConnected(p) && !IsPlayerNPC(p) && GetPVarInt(p, "spawned") == 1) UpdateHealth(p);
}
return false;
}
stock UpdateHealth(const playerid)
{
new Float: health, string[20];
GetPlayerHealth(playerid, health);
format(string, sizeof(string), "{ffffff}+%.0f", health);
SetDynamicObjectMaterialText(po_health[playerid], 0, string, 90, "Arial", 70, 1, -16776961, 0, 0);
AttachDynamicObjectToPlayer(po_health[playerid], playerid, -0.4000, -0.6, -0.5, 0.00000, -90.00000, 180.00000);
return 0;
}
23.02.2016, 19:10
YSF это 100%
23.02.2016, 19:35
Не по теме, но
странная логика. Здесь не нужно po_health[playerid] = INVALID_OBJECT_ID; это надо делать в местах, где объект удаляется, или где он еще не создан (при подключении). Иначе обходим OnPlayerDeath и получаем туеву хучу диких объектов.
PHP код:
public OnPlayerSpawn(playerid)
{
po_health[playerid] = INVALID_OBJECT_ID;
if(po_health[playerid] == INVALID_OBJECT_ID)
po_health[playerid] = CreateDynamicObject(19475, -100.0, -100.0, -100.0, 0.0, 0.0, 0.0);
SetPVarInt(playerid, "spawned", 1);
return 1;
}
23.02.2016, 20:11
Quote:
Не по теме, но
PHP код:
|
24.02.2016, 12:16
(
Последний раз редактировалось me1m; 24.02.2016 в 22:38.
)
От проблемы все же не избавился
PHP код:
#include <a_samp>
#include <YSF>
#include <streamer>
main(){}
forward UpdateHealthEx();
new po_health[MAX_PLAYERS];
public OnGameModeInit()
{
SetTimer("UpdateHealthEx", 1000, true);
return 1;
}
public OnPlayerConnect(playerid)
{
po_health[playerid] = INVALID_OBJECT_ID;
return 1;
}
public OnPlayerSpawn(playerid)
{
po_health[playerid] = CreateDynamicObject(19475, -100.0, -100.0, -100.0, 0.0, 0.0, 0.0);
SetPVarInt(playerid, "spawned", 1);
GivePlayerWeapon(playerid, WEAPON_M4, 250);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
SetPVarInt(playerid, "spawned", 0);
if(po_health[playerid] != INVALID_OBJECT_ID)
{
DestroyDynamicObject(po_health[playerid]);
po_health[playerid] = INVALID_OBJECT_ID;
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
SetPVarInt(playerid, "spawned", 0);
if(po_health[playerid] != INVALID_OBJECT_ID)
{
DestroyDynamicObject(po_health[playerid]);
}
return 1;
}
public UpdateHealthEx()
{
for(new p = 0, all = (GetMaxPlayers()+1); p != all; p++)
{
if(IsPlayerConnected(p) && !IsPlayerNPC(p) && GetPVarInt(p, "spawned") == 1) UpdateHealth(p);
}
return false;
}
stock UpdateHealth(const playerid)
{
new Float: health, string[20];
GetPlayerHealth(playerid, health);
format(string, sizeof(string), "{ffffff}+%.0f", health);
SetDynamicObjectMaterialText(po_health[playerid], 0, string, 90, "Arial", 70, 1, -16776961, 0, 0);
AttachDynamicObjectToPlayer(po_health[playerid], playerid, -0.4000, -0.6, -0.5, 0.00000, -90.00000, 180.00000);
return 0;
}
« Next Oldest | Next Newest »
Users browsing this thread: 2 Guest(s)