01.06.2020, 23:43
Meu servidor fica caindo quando entra uns 8, e simplesmente a conta de alguns reseta e dб senha errada, refiz o sistema de registro 2 vezes de formas diferentes e da a mesma coisa.
warning: Strings without a length are deprecated, please add a destination size.
warning: String buffer overflow.
e dps
--- Server Shutting Down.
stock SaveInventory(playerid)
{
new gItemList[200];
new filename[48], str[64];
GetPlayerName(playerid,filename, 25);
format(str, 64,"Inventory/%s.inv",filename);
new File:file=fopen(str, io_append);
for(new item;item<MAX_INV_ITEMS;item++)
{
if(!strlen(_GetItemNamePVar(playerid,item))||!_GetItemAmountPVar(playerid,item))continue;
format(gItemList,sizeof(gItemList),"%s%s\n%d\n",gItemList,_GetItemNamePVar(playerid,item),_GetItemAmountPVar(playerid,item));
}
fwrite(file, gItemList);
fclose(file);
}
Peguei no console isso:
PHP Code:
|
Nгo testei manim. Vк ae se funciona
PHP Code:
|
public OnPlayerConnect(playerid)
{
format(arquivo, sizeof(arquivo), "Contas/%s.ini", pName2(playerid));
if(DOF2_FileExists(arquivo))
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Logar", "Vocк й Registrado, digite sua senha para logar!\nSe errar 5 vezes sua conta serб banida!", "Confirma", "Cancelar");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registro", "Vocк ainda nгo й Registrado, digite uma senha para se registrar!", "Confirma", "Cancelar");
}
AlreadyGiveWeapons[playerid] = false;
SetPlayerCameraPos(playerid, -2494.6897,1508.4241,242.3019);
SetPlayerCameraLookAt(playerid, -2571.0085,1640.4097,202.2260);
CarregarPlayerText(playerid);
for(new i; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) RemovePlayerAttachedObject(playerid, i); // Remove os objetos
for(new i; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
ShowProgressBarForPlayer(i, barsede);
ShowProgressBarForPlayer(i, barfome);
}
}
new string[50];
format(string,sizeof(string), "{FFFF00}%s {C0C0C0}Entrou no servidor.", pName2(playerid));
SendClientMessageToAll(-1,string);
SendDC(CHANNEL_ID, "```%s Entrou no servidor.```", pName2(playerid));
SetTimerEx( "Payday", 1800000, true, "i", playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
pInfo[playerid][pLevel] = GetPlayerScore(playerid);
vida32[playerid] = GetPlayerHealth(playerid);
colete32[playerid] = GetPlayerArmour(playerid);
GetPlayerPos(playerid, pInfo[playerid][pPosX], pInfo[playerid][pPosY], pInfo[playerid][pPosZ]);
format(arquivo, sizeof(arquivo), "Contas/%s.ini", pName2(playerid)); //Formata o arquivo com o nome do playerid
if(DOF2_FileExists(arquivo))
{
DOF2_SetInt(arquivo, "Senha", pInfo[playerid][pSenha]);
DOF2_SetInt(arquivo, "Coin", pInfo[playerid][pCoin]);
DOF2_SetInt(arquivo, "Score", pInfo[playerid][pLevel]);
DOF2_SetInt(arquivo, "Mochila", pInfo[playerid][pBackpack]);
DOF2_SetInt(arquivo, "OColete", pInfo[playerid][pTemColete]);
DOF2_SetInt(arquivo, "Capacete", pInfo[playerid][pTemCapacete]);
DOF2_SetInt(arquivo, "Kills", pkill[playerid]);
DOF2_SetInt(arquivo, "Death", pdeath[playerid]);
DOF2_SetInt(arquivo, "Fome", pInfo[playerid][pFome]);
DOF2_SetInt(arquivo, "Sede", pInfo[playerid][pSede]);
DOF2_SetInt(arquivo, "Admin", pInfo[playerid][pAdmin]);
DOF2_SetInt(arquivo, "Skin", pInfo[playerid][pSkin]);
DOF2_SetInt(arquivo, "GPS", pInfo[playerid][pTemGPS]);
DOF2_SetInt(arquivo, "Banido", pInfo[playerid][pBanido]);
DOF2_SetFloat(arquivo, "vida", vida32[playerid]);
DOF2_SetFloat(arquivo, "colete", colete32[playerid]);
DOF2_SetFloat(arquivo, "SpawnX", pInfo[playerid][pPosX]);
DOF2_SetFloat(arquivo, "SpawnY", pInfo[playerid][pPosY]);
DOF2_SetFloat(arquivo, "SpawnZ", pInfo[playerid][pPosZ]);
DOF2_SaveFile();
}
pInfo[playerid][pSenha] = 0;
KillTimer(SangueTimer[playerid]);
for(new Player_Data:i; i < Player_Data; i++) pInfo[playerid][i] = 0; // Resta os Dados
pInfo[playerid][pConectado] = false;
return 1;
}