Help with Moving an object
#1

How to make an object moving when player is in point

Like
if(PlayerToPoint(playerid,1595.5406, 2198.0520, 10.3863,10))
Moveobject(abkop)

Pls help
Reply
#2

Look this
http://forum.sa-mp.com/showthread.ph...=moving+object
Reply
#3

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, range, x, y, z))
{
        MoveObject(playerid, x, y, z, speed);
        return 1;
}
Reply
#4

Quote:
Originally Posted by Mr.Jvxmc
Посмотреть сообщение
I know how to move but i want it when player is in range that it gets money of him and opens a gate
Reply
#5

Quote:
Originally Posted by Rafa
Посмотреть сообщение
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, range, x, y, z))
{
        MoveObject(playerid, x, y, z, speed);
        return 1;
}
Where to put that under?
Reply
#6

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp(cmdtext, "/open", true) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, range, x, y, z))
        {
            if(GetPlayerMoney(playerid) <= 1000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough money to open the gate");
            GivePlayerMoney(playerid, -1000);// will open for 1000$
            MoveObject(playerid, x, y, z, speed);
            return 1;
        }
        return 1;
    }
    return 0;
}
good luck
Reply
#7

Quote:
Originally Posted by Rafa
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp(cmdtext, "/open", true) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, range, x, y, z))
        {
            if(GetPlayerMoney(playerid) <= 1000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough money to open the gate");
            GivePlayerMoney(playerid, -1000);// will open for 1000$
            MoveObject(playerid, x, y, z, speed);
            return 1;
        }
        return 1;
    }
    return 0;
}
good luck
How to make it without command and where to put it?? :S
Reply
#8

pawn Код:
public OnPlayerUpdate(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, range, x, y, z))
        {
            if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough money to open the gate");
            GivePlayerMoney(playerid, -1000);// will open for 1000$
            MoveObject(playerid, x, y, z, speed);
       }
            return 1;
        }
Sorry for crappy indentation, I didn't copy this to pawno.
Reply
#9

Quote:
Originally Posted by [FU]Victious
Посмотреть сообщение
pawn Код:
public OnPlayerUpdate(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, range, x, y, z))
        {
            if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough money to open the gate");
            GivePlayerMoney(playerid, -1000);// will open for 1000$
            MoveObject(playerid, x, y, z, speed);
       }
            return 1;
        }
Sorry for crappy indentation, I didn't copy this to pawno.
But the Moveobject(PLAYERID ) shouldnt be that the name of object?
Reply
#10

Quote:
Originally Posted by thimo
Посмотреть сообщение
But the Moveobject(PLAYERID ) shouldnt be that the name of object?
I copied Rafa's code, I cba wasting my time re-writing something that's already been done. Who cares? If you knew, then change it..?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)