Drops on OnPlayerDeath problem
#1

Hi i have this on OnPlayerDeath, and i want that when a player dies he will drop the crack if he got more than 10 grams in his inventory, but when i die the object drops, but when i try to pick it up it says there's just 0 grams.

Код:
	if(PlayerInfo[playerid][pCrack] > 10)
	{
	    PlayerInfo[playerid][pCrack] = 10;
		for(new i = 0; i < sizeof(DropInfo); i++)
  	    {
  	        if(DropInfo[i][dx] == 0.0 && DropInfo[i][dy] == 0.0 && DropInfo[i][dz] == 0.0)
  	        {
  	            new Float:X,Float:Y,Float:Z;
  	            new rpos[2];
		    	GetPlayerPos(playerid, X, Y, Z);
  	            DropInfo[i][dType] = 2;
  	            DropInfo[i][dAmount][0] = PlayerInfo[playerid][pCrack] > 10;
  	            DropInfo[i][dx] = X;
  	            DropInfo[i][dy] = Y;
  	            DropInfo[i][dz] = Z;
  	            rpos[0] = random(4), rpos[1] = random(4);
  	            DropInfo[i][dWorld] = GetPlayerVirtualWorld(playerid);
  	            DropObject[i] = CreateObject(1575,  X + rpos[0], Y + rpos[1], Z, GetPlayerVirtualWorld(playerid));
  	        }
  	    }
  	}
Reply
#2

Can anyone help me please?
Reply
#3

DropInfo[i][dAmount][0] = PlayerInfo[playerid][pCrack];
Reply
#4

It dont have to drop all the crack, only the crack he have over 10 grams, so if he got 30 grams on him he will drop 20 grams.
Reply
#5

Can anyone help me please?
Reply
#6

Quote:
Originally Posted by Mikkel_RE
Посмотреть сообщение
Can anyone help me please?
Give me the cmd u have for pick up the crack.
Reply
#7

Quote:
Originally Posted by N0FeaR
Посмотреть сообщение
Give me the cmd u have for pick up the crack.
This on OnPlayerCommandText
Код:
    if(strcmp(cmdtext, "/grab", true)==0)
	{
	    new name[MAX_PLAYER_NAME];
	    if(MedicBill[playerid] == 1)
        {
            SendClientMessage(playerid, COLOR_GREY, " You have no access to grab items at your health.");
            return 1;
        }
    	for(new i = 0; i < sizeof(DropInfo); i++)
    	{
   			if (PlayerToPoint(1.0,playerid,DropInfo[i][dx],DropInfo[i][dy],DropInfo[i][dz]))
    		{
				if(GetPlayerVirtualWorld(playerid) == DropInfo[i][dWorld])
				{
    		    	if(DropInfo[i][dType] == 2) // Crack
    		    	{
                        ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
                        SetTimerEx("crackpick", 3000, 0, "i", playerid);
			            format(string, sizeof(string), "You kneel down to pick up some crack.");
    			        SendClientMessage(playerid, COLOR_GREY, string);
    		    	}
    		    	return 1;
    		    }
    		}
    	}
    	return 1;
    }
Код:
forward crackpick(playerid);
public crackpick(playerid)
{
    for(new i = 0; i < sizeof(DropInfo); i++)
    {
   	    if (PlayerToPoint(1.0,playerid,DropInfo[i][dx],DropInfo[i][dy],DropInfo[i][dz]))
    	{
			if(GetPlayerVirtualWorld(playerid) == DropInfo[i][dWorld])
			{
                DestroyObject(DropObject[i]);
                DropInfo[i][dx] = 0.0;
    		    DropInfo[i][dy] = 0.0;
    		    DropInfo[i][dz] = 0.0;
    		    if(DropInfo[i][dType] == 2) // Crack
    		    {
                    new string[256];
			        format(string,sizeof(string),"* %s picks up %d grams of crack.",Name(playerid),DropInfo[i][dAmount]);
			        ProxDetector(30.0,playerid,string,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
	                PlayerInfo[playerid][pCrack] += DropInfo[i][dAmount][0];
	                DropInfo[i][dAmount][0] = 0;
	                DropInfo[i][dAmount][1] = 0;
	                DropInfo[i][dType] = 0;
	            }
	        }
	    }
    }
}
This on OnGameModeInit
Код:
	for(new i = 0; i < sizeof(DropInfo); i++)
  	{
  	    if(DropInfo[i][dx] != 0.0 && DropInfo[i][dy] != 0.0 && DropInfo[i][dz] != 0.0)
  	    {
  	        if(DropInfo[i][dType] == 1)
  	        {
                if (DropInfo[i][dAmount][0] > 1 || DropInfo[i][dAmount][0] < 35)
                {
  	                DropObject[i] = CreateObject(gh_GetObjectID(DropInfo[i][dAmount][0]), DropInfo[i][dx], DropInfo[i][dy], DropInfo[i][dz]-1,93.7,120.0,120.0, DropInfo[i][dWorld]);
  	            }
  	        }
  	        else if(DropInfo[i][dType] == 2) // Crack
  	        {
  	            DropObject[i] = CreateObject(1575, DropInfo[i][dx], DropInfo[i][dy], DropInfo[i][dz]-1, 0, 0, 0, 200.0, DropInfo[i][dWorld]);
  	        }
  	        else if(DropInfo[i][dType] == 3) // Pot 
  	        {
  	            DropObject[i] = CreateObject(1578, DropInfo[i][dx], DropInfo[i][dy], DropInfo[i][dz]-1, 0, 0, 0, 200.0, DropInfo[i][dWorld]);
  	        }
  	        else if(DropInfo[i][dType] == 4) // Mats A
  	        {
  	            DropObject[i] = CreateObject(2040, DropInfo[i][dx], DropInfo[i][dy], DropInfo[i][dz]-1, 0, 0, 0, 200.0, DropInfo[i][dWorld]);
  	        }
  	        else if(DropInfo[i][dType] == 5) // Mats B
  	        {
  	            DropObject[i] = CreateObject(2040, DropInfo[i][dx], DropInfo[i][dy], DropInfo[i][dz]-1, 0, 0, 0, 200.0, DropInfo[i][dWorld]);
  	        }
  	        else if(DropInfo[i][dType] == 6) // Mats C
  	        {
  	            DropObject[i] = CreateObject(2040, DropInfo[i][dx], DropInfo[i][dy], DropInfo[i][dz]-1, 0, 0, 0, 200.0, DropInfo[i][dWorld]);
  	        }
  	        else if(DropInfo[i][dType] == 7) // Money
  	        {
  	            DropObject[i] = CreateObject(1212, DropInfo[i][dx], DropInfo[i][dy], DropInfo[i][dz]-1, 0, 0, 0, 200.0, DropInfo[i][dWorld]);
  	        }
  	    }
	}
Reply
#8

What massage u get when u trying to picku the carck?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)