23.06.2012, 14:29
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.
EDIT: Also it won't show even if I use object edtior (Brian's attachments editor).
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;
}