Nгo estб salvando as posiзхes -
druiida159 - 30.12.2015
Estou usando um sistema de acessуrios, eu jб fiz de tudo para que ele funcionasse e mais um pouco, mais ele nгo salva a posiзгo dos objetos, quando eu uso o comando e edito a posiзгo do objeto ele fica certo para min, mais para as outras pessoas fica na posiзгo em que ele foi originalmente adcionado
Print
Comando
Код:
CMD:usaritem(playerid, params[])
{
static
type[24];
if (sscanf(params, "s[24]", type))
{
SendSyntaxMessage(playerid, "/usaritem [item]");
SendClientMessage(playerid, COLOR_YELLOW, "[ITENS]:{FFFFFF} distintivo, colete, chapeu, coldre, bigode, coletetransito, oculos, retirarobjetos.");
return 1;
}
if (!strcmp(type, "distintivo", true))
{
if (GetFactionType(playerid) != FACTION_POLICE)
return SendErrorMessage(playerid, "Vocк deve ser um agente da polнcia.");
SetPlayerAttachedObject(playerid, 0, 19775, 1);
EditAttachedObject(playerid, 0);
SendClientMessage(playerid, COLOR_WHITE, "Vocк pegou seu distintivo!");
}
else if (!strcmp(type, "colete", true))
{
if (GetFactionType(playerid) != FACTION_POLICE)
return SendErrorMessage(playerid, "Vocк deve ser um agente da polнcia.");
SetPlayerAttachedObject(playerid, 1, 19142, 1);
EditAttachedObject(playerid, 1);
SendClientMessage(playerid, COLOR_WHITE, "Vocк pegou seu colete!");
}
else if (!strcmp(type, "chapeu", true))
{
if (GetFactionType(playerid) != FACTION_POLICE)
return SendErrorMessage(playerid, "Vocк deve ser um agente da polнcia.");
SetPlayerAttachedObject(playerid, 2, 19095, 2);
EditAttachedObject(playerid, 2);
SendClientMessage(playerid, COLOR_WHITE, "Vocк pegou seu chapйu!");
}
else if (!strcmp(type, "coldre", true))
{
if (GetFactionType(playerid) != FACTION_POLICE)
return SendErrorMessage(playerid, "Vocк deve ser um agente da polнcia.");
SetPlayerAttachedObject(playerid, 3, 19773, 8);
EditAttachedObject(playerid, 3);
SendClientMessage(playerid, COLOR_WHITE, "Vocк pegou seu coldre!");
}
else if (!strcmp(type, "bigode", true))
{
if (GetFactionType(playerid) != FACTION_POLICE)
return SendErrorMessage(playerid, "Vocк deve ser um agente da polнcia.");
SetPlayerAttachedObject(playerid, 4, 19351, 2);
EditAttachedObject(playerid, 4);
SendClientMessage(playerid, COLOR_WHITE, "Vocк pegou seu bigode!");
}
else if (!strcmp(type, "coletetransito", true))
{
if (GetFactionType(playerid) != FACTION_POLICE)
return SendErrorMessage(playerid, "Vocк deve ser um agente da polнcia.");
SetPlayerAttachedObject(playerid, 5, 19904, 1);
EditAttachedObject(playerid, 5);
SendClientMessage(playerid, COLOR_WHITE, "Vocк pegou seu colete de trбnsito!");
}
else if (!strcmp(type, "oculos", true))
{
if (GetFactionType(playerid) != FACTION_POLICE)
return SendErrorMessage(playerid, "Vocк deve ser um agente da polнcia.");
SetPlayerAttachedObject(playerid, 6, 19138, 1);
EditAttachedObject(playerid, 6);
SendClientMessage(playerid, COLOR_WHITE, "Vocк pegou seu уculos!");
}
else if (!strcmp(type, "retirarobjetos", true))
{
if (GetFactionType(playerid) != FACTION_POLICE)
return SendErrorMessage(playerid, "Vocк deve ser um agente da polнcia.");
for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);
}
}
return 1;
}
Public
Код:
public OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
if (response)
{
if (PlayerData[playerid][pEditType] != 0)
{
AccessoryData[playerid][PlayerData[playerid][pEditType]-1][0] = fOffsetX;
AccessoryData[playerid][PlayerData[playerid][pEditType]-1][1] = fOffsetY;
AccessoryData[playerid][PlayerData[playerid][pEditType]-1][2] = fOffsetZ;
AccessoryData[playerid][PlayerData[playerid][pEditType]-1][3] = fRotX;
AccessoryData[playerid][PlayerData[playerid][pEditType]-1][4] = fRotY;
AccessoryData[playerid][PlayerData[playerid][pEditType]-1][5] = fRotZ;
AccessoryData[playerid][PlayerData[playerid][pEditType]-1][6] = (fScaleX > 3.0) ? (3.0) : (fScaleX);
AccessoryData[playerid][PlayerData[playerid][pEditType]-1][7] = (fScaleY > 3.0) ? (3.0) : (fScaleY);
AccessoryData[playerid][PlayerData[playerid][pEditType]-1][8] = (fScaleZ > 3.0) ? (3.0) : (fScaleZ);
switch (PlayerData[playerid][pEditType])
{
case 1:
{
PlayerData[playerid][pEditType] = 0;
PlayerData[playerid][pGlasses] = modelid;
if (!PlayerData[playerid][pCreated])
{
for (new i = 23; i < 34; i ++) {
PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][i]);
}
SelectTextDraw(playerid, -1);
TogglePlayerControllable(playerid, 0);
}
SendServerMessage(playerid, "Vocк confirmou a posiзгo do seu уculo.");
}
case 2:
{
PlayerData[playerid][pEditType] = 0;
PlayerData[playerid][pHat] = modelid;
if (!PlayerData[playerid][pCreated])
{
for (new i = 23; i < 34; i ++) {
PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][i]);
}
SelectTextDraw(playerid, -1);
TogglePlayerControllable(playerid, 0);
}
SendServerMessage(playerid, "Vocк confirmou a posiзгo do seu chapйu.");
}
case 3:
{
PlayerData[playerid][pEditType] = 0;
PlayerData[playerid][pBandana] = modelid;
if (!PlayerData[playerid][pCreated])
{
for (new i = 23; i < 34; i ++) {
PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][i]);
}
SelectTextDraw(playerid, -1);
TogglePlayerControllable(playerid, 0);
}
SendServerMessage(playerid, "Vocк confirmou a posiзгo da sua bandana.");
}
}
}
}
else
{
if (!PlayerData[playerid][pCreated])
{
for (new i = 23; i < 34; i ++) {
PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][i]);
}
SelectTextDraw(playerid, -1);
TogglePlayerControllable(playerid, 0);
RemovePlayerAttachedObject(playerid, PlayerData[playerid][pEditType] - 1);
}
}
return 1;
}
Re: Nгo estб salvando as posiзхes -
arakuta - 30.12.2015
Vocк precisa sincronizar a nova posiзгo com os outros jogadores, isto nгo й feito de forma automбtica. Basta usar a funзгo
SetPlayerAttachedObject novamente com as novas coordenadas.
Re: Nгo estб salvando as posiзхes -
druiida159 - 30.12.2015
Como assim @arakuta, eu nгo entendi. Novas cordenadas no caso eu teria que colocar as cordenadas da onde o objeto vai ser colocado?
Re: Nгo estб salvando as posiзхes -
arakuta - 30.12.2015
A novas sгo coordenadas sгo passadas pela callback
OnPlayerEditAttachedObject. Basta ligar os pontos.