SA-MP Forums Archive
OnPlayerDeath - 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: OnPlayerDeath (/showthread.php?tid=396867)



Delete, this one was wrong. - Mikkel_RE - 02.12.2012

Delete


Re: OnPlayerDeath - Lz - 02.12.2012

Quote:
Originally Posted by Mikkel_RE
Посмотреть сообщение
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));
  	        }
  	    }
  	}
CreatePickup(Model, Type, Float:X, Float:Y, Float:Z, 0)
Get the players death co-ords
Also do a new loop to check if the crack has been picked up, if yes then RemovePickup


Re: OnPlayerDeath - Mikkel_RE - 02.12.2012

Also the object drops fine, but there is nothing when i pick it up.


Re: OnPlayerDeath - Lz - 02.12.2012

Quote:
Originally Posted by Mikkel_RE
Посмотреть сообщение
Also the object drops fine, but there is nothing when i pick it up.
For your pCrack are you using a variable to store the info?


Re: OnPlayerDeath - Mikkel_RE - 02.12.2012

Yes i am


Re: OnPlayerDeath - Vince - 02.12.2012

pawn Код:
DropInfo[i][dAmount][0] = PlayerInfo[playerid][pCrack] > 10;
This doesn't make sense at all. This will just save true or false in the variable.


Re: OnPlayerDeath - Mikkel_RE - 02.12.2012

What should i do then?


Re: OnPlayerDeath - Nirzor - 02.12.2012

Check out sa-mp tutorias ****** it or make variables yourself and do it!