SA-MP Forums Archive
Please help me with this code - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Please help me with this code (/showthread.php?tid=407183)



Please help me with this code - Mikkel_RE - 12.01.2013

Hi, i will make that when a player dies, if he got more than 10 grams in the inventory he will drop it on the ground,
Also if he got 30 grams on him, he will drop 20 grams when he die, can you please help me with the code?

I got this on OnPlayerDeath

Код:
	if(PlayerInfo[playerid][pPot] > 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;
		    	    	        GetPlayerPos(playerid, X, Y, Z);
  	                            DropInfo[i][dType] = 3;
  	                            DropInfo[i][dAmount][0] = amount;
  	                            DropInfo[i][dx] = X;
  	                            DropInfo[i][dy] = Y;
  	                            DropInfo[i][dz] = Z;
  	                            DropInfo[i][dWorld] = GetPlayerVirtualWorld(playerid);
  	                            strcpy(DropInfo[i][dPlayerName],tmp,MAX_PLAYER_NAME);
  	                            DropObject[i] = CreateObject(1578, X, Y, Z-1, 0, 0, 0, 200.0, GetPlayerVirtualWorld(playerid));
	}



Respuesta: Please help me with this code - Fabio11 - 12.01.2013

Create a PickUp to drop things on the ground.


Re: Please help me with this code - Infinity90 - 12.01.2013

pawn Код:
if(PlayerInfo[playerid][pPot] > 10) { PlayerInfo[playerid][pPot] -= 10; }
else if(PlayerInfo[playerid][pPot] > 20) { PlayerInfo[playerid][pPot] -= 20; }
else if(PlayerInfo[playerid][pPot] > 30) { PlayerInfo[playerid][pPot] -= 30; }



Re: Please help me with this code - Mikkel_RE - 12.01.2013

I mean more like this

Код:
	if(PlayerInfo[playerid][pPot] > 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;
		    	    	        GetPlayerPos(playerid, X, Y, Z);
  	                            DropInfo[i][dType] = 3;
  	                            DropInfo[i][dAmount][0] = amount;
  	                            DropInfo[i][dx] = X;
  	                            DropInfo[i][dy] = Y;
  	                            DropInfo[i][dz] = Z;
  	                            DropInfo[i][dWorld] = GetPlayerVirtualWorld(playerid);
  	                            strcpy(DropInfo[i][dPlayerName],tmp,MAX_PLAYER_NAME);
  	                            DropObject[i] = CreateObject(1578, X, Y, Z-1, 0, 0, 0, 200.0, GetPlayerVirtualWorld(playerid));
	}



Re: Please help me with this code - Mikkel_RE - 13.01.2013

Anyone?