Is Near A Object - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Is Near A Object (
/showthread.php?tid=253317)
Is Near A Object -
Tommy_Mandaz - 05.05.2011
Okay so what I want to do is create a command where the player is able to create a object in game... And then remove it if near by, there is one problem though... How can I get that particler object id? Would I do this?
pawn Код:
CMD:exampleobjectcreate(playerid, params[])
{
new Float:x, Float:y, Float:z, objectdropped[MAX_PLAYERS];
GetPlayerPos(playerid, x, y, z);
objectdropped[playerid] = CreateDynamicObject(1508, 369.2036, 162.4440, 1019.9944, 0.0000, 0.0000, 180.0000);
return 1;
}
pawn Код:
CMD:exampleobjectdelete(playerid, params[])
{
new Float:x, Float:y, Float:z;
GetDynamicObjectPos(objectdropped[playerid], x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z)
{
DestroyDynamicObject(objectdropped[playerid]);
}
else
{
SendClientMessage(playerid, COLOR_RED, "Test No");
}
return 1;
}
So would that work if the person is creating multiple objects? So say he creates 5 of those, will it remove them all?
Re: Is Near A Object -
Tommy_Mandaz - 06.05.2011
Can someone tell me if I coded it correct?
Re: Is Near A Object -
Tommy_Mandaz - 07.05.2011
Bump?
Re: Is Near A Object -
Tommy_Mandaz - 07.05.2011
Anyone?
Re: Is Near A Object -
MadeMan - 07.05.2011
That will remove only the last object.
objectdropped must be global
pawn Код:
new objectdropped[MAX_PLAYERS];
pawn Код:
CMD:exampleobjectcreate(playerid, params[])
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
objectdropped[playerid] = CreateDynamicObject(1508, 369.2036, 162.4440, 1019.9944, 0.0000, 0.0000, 180.0000);
return 1;
}
Re: Is Near A Object -
Tommy_Mandaz - 07.05.2011
Okay this way the person can drop multiple objects and then destroy each one?
Re: Is Near A Object -
Jean_Pierre - 07.05.2011
pawn Код:
SetPlayerSkin(Playerid,skinid);
Re: Is Near A Object -
Tommy_Mandaz - 07.05.2011
What is that?