Object not removing
#1

Код:
CMD:meatbag(playerid, params[])
{
	new option[15];
	new string[60];
	new meatbag;
	
	static
 	Float:x,
  	Float:y,
   	Float:z;
    if(sscanf(params, "s[10]", option)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /(m)eat(b)ag [drop | pickup]");

	if(!strcmp(option, "drop", true))
	{
		if(cargopicked[playerid] == 1)
		{
		    /*static
		    Float:x,
		    Float:y,
		    Float:z;*/

			GetPlayerPos(playerid, x, y, z);
			meatbag = CreateObject(2060,x+3,y,z, 0.0000, 0.0000, 0.0000);

			format(string, sizeof(string), "* %s drops the meat bag on the ground.", ReturnName(playerid, 0));
			SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 30.0, 10000);
			SendClientMessageEx(playerid, COLOR_PURPLE, "* %s drops the meat bag on the ground.", ReturnName(playerid, 0));
			cargopicked[playerid] = 0;
			ClearAnimations(playerid, 1);
			SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
			RemovePlayerAttachedObject(playerid, 0);
		}
		else
		{
		    SCM(playerid, COLOR_GREY, "You are not holding anything.");
		}
	}
	if(!strcmp(option, "pickup", true))
	{
		if(IsPlayerInRangeOfPoint(playerid, 3, x+3, y, z))
		{
		    SetPlayerAttachedObject(playerid, 0, 2060, 1, 0.0000, 0.3240, 0.0000, 0.0000, 82.3000, 0.0000, 0.6690, 0.6809, 0.7240, 0xFFFFFFFF, 0xFFFFFFFF);
            SetPlayerSpecialAction(playerid,SPECIAL_ACTION_CARRY);
            cargopicked[playerid] = 1;
            format(string, sizeof(string), "* %s picks the meat bag from the ground.", ReturnName(playerid, 0));
			SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 30.0, 10000);
			SendClientMessageEx(playerid, COLOR_PURPLE, "* %s picks the meat bag from the ground.", ReturnName(playerid, 0));
			DestroyObject(meatbag);
		}
		else return SCM(playerid, COLOR_GREY, "You are not near any meat bags.");
	}
	return 1;
}

CMD:mb(playerid, parmas[]) return cmd_meatbag(playerid, parmas);

The object is not dissapearing from the ground when I type /mb pickup
Reply
#2

Anyone please? I really need it done.. I don't have ANY idea why it is not working
Reply
#3

PHP код:
//TOP OF SCRIPT
new meatbag[MAX_PLAYERS];
//====================
CMD:meatbag(playeridparams[])
{
    new 
option[15];
    new 
string[60];
    
    static
     
Float:x,
      
Float:y,
       
Float:z;
    if(
sscanf(params"s[10]"option)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /(m)eat(b)ag [drop | pickup]");
    if(!
strcmp(option"drop"true))
    {
        if(
cargopicked[playerid] == 1)
        {
            
/*static
            Float:x,
            Float:y,
            Float:z;*/
            
GetPlayerPos(playeridxyz);
            
meatbag[playerid] = CreateObject(2060,x+3,y,z0.00000.00000.0000);
            
format(stringsizeof(string), "* %s drops the meat bag on the ground."ReturnName(playerid0));
            
SetPlayerChatBubble(playeridstringCOLOR_PURPLE30.010000);
            
SendClientMessageEx(playeridCOLOR_PURPLE"* %s drops the meat bag on the ground."ReturnName(playerid0));
            
cargopicked[playerid] = 0;
            
ClearAnimations(playerid1);
            
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
            
RemovePlayerAttachedObject(playerid0);
        }
        else
        {
            
SCM(playeridCOLOR_GREY"You are not holding anything.");
        }
    }
    if(!
strcmp(option"pickup"true))
    {
        if(
IsPlayerInRangeOfPoint(playerid3x+3yz))
        {
            
SetPlayerAttachedObject(playerid0206010.00000.32400.00000.000082.30000.00000.66900.68090.72400xFFFFFFFF0xFFFFFFFF);
            
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_CARRY);
            
cargopicked[playerid] = 1;
            
format(stringsizeof(string), "* %s picks the meat bag from the ground."ReturnName(playerid0));
            
SetPlayerChatBubble(playeridstringCOLOR_PURPLE30.010000);
            
SendClientMessageEx(playeridCOLOR_PURPLE"* %s picks the meat bag from the ground."ReturnName(playerid0));
            
DestroyObject(meatbag[playerid]);
        }
        else return 
SCM(playeridCOLOR_GREY"You are not near any meat bags.");
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)