SA-MP Forums Archive
Help with objects - 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: Help with objects (/showthread.php?tid=342739)



Help with objects - Finn707 - 14.05.2012

Hi, how can I add a command into my server that will create a specific object in a specific location, and then I need a command that can destroy that same object. I can use CreateObject but I'm just not sure on the command part and DestryObject because I dont know how to get the "ObjectId". Also the player must be close to a point.
Please help


Re: Help with objects - Jonny5 - 14.05.2012

what command processor you using?


Re: Help with objects - Finn707 - 15.05.2012

I am using the "if(strcmp(cmd" thing. I was thinking of adding "IsPlayerInRangeOfPoint" so that the player must be near a certain place to type the command.


Re: Help with objects - Finn707 - 16.05.2012

Anynody?, I really need help with this.


Re: Help with objects - Jonny5 - 16.05.2012

sounds like your on the correct path!
Just use the wiki if you run into problems once you have some code written then post your code so we can
show you where you went wrong,

youll find you may not even need help beyond the wiki.


Re: Help with objects - Jaxson - 16.05.2012

The object id is returned when creating the object itself:

Код:
new objectid = CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0);
To destroy the previously created object:

Код:
DestroyObject(objectid);



Re: Help with objects - Finn707 - 16.05.2012

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
sounds like your on the correct path!
Just use the wiki if you run into problems once you have some code written then post your code so we can
show you where you went wrong,

youll find you may not even need help beyond the wiki.
Yeah, thanks

Quote:
Originally Posted by Jaxson
Посмотреть сообщение
The object id is returned when creating the object itself:

Код:
new objectid = CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0);
To destroy the previously created object:

Код:
DestroyObject(objectid);
Oh I see, I will script it now and post the script if it goes wrong.


Re: Help with objects - Finn707 - 17.05.2012

When I added this code: (BTW if you want to know which line is which tho top line that says "CMD: smokeon(playerid, params[])" is line number "5668".
Код:
CMD:smokeon(playerid, params[])
{
  new objectid = CreateObject(2780,487.70001221,-2.40000010,999.70001221,0.00000000,0.00000000,0.00000000); //object(cj_smoke_mach) (3)
  SendClientMessage(playerid, COLOR_RED, "Smoke turned on");
  return 1;
}
CMD:smokeoff(playerid, params[])
{
  DestroyObject(objectid);
  SendClientMessage(playerid, COLOR_RED, "Smoke turned off");
  return 1;
}
I got this:

Код:
(5670) : warning 204: symbol is assigned a value that is never used: "objectid"
(5676) : error 017: undefined symbol "objectid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
How can I fix this?
PLEASE Help I will +rep anyone that can help me