SA-MP Forums Archive
Material of pickup - 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: Material of pickup (/showthread.php?tid=565997)



Material of pickup - cnoopers - 02.03.2015

Is there any way to change material of pickup?


Re : Material of pickup - Golimad - 02.03.2015

Mind telling us more details please ?
If you mean SetObjectMaterial, then the answer is no.
Solution : create a small object that has same model as the pickup, set its material. the object should be an arraylist so you can loop through it if you have many pickups. I have made a little helpful stock :
Код:
 
stock IsPlayerInRangeOfObject(playerid, objectid, Float:distance=2.0)
{
	new Float:oX, Float:oY, Float:oZ;
	GetObjectPos(objectid, oX, oY, oZ);
	if(IsPlayerInRangeOfPoint(playerid, distance,oX,oY,oZ)) return true;
	return false;
}
and if it returns true, then execute what you need ( tp to a zone, give gun, cash ...)

Edit : if you are going to have many pickups you need to have em like :
PickUp[MAX_PICKUPS]; PickUp[0] , PickUp[1] ...
And for(new i=0;i<MAX_PICKUPS;i++) IsPlayerInRangeOfObject(playerid, PickUp[i], Float:distance=2.0)
I hope that was clear