[Help] Floats
#1

Ok so I made a Filterscript witch allows me to create/remove objects ingame, so it's like an 'INGAME MAP EDITOR' but the problem is, when i try to make a command to move the objects nothing happens ... i made it like this (just an example):

Код:
if(strcmp(cmd, "/moveleft", true) == 0)
{
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
	MoveObject(Object[PlayerMovingObject[playerid]], x, y, z, 9999, 0.0, 0.0, 0.0);
	y = y+1;
	return 1;
}
and i made a command to asign

Код:
PlayerMovingObject
and

Код:
Object // when making objects
So it moves the object to my position.. but when i type the command in again it doesn't move, so i guess the problem is:

Код:
y = y+1;
Can anyone help me?

I tryed making a new Float (example: new Float:ObjectY) and defining ObjectY = y+1 but still nothing...

Please help!
Reply
#2

pawn Код:
if(strcmp(cmd, "/moveleft", true) == 0)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    MoveObject(Object[PlayerMovingObject[playerid]], x, y + 1, z, 9999, 0.0, 0.0, 0.0);
    y = y+1;
    return 1;
}
Reply
#3

Quote:
Originally Posted by FuTuяe
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/moveleft", true) == 0)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    MoveObject(Object[PlayerMovingObject[playerid]], x, y + 1, z, 9999, 0.0, 0.0, 0.0);
    y = y+1;
    return 1;
}
y = y+1 is not request.
Reply
#4

I think you didn't get the point i need to move the object more end more to one side without moving the character at all

for example i type /moveleft 10 times and it moves +10 on the Y float and what you gave me will just move it +1 away from me... Thanks anyway...

@TheArcher what do you mean?
Reply
#5

Quote:
Originally Posted by Tika Spic
Посмотреть сообщение
I think you didn't get the point i need to move the object more end more to one side without moving the character at all

for example i type /moveleft 10 times and it moves +10 on the Y float and what you gave me will just move it +1 away from me... Thanks anyway...

@TheArcher what do you mean?
what is y = y+1 used for? You already have the "y" axis on your moving function.
Reply
#6

Why dont you simply use this?

pawn Код:
if(strcmp(cmd, "/moveleft", true) == 0)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    MoveObject(Object[PlayerMovingObject[playerid]], x, y + 1, z, 9999, 0.0, 0.0, 0.0);
    return 1;
}
This will do the require task man. y=y+1; increment's y while it is already being incremented over here
pawn Код:
MoveObject(Object[PlayerMovingObject[playerid]], x, y + 1, z, 9999, 0.0, 0.0, 0.0); ".
Your CMD will move the object to y+1 only once. On Second stroke it will add 2 to y pos. So i recommend you to use this one!
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)