SA-MP Forums Archive
moving object on the same place i've spawned it... - 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: moving object on the same place i've spawned it... (/showthread.php?tid=107781)



moving object on the same place i've spawned it... - *BueNoOo* - 11.11.2009

Hello all, I have a little problem here. I was trying to make an object moving in the place I've spawned it.
For example I type my simple command and it spawns an object, then I want it to move automatically without typing any further commands.
Is there any good way to do it ...

Like I type /mycommand (it spawns an object and it starts moving automatically)


Re: moving object on the same place i've spawned it... - Peter_Corneile - 11.11.2009

pawn Код:
new object;

public OnGameModeInit()
{
object = CreateObject(model,X,Y,Z....);
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{

if(strcmp("/open",cmdtext,true ,5) == 0)
{
MoveObject(object,X,Y,Z,2); //new pos of the object
return 1;
}

if(strcmp("/close",cmdtext,true,6) == 0)
{
MoveObject(object,X,Y,Z,2); //Back to original pos
return 1;
}
return 0;
}



Re: moving object on the same place i've spawned it... - *BueNoOo* - 11.11.2009

Quote:
Originally Posted by ►Peter Corneile [ideal-host.co.uk
◄ ]
pawn Код:
new object;

public OnGameModeInit()
{
object = CreateObject(model,X,Y,Z....);
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{

if(strcmp("/open",cmdtext,true ,5) == 0)
{
MoveObject(object,X,Y,Z,2); //new pos of the object
return 1;
}

if(strcmp("/close",cmdtext,true,6) == 0)
{
MoveObject(object,X,Y,Z,2); //Back to original pos
return 1;
}
return 0;
}
Thanks but It's not what I meant. I want to type a command to spawn an object in any place on the map. Then it will start moving automatically.
Don't need any coords I guess...


Re: moving object on the same place i've spawned it... - Peter_Corneile - 11.11.2009

Use Ingame Object Editor for it

Edit : Ingame Obejct Editor by BreadFish


Re: moving object on the same place i've spawned it... - *BueNoOo* - 11.11.2009

Quote:
Originally Posted by ►Peter Corneile [ideal-host.co.uk
◄ ]
Use Ingame Object Editor for it

Edit : Ingame Obejct Editor by BreadFish
I don't get it...
I can't see any info about spawning an object (by anyone who types the command) and let it move automatically in any place on the map ( I mean without the coords given).


EDIT : In Game Object editor by BreadFish no longer works tho


Re: moving object on the same place i've spawned it... - Peter_Corneile - 11.11.2009

Quote:
Originally Posted by Damarcu$
Quote:
Originally Posted by ►Peter Corneile [ideal-host.co.uk
◄ ]
Use Ingame Object Editor for it

Edit : Ingame Obejct Editor by BreadFish
I don't get it...
I can't see any info about spawning an object and let it move automatically in any place on the map ( I mean without the coords given).


EDIT : In Game Object editor by BreadFish no longer works tho
Huh ? Do you want the object to go in any random direction ?


Re: moving object on the same place i've spawned it... - *BueNoOo* - 11.11.2009

Quote:
Originally Posted by ►Peter Corneile [ideal-host.co.uk
◄ ]
Huh ? Do you want the object to go in any random direction ?
I want it so when someone (anyone on the server) types a command it spawns an object next to him and it starts to move up automatically...
hope you understand me


Re: moving object on the same place i've spawned it... - Peter_Corneile - 11.11.2009

pawn Код:
new object[MAX_PLAYERS];

public OnPlayerCommandText(playerid,cmdtext[])
{
if(strcmp("/object",cmdtext,true,7) == 0)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
object[playerid] = CreateObject(objectid,X,Y,Z,0,0,0);
MoveObject(object[playerid],X,Y,Z+10,2.0);
return 1;
}
return 0;
}



Re: moving object on the same place i've spawned it... - *BueNoOo* - 11.11.2009

Quote:
Originally Posted by ►Peter Corneile [ideal-host.co.uk
◄ ]
pawn Код:
new object[MAX_PLAYERS];

public OnPlayerCommandText(playerid,cmdtext[])
{
if(strcmp("/object",cmdtext,true,7) == 0)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
object[playerid] = CreateObject(objectid,X,Y,Z,0,0,0);
MoveObject(object[playerid],X,Y,Z+10,2.0);
return 1;
}
return 0;
}
Thank you very much, I'll test it out in a minute


Re: moving object on the same place i've spawned it... - Peter_Corneile - 11.11.2009

Quote:
Originally Posted by Damarcu$
Quote:
Originally Posted by ►Peter Corneile [ideal-host.co.uk
◄ ]
pawn Код:
new object[MAX_PLAYERS];

public OnPlayerCommandText(playerid,cmdtext[])
{
if(strcmp("/object",cmdtext,true,7) == 0)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
object[playerid] = CreateObject(objectid,X,Y,Z,0,0,0);
MoveObject(object[playerid],X,Y,Z+10,2.0);
return 1;
}
return 0;
}
Thank you very much, I'll test it out in a minute
Alright , report back