Nгo salva ao remover objeto anexado ao jogador -
rodrigo147 - 26.01.2016
Eae pessoal. Eu tenho um sistema de acessуrios aki. Ele salva e tudo atй ai nгo tem problema, mas quando vou deletar um objeto que ta attachado no player o objeto deleta mas nгo salva o deletamento, ou й um bug na stock dessa funзгo que faz deletar. Poderiam me ajudar?
ESSA STOCK ABAIXO QUE FAZ O LOAD DOS OBJETOS
Код:
stock LoadAttacheplayer(playerid)
{
new aname[MAX_PLAYER_NAME], file[100], strText[15], slots;
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_ACESSORIOS, aname);
if(DOF2::FileExists(file))
{
slots = MAX_PLAYER_ATTACHED_OBJECTS;
for(new i; i < slots; i++)
{
format(strText, 15, "%d_Used", i);
AttaCheP[playerid][i][Used] = bool:DOF2::GetInt(file,strText);
if(AttaCheP[playerid][i][Used] == true)
{
format(strText, 15, "%d_Modelo", i);
AttaCheP[playerid][i][ModeloID] = DOF2::GetInt(file,strText);
format(strText, 15, "%d_Bone", i);
AttaCheP[playerid][i][BoneID] = DOF2::GetInt(file,strText);
format(strText, 15, "%d_ApX", i);
AttaCheP[playerid][i][ApX] = DOF2::GetFloat(file,strText);
format(strText, 15, "%d_ApY", i);
AttaCheP[playerid][i][ApY] = DOF2::GetFloat(file,strText);
format(strText, 15, "%d_ApZ", i);
AttaCheP[playerid][i][ApZ] = DOF2::GetFloat(file,strText);
format(strText, 15, "%d_ArX", i);
AttaCheP[playerid][i][ArX] = DOF2::GetFloat(file,strText);
format(strText, 15, "%d_ArY", i);
AttaCheP[playerid][i][ArY] = DOF2::GetFloat(file,strText);
format(strText, 15, "%d_ArZ", i);
AttaCheP[playerid][i][ArZ] = DOF2::GetFloat(file,strText);
format(strText, 15, "%d_AeX", i);
AttaCheP[playerid][i][AeX] = DOF2::GetFloat(file,strText);
format(strText, 15, "%d_AeY", i);
AttaCheP[playerid][i][AeY] = DOF2::GetFloat(file,strText);
format(strText, 15, "%d_AeZ", i);
AttaCheP[playerid][i][AeZ] = DOF2::GetFloat(file,strText);
SetPlayerAttachedObject(playerid,i,AttaCheP[playerid][i][ModeloID],
AttaCheP[playerid][i][BoneID], AttaCheP[playerid][i][ApX],
AttaCheP[playerid][i][ApY], AttaCheP[playerid][i][ApZ],
AttaCheP[playerid][i][ArX], AttaCheP[playerid][i][ArY],
AttaCheP[playerid][i][ArZ], AttaCheP[playerid][i][AeX],
AttaCheP[playerid][i][AeY], AttaCheP[playerid][i][AeZ]);
}
}
}
else
{
for(new i; i < MAX_PLAYER_ATTACHED_OBJECTS; i++)
{
AttaCheP[playerid][i][Used] = false;
AttaCheP[playerid][i][ModeloID] = 0;
AttaCheP[playerid][i][BoneID] = 0;
AttaCheP[playerid][i][ApX] = 0;
AttaCheP[playerid][i][ApY] = 0;
AttaCheP[playerid][i][ApZ] = 0;
AttaCheP[playerid][i][ArX] = 0;
AttaCheP[playerid][i][ArY] = 0;
AttaCheP[playerid][i][ArZ] = 0;
AttaCheP[playerid][i][AeX] = 0;
AttaCheP[playerid][i][AeY] = 0;
AttaCheP[playerid][i][AeZ] = 0;
}
}
return 1;
}
ESSA STOCK QUE FAZ O OBJETO REMOVER DO PLAYER (SУ Q QUANDO REMOVO O OBJETO VOLTA DEPOIS DUM GMX)
Код:
stock RemoveSlotAttached(playerid, index)
{
new aname[MAX_PLAYER_NAME],file[40],strText[15];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_ACESSORIOS, aname);
if(DOF2::FileExists(file))
{
format(strText, 15, "%d_Used", index);
DOF2::SetInt(file, strText, false);
RemovePlayerAttachedObject(playerid, index);
DOF2::SaveFile();
}
return 1;
}
A DIALOG QUE VOCE CLICA EM DELETAR DAI REMOVE O ATTACH DO PLAYER
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_ATTACH_INDEX_SELECTION:
{
if(response)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, listitem))
{
ShowPlayerDialog(playerid, DIALOG_ATTACH_EDITREPLACE, DIALOG_STYLE_MSGBOX, \
"{FF0000}Acessуrios {FFFFFF}- Modificaзгo", "Vocк deseja editar ou deletar seu acessуrio?", "Editar", "Deletar");
}
else
{
new string[4000+1];
for(new x;x<sizeof(AttachmentObjects);x++)
{
format(string, sizeof(string), "%s%s\n", string, AttachmentObjects[x][attachname]);
}
ShowPlayerDialog(playerid, DIALOG_ATTACH_MODEL_SELECTION, DIALOG_STYLE_LIST, \
"{FF0000}Acessуrios Modificaзгo {FFFFFF}- Selecionar o modelo", string, "Selecionar", "Cancelar");
}
SetPVarInt(playerid, "AttachmentIndexSel", listitem);
}
return 1;
}
case DIALOG_ATTACH_EDITREPLACE:
{
if(response) EditAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"));
else RemoveSlotAttached(playerid, GetPVarInt(playerid, "AttachmentIndexSel")),
RemovePlayerAttachedObject(playerid,GetPVarInt(playerid, "AttachmentIndexSel"));
DeletePVar(playerid, "AttachmentIndexSel");
DOF2::SaveFile();
return 1;
}
CFG DO ARQUIVOS SALVO (TERIA DE FICAR ESSAS COORDENADAS PARA 0 PARA SUMIR DO CORPO DO PLAYER)
Код:
0_Used = 1
0_Modelo = 18975
0_Bone = 2
0_ApX = 0.14899994
0_ApY = 0.00000000
0_ApZ = 0.00000000
0_ArX = 0.00000000
0_ArY = 0.00000000
0_ArZ = 0.00000000
0_AeX = 1.00000000
0_AeY = 1.00000000
0_AeZ = 1.00000000
1_Used = 1
1_Modelo = 18635
1_Bone = 2
1_ApX = 0.00000000
1_ApY = 0.00000000
1_ApZ = 0.00000000
1_ArX = 0.00000000
1_ArY = 0.00000000
1_ArZ = 0.00000000
1_AeX = 1.00000000
1_AeY = 1.00000000
1_AeZ = 1.00000000
Re: Nгo salva ao remover objeto anexado ao jogador -
XandyMello - 27.01.2016
pawn Код:
stock RemoveSlotAttached(playerid, index)
{
new aname[MAX_PLAYER_NAME],file[40],strText[15];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_ACESSORIOS, aname);
if(DOF2::FileExists(file))
{
format(strText, 15, "%d_Used", index);
DOF2::SetInt(file, strText, false);
AttaCheP[playerid][Used] = false;
AttaCheP[playerid][ModeloID] = 0;
AttaCheP[playerid][BoneID] = 0;
AttaCheP[playerid][ApX] = 0;
AttaCheP[playerid][ApY] = 0;
AttaCheP[playerid][ApZ] = 0;
AttaCheP[playerid][ArX] = 0;
AttaCheP[playerid][ArY] = 0;
AttaCheP[playerid][ArZ] = 0;
AttaCheP[playerid][AeX] = 0;
AttaCheP[playerid][AeY] = 0;
AttaCheP[playerid][AeZ] = 0;
DOF2::SaveFile();
}
return 1;
}
@Edit
pawn Код:
stock RemoveSlotAttached(playerid, index)
{
AttaCheP[playerid][index][Used] = false;
AttaCheP[playerid][index][ModeloID] = 0;
AttaCheP[playerid][index][BoneID] = 0;
AttaCheP[playerid][index][ApX] = 0;
AttaCheP[playerid][index][ApY] = 0;
AttaCheP[playerid][index][ApZ] = 0;
AttaCheP[playerid][index][ArX] = 0;
AttaCheP[playerid][index][ArY] = 0;
AttaCheP[playerid][index][ArZ] = 0;
AttaCheP[playerid][index][AeX] = 0;
AttaCheP[playerid][index][AeY] = 0;
AttaCheP[playerid][index][AeZ] = 0;
RemovePlayerAttachedObject(playerid, index);
}
return 1;
}
Re: Nгo salva ao remover objeto anexado ao jogador -
rodrigo147 - 27.01.2016
VLW CARA FUNCIONOU :d