CAN YOU DO THIS? - 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: CAN YOU DO THIS? (
/showthread.php?tid=84054)
CAN YOU DO THIS? -
shady91 - 28.06.2009
would it be possible to make it so if near an object. like
i would make it do that on a cmd im just not to sure if its possible lol just thought of it if it was then id be loveing it lol as you can make it so if you get in a veh id like 596 it class as cop cars etc so was wondering if can be done to objects can it be done?
Re: is this possible? Swift_ read this i no you do quick response reply ol ;) -
dice7 - 28.06.2009
Use GetObjectPos and PlayerToPoint or something
Re: is this possible? Swift_ read this i no you do quick response reply ol ;) -
shady91 - 28.06.2009
yeah i already no how to do that but say i wanted to make it so for like 50 objects so if i could do it to an objects id would save all them lines etc....
Re: CAN YOU DO THIS? -
Moustafa - 30.06.2009
XD try something foolish, add on each object the new line for them:
pawn Код:
object = CreateObject(xxxxxxxxxxxxxx);
object = CreateObject(xxxxxxxxxxxxxx);
object = CreateObject(xxxxxxxxxxxxxx);
object = CreateObject(xxxxxxxxxxxxxx);
object = CreateObject(xxxxxxxxxxxxxx);
object = CreateObject(xxxxxxxxxxxxxx);
object = CreateObject(xxxxxxxxxxxxxx);
ETC.................
LoL... may work? XD!
Re: CAN YOU DO THIS? -
NeRoSiS - 30.06.2009
Quote:
Originally Posted by Moustafa
XD try something foolish, add on each object the new line for them:
pawn Код:
object = CreateObject(xxxxxxxxxxxxxx); object = CreateObject(xxxxxxxxxxxxxx); object = CreateObject(xxxxxxxxxxxxxx); object = CreateObject(xxxxxxxxxxxxxx); object = CreateObject(xxxxxxxxxxxxxx); object = CreateObject(xxxxxxxxxxxxxx); object = CreateObject(xxxxxxxxxxxxxx); ETC.................
LoL... may work? XD!
|
No it will fail as all your doing is overwriting the objects variable....
You could do object1, object 2 though, may take a while :P
I'm sure though you could GetObjectPos(0,x ,y ,z); and then repeat it for up to the amount of objects you have then do the check.
Re: CAN YOU DO THIS? -
kaisersouse - 30.06.2009
top:
ongamemodeinit:
Код:
new i = 0;
object[i] = CreateObject(etc);
object[i++] = CreateObject(etc);
etc so forth
Checking:
Код:
new Float:objectX, Float:objectY, Float:objectX;
new Float: playerX, playerY, playerZ;
GetPlayerPos(playerid, playerX, playerY, PlayerZ);
for(new i = 0; i < sizeof(object); i++)
{
GetObjectPos(object[i], objectX, objectY, objectZ);
//now use your IsPlayerInProx or whatever code to see if playerX is within a certain distance of objectX. Same with objectY. IGNORE object and player Z value
}
Re: CAN YOU DO THIS? -
shady91 - 03.08.2009
Quote:
Originally Posted by kaisersouse
top:
ongamemodeinit:
Код:
new i = 0;
object[i] = CreateObject(etc);
object[i++] = CreateObject(etc);
etc so forth
Checking:
Код:
new Float:objectX, Float:objectY, Float:objectX;
new Float: playerX, playerY, playerZ;
GetPlayerPos(playerid, playerX, playerY, PlayerZ);
for(new i = 0; i < sizeof(object); i++)
{
GetObjectPos(object[i], objectX, objectY, objectZ);
//now use your IsPlayerInProx or whatever code to see if playerX is within a certain distance of objectX. Same with objectY. IGNORE object and player Z value
}
|
Thank You!
Re: CAN YOU DO THIS? -
shady91 - 07.08.2009
i got it like this ive never done this before so this is just random trying and i tryed your way but i get errors
pawn Код:
public ATM(playerid)
{
new Float:objectx, Float:objecty, Float:objectz;
//new Float: playerx, playery, playerz;
new Float:X, Float:Y, Float:Z;
GetPlayerPos( playerid, X, Y, Z);
for(new i = 0; i < sizeof(object); i++)
{
if(PlayerToPoint(4, playerid, objectx, objecty, objectz))
{
GetObjectPos(object[i], objectx, objecty, objectz);
ShowMenuForPlayer(Bank, playerid);
TogglePlayerControllable(playerid,0);
}
}
return 1;
}
only thing is is that when i got to an object nothing happens
Re: CAN YOU DO THIS? -
shady91 - 08.08.2009
BUMP

is kaisersouse the only person who noes how to do this

??
EDIT:Thank you i done it