help gate wont move - 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 gate wont move (
/showthread.php?tid=185254)
help gate wont move -
Tom1412 - 23.10.2010
hi,
i have got a command /pay then the gate should open but it dosnt.
PHP код:
#include <a_samp>
#define COLOR_RED 0xAA3333AA
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/pay", cmdtext, true, 10) == 0)
{
new money;
money = GetPlayerMoney(playerid);
if(IsPlayerInRangeOfPoint(playerid,0.0/*range*/,1105.6422,-1738.0181,13.4461))return SendClientMessage(playerid,COLOR_RED,"You are too far from the gate to pay");
if(money < 500)return SendClientMessage(playerid,COLOR_RED,"You do not have enough money");
MoveObject(980,1101.724609375,-1741.2763671875,15.273958206177, 5.0);
GivePlayerMoney(playerid, -250);
SendClientMessage(playerid,COLOR_RED,"You have just paid and the gate is open");
return 1;
}
return 0;
}
Re: help gate wont move -
Memoryz - 23.10.2010
Maybe the objectID isnt 980?
Change 980 in your moveobject to the ID of that object you want to move.
Re: help gate wont move -
Tom1412 - 23.10.2010
its the id for it
iv done them normal but i cant get this one to work
Re: help gate wont move -
JaTochNietDan - 23.10.2010
It does look like you're entering the model ID of the object (980) and not the actual ID of the object instance. You should make an easier way to reference to the ID of the object by storing it in a variable. For example:
pawn Код:
new gateobject;
public OnGameModeInit() // Or wherever you create those objects
{
gateobject = CreateObject(980,0.0,0.0,0.0,0.0,0.0,0.0); // CreateObject returns the ID of the object instance, so store it in the gateobject variable.
return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
if(strcmp(cmdtext,"/test",true) == 0)
{
MoveObject(gateobject,0.0,0.0,0.0,5.0); // Move the object where you want, referencing to the object ID using the value stored in the gateobject variable
return 1;
}
return 0;
}
Hope that helps.
Re: help gate wont move -
Tom1412 - 23.10.2010
how can i add this to my filter script for the hole bit
Re: help gate wont move -
JaTochNietDan - 23.10.2010
Quote:
Originally Posted by Tom1412
how can i add this to my filter script for the hole bit
|
The gate needs to be created in the same script that you have the command in, otherwise it won't really work.
Then you would literally just enter the important parts from my example into your code.