Help with Moving an object - 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: Help with Moving an object (
/showthread.php?tid=200919)
Help with Moving an object -
thimo - 19.12.2010
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
Re: Help with Moving an object -
Mr.Jvxmc - 19.12.2010
Look this
http://forum.sa-mp.com/showthread.ph...=moving+object
Re: Help with Moving an object -
Rafa - 19.12.2010
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, range, x, y, z))
{
MoveObject(playerid, x, y, z, speed);
return 1;
}
Re: Help with Moving an object -
thimo - 19.12.2010
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
Re: Help with Moving an object -
thimo - 19.12.2010
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?
Re: Help with Moving an object -
Rafa - 19.12.2010
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
Re: Help with Moving an object -
thimo - 19.12.2010
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
Re: Help with Moving an object -
WillyP - 19.12.2010
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.
Re: Help with Moving an object -
thimo - 19.12.2010
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?
Re: Help with Moving an object -
WillyP - 19.12.2010
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..?