Quote:
Originally Posted by Nanoxx™
So kann dir keiner helfen.
Entweder du zeigst uns den Teil in dem der Fehler auftritt / Die Fehlermeldung oder dir wird keiner Helfen 
|
ok
Code:
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 :
Code:
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 :/
HTML Code:
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);
}
Hoffentlich kann jemand helfen