|
C-/C++-Quelltext
|
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
|
local Player ={};
for(local i = 0; i < getMaxSlots(); ++i)
{
Player[i] <- {};
Player[i].itemCount <- 0;
Player[i].item <- {};
Player[i].timeLastItem <- 0;
for(local j = 0; j < 5000; ++j)
{
Player[i].item[j] <- {instance = "", amount = 0};
}
}
function onEquipment(playerName, instance, amount)
{
for(local i = 0; i < getMaxSlots(); ++i)
{
if( isConnected(i) == true && getPlayerName(i) == playerName )
{
if( Player[i].timeLastItem < getTickCount() ) // FEHLERZEILE
{
Player[i].itemCount = 0;
Player[i].timeLastItem = getTickCount() + 3000;
}
Player[i].item[Player[i].itemCount].instance = instance;
Player[i].item[Player[i].itemCount].amount = amount;
Player[i].itemCount = Player[i].itemCount + 1;
break;
}
}
}
|
Hier ist das Problem das der Index "timeLastItem" nicht existiert.
Nachdem ich mich auslogge aus dem Spiel habe ich das Problem, das er den "Error " Index ItemCount" existiert nicht" ausspuckt
Hier die Zeilen :
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
function saveItems(pid)
{
local itemsCount = Player[pid].itemCount;
if( itemsCount > 0 ) // FEHLERZEILE
{
local file = fileOpen(getPlayerName(pid) + ".eq", "w");
if( file )
{
for(local i = 0; i < itemsCount; ++i)
fileWrite(file, format("%s %d", Player[pid].item[i].instance, Player[pid].item[i].amount));
fileClose(file);
}
}
}
|
Dadurch kommt es wohl dazu, das SaveItems unter onDisconnect rumspinnt :/
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
function onDisconnect(pid, reason)
{
local message = getPlayerName(pid) + " wurde vom Server getrennt.";
for (local i = 0; i < getMaxSlots(); ++i)
if (pid != i && isConnected(i))
sendMessage(i, 255, 0, 0, message);
//Save
savePlayer(pid);
clearPlayerStructure(pid);
saveItems(pid); // FEHLERZEILE
clearItemsTable(pid);
}
|
Ich hoffe jemand kann helfen :/