Object won't attach to player -
Makaveli93 - 23.06.2012
Well, I'm trying to fix my /holster command, but seems like I can't find what's wrong with the code. It seems perfectly fine to me. The message shows correctly (auto /me msg), but the object is not attached.
pawn Код:
if(!strcmp("/holster", cmdtext, true, 10))
{
if(IsPlayerConnected(playerid))
{
new weaponid = GetPlayerWeapon(playerid);
new wname[16];
GetWeaponName(weaponid, wname, 16);
if((IsPlayerAttachedObjectSlotUsed(playerid, 1) && PlayerInfo[playerid][pDonator] == 0) || (IsPlayerAttachedObjectSlotUsed(playerid, 1) && PlayerInfo[playerid][pDonator] > 0 && 8 != weaponid) || (IsPlayerAttachedObjectSlotUsed(playerid, 1) && IsPlayerAttachedObjectSlotUsed(playerid, 2) && PlayerInfo[playerid][pDonator] > 0))
{
RemovePlayerAttachedObject(playerid, 1);
if(IsPlayerAttachedObjectSlotUsed(playerid, 2))
{
RemovePlayerAttachedObject(playerid, 2);
}
return 1;
}
if(IsPlayerAttachedObjectSlotUsed(playerid, 1) && weaponid == 8 && PlayerInfo[playerid][pDonator] > 0)
{
SetPlayerAttachedObject(playerid, 2, 339, 1, 1049582633, 3182973285, 1041193958, 1127153664, 3263430656, 1088421888, 1065353216, 1065353216, 1065353216);
return 1;
}
if(weaponid == 8 || weaponid == 25 || weaponid == 27 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 33 || weaponid == 34)
{
if(weaponid == 8) {SetPlayerAttachedObject(playerid, 1, 339, 1, 1049918144, 3190690939, 3190690939, 3242196992, 3263823872, 3225419776, 1065353216, 1065353216, 1065353216);}
if(weaponid == 25) {SetPlayerAttachedObject(playerid, 1, 349, 1, 1045220557, 3187671040, 3184315597, 0, 1103626240, 1127481344, 1065353216, 1065353216, 1065353216);}
if(weaponid == 27) {SetPlayerAttachedObject(playerid, 1, 351, 1, 1045220557, 3187671040, 3184315597, 0, 1103626240, 1127481344, 1065353216, 1065353216, 1065353216);}
if(weaponid == 29) {SetPlayerAttachedObject(playerid, 1, 353, 1, 1045220557, 3187671040, 3184315597, 0, 1103626240, 1127481344, 1065353216, 1065353216, 1065353216);}
if(weaponid == 30) {SetPlayerAttachedObject(playerid, 1, 355, 1, 1045220557, 3187671040, 3184315597, 0, 1103626240, 1127481344, 1065353216, 1065353216, 1065353216);}
if(weaponid == 31) {SetPlayerAttachedObject(playerid, 1, 356, 1, 1045220557, 3187671040, 3184315597, 0, 1103626240, 1127481344, 1065353216, 1065353216, 1065353216);}
if(weaponid == 33) {SetPlayerAttachedObject(playerid, 1, 357, 1, 1045220557, 3187671040, 3184315597, 0, 1103626240, 1127481344, 1065353216, 1065353216, 1065353216);}
if(weaponid == 34) {SetPlayerAttachedObject(playerid, 1, 358, 1, 1045220557, 3187671040, 3184315597, 0, 1103626240, 1127481344, 1065353216, 1065353216, 1065353216);}
if(PlayerInfo[playerid][pSex] == 1)
{
format(string, 256, "holsters his %s.", wname);
PlayerActionMessage(playerid, 20.0, string);
}
else
{
format(string, 256, "holsters her %s.", wname);
PlayerActionMessage(playerid, 20.0, string);
}
return 1
}
else
{
SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] You're not holding a valid weapon in your hands.");
return 1;
}
}
return 1;
}
EDIT: Also it won't show even if I use object edtior (Brian's attachments editor).
Re: Object won't attach to player -
nilanjay - 23.06.2012
pawn Код:
if(!strcmp("/holster", cmdtext, true, 10))
{
if(IsPlayerConnected(playerid))
{
new weaponid = GetPlayerWeapon(playerid);
new wname[16];
GetWeaponName(weaponid, wname, 16);
if((IsPlayerAttachedObjectSlotUsed(playerid, 1) && PlayerInfo[playerid][pDonator] == 0) || (IsPlayerAttachedObjectSlotUsed(playerid, 1) && PlayerInfo[playerid][pDonator] > 0 && 8 != weaponid) || (IsPlayerAttachedObjectSlotUsed(playerid, 1) && IsPlayerAttachedObjectSlotUsed(playerid, 2) && PlayerInfo[playerid][pDonator] > 0))
{
RemovePlayerAttachedObject(playerid, 1);
if(IsPlayerAttachedObjectSlotUsed(playerid, 2))
{
RemovePlayerAttachedObject(playerid, 2);
}
return 1;
}
if(IsPlayerAttachedObjectSlotUsed(playerid, 1) && weaponid == 8 && PlayerInfo[playerid][pDonator] > 0)
{
SetPlayerAttachedObject(playerid, 2, 339, 1, 1049582633, 3182973285, 1041193958, 1127153664, 3263430656, 1088421888, 1065353216, 1065353216, 1065353216);
return 1;
}
if(weaponid == 8 || weaponid == 25 || weaponid == 27 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 33 || weaponid == 34)
{
if(weaponid == 8) {SetPlayerAttachedObject(playerid, 1, 339, 1, 1049918144, 3190690939, 3190690939, 3242196992, 3263823872, 3225419776, 1065353216, 1065353216, 1065353216);}
if(weaponid == 25) {SetPlayerAttachedObject(playerid, 1, 349, 1, 1045220557, 3187671040, 3184315597, 0, 1103626240, 1127481344, 1065353216, 1065353216, 1065353216);}
if(weaponid == 27) {SetPlayerAttachedObject(playerid, 1, 351, 1, 1045220557, 3187671040, 3184315597, 0, 1103626240, 1127481344, 1065353216, 1065353216, 1065353216);}
if(weaponid == 29) {SetPlayerAttachedObject(playerid, 1, 353, 1, 1045220557, 3187671040, 3184315597, 0, 1103626240, 1127481344, 1065353216, 1065353216, 1065353216);}
if(weaponid == 30) {SetPlayerAttachedObject(playerid, 1, 355, 1, 1045220557, 3187671040, 3184315597, 0, 1103626240, 1127481344, 1065353216, 1065353216, 1065353216);}
if(weaponid == 31) {SetPlayerAttachedObject(playerid, 1, 356, 1, 1045220557, 3187671040, 3184315597, 0, 1103626240, 1127481344, 1065353216, 1065353216, 1065353216);}
if(weaponid == 33) {SetPlayerAttachedObject(playerid, 1, 357, 1, 1045220557, 3187671040, 3184315597, 0, 1103626240, 1127481344, 1065353216, 1065353216, 1065353216);}
if(weaponid == 34) {SetPlayerAttachedObject(playerid, 1, 358, 1, 1045220557, 3187671040, 3184315597, 0, 1103626240, 1127481344, 1065353216, 1065353216, 1065353216);}
if(PlayerInfo[playerid][pSex] == 1)
{
format(string, 256, "holsters his %s.", wname);
PlayerActionMessage(playerid, 20.0, string);
}
else
{
format(string, 256, "holsters her %s.", wname);
PlayerActionMessage(playerid, 20.0, string);
}
return 1// I don't think so you need this return 1. I guess delete it and than try.
}
else
{
SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] You're not holding a valid weapon in your hands.");
return 1;
}
}
return 1;
}
Re: Object won't attach to player -
Makaveli93 - 23.06.2012
Nope, still doesn't works. I really can't find what the problem is. Cuffs attach to player normally, but /holster doesn't works nor any object editor I found here :/, object just don't show up.
Re: Object won't attach to player -
Jonny5 - 23.06.2012
well this looks wrong to me
pawn Код:
if(!strcmp("/holster", cmdtext, true, 10))
/holster = 8 chars not 10
not that im sure that will solve ya problem,
my other question is do you already have allot of objects on the server?
Re: Object won't attach to player -
Makaveli93 - 23.06.2012
Around 900. Most of those are in different virtual worlds/interiors. I used Incognito's Streamer. If the cuffs object shows up, this should show as well :/
EDIT: I tried it on the old gamemode on which it was working. Still no object showing up :/. I don't run any filterscripts and only plugins are crashdetect, streamer and sscanf
Re: Object won't attach to player -
Jonny5 - 23.06.2012
have you tried to just attach a player object in a simple command to see if that works?
skip all checks and just try
pawn Код:
SetPlayerAttachedObject(playerid, 2, 339, 1, 1049582633, 3182973285, 1041193958, 1127153664, 3263430656, 1088421888, 1065353216, 1065353216, 1065353216);
in a small command
if it works then debug your hole command with
print statements to see where it stops.
Re: Object won't attach to player -
Makaveli93 - 23.06.2012
Well I made a test command and still nothing happened.
pawn Код:
if(!strcmp("/testcmd", cmdtext, true, 10))
{
SetPlayerAttachedObject(playerid, 1, 339, 1, 1049582633, 3182973285, 1041193958, 1127153664, 3263430656, 1088421888, 1065353216, 1065353216, 1065353216);
}
Re: Object won't attach to player -
SuperViper - 23.06.2012
The object isn't attaching because your offsets are so large. Did you forget to add decimals in your offsets?
Re: Object won't attach to player -
Makaveli93 - 23.06.2012
Whoa, thank you very much. Gonna get new co-ordinates then. Rep+'d all of you that replied