SA-MP Forums Archive
[Help] Floats - 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)
+--- Thread: [Help] Floats (/showthread.php?tid=322113)



[Help] Floats - Tika Spic - 29.02.2012

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!


Re: [Help] Floats - FuTuяe - 29.02.2012

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;
}



Re: [Help] Floats - TheArcher - 29.02.2012

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.


Re: [Help] Floats - Tika Spic - 29.02.2012

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?


Re: [Help] Floats - TheArcher - 01.03.2012

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.


Re: [Help] Floats - Ballu Miaa - 01.03.2012

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!