Jump to content
  • 0

IsObjectInArea...(Rezolvat ;) :) Am folosit ObjectToPoint ...)


[RSS]RuNix

Question

salut  ;D...

ma puteti ajuta putin ... cei care stiti ...

deci:

am pus la OnGameModeInit

SetTimer("MingeAfara",100,1);
football=CreateObject(1598,1520.948,-1133.519,135.133,0.0,0.0,0.0);
am pus
forward MingeAfara();
public MingeAfara()
{
if(!IsObjectInArea(football,1562.119, 1501.274, -1109.439, -1156.812))
{
DestroyObject(football);
football=CreateObject(1598,1520.948,-1133.519,135.133,0.0,0.0,0.0);
}
return 1;
}
la sfarsitul scriptului si mai jos am creat functia IsObjectInArea...
stock IsObjectInArea(objectid, Float:minX, Float:maxX, Float:minY, Float:maxY)
{
	new Float:x,Float:y,Float:z;
	GetObjectPos(objectid, x,y,z);
	if (x > minX && x < maxX && y > minY && y < maxY) return true;
	return false;
}

... apoi am dat compile sperand ca daca acel object va depasi acea Area(Zona) il va pune inapoi

chestia asta am folosito la un mod de football ... dar uneori mingea iesea din teren si eu am vrut sa fac ca atunci cand iese din teren sa se puna inapoi la loc in mijloc ... dar o data ce am facut aceasta functie obiectul sta mereu in mijloc si nu il mai pot misca deloc... eu il misc iar el se pune repede inapoi chiar daca nu a depasit acea zona ...

imi puteti spune ce am gresit si sa ma corectati ?

Multumesc:)

tLYRl.gif
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Incearca

forward MingeAfara();
public MingeAfara()
{
if(!IsObjectInArea(football,1562.119, 1501.274, -1109.439, -1156.812))
{ }else{
DestroyObject(football);
football=CreateObject(1598,1520.948,-1133.519,135.133,0.0,0.0,0.0);
}
return 1;
}

Spuneau unii pe sa-mp.com ca nu le merge IsPlayerInArea cu negatie, iar unul a sugerat cu else.

Incearca si tu.

-Toate tutorialele postate intra aici sau puneti-le direct [url=http://www.sa-mp.ro/forum/index

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.