CAN YOU DO THIS?
#1

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?
Reply
#2

Use GetObjectPos and PlayerToPoint or something
Reply
#3

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....
Reply
#4

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!
Reply
#5

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.
Reply
#6

top:
Код:
new object[50];
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
}
Reply
#7

Quote:
Originally Posted by kaisersouse
top:
Код:
new object[50];
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!
Reply
#8

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
Reply
#9

BUMP is kaisersouse the only person who noes how to do this??

EDIT:Thank you i done it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)