gate moving problem - 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: gate moving problem (
/showthread.php?tid=185350)
gate moving problem -
Tom1412 - 24.10.2010
hi,
in this fs i need somone to help me, i got told tht i need to greate the object in the same script as the command.but i dont know how to do it can somone help me out.
PHP код:
#include <a_samp>
#define COLOR_RED 0xAA3333AA
new gateobject;
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(gateobject,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;
}
public OnFiltreScriptInit()
{
gateobject = CreateObject(980,1101.7249755859, -1741.2767333984, 15.273958206177, 0, 0, 90);
return 1;
}
Re: gate moving problem -
JaTochNietDan - 24.10.2010
That looks fine except you spelled one of the callbacks wrong "OnFiltreScriptInit()" should be "OnFilterScriptInit()".
Although the gate won't go anywhere since the co-ordinates of where it's created are the same as where you're moving it to.
Re: gate moving problem -
Rafa - 24.10.2010
pawn Код:
#include <a_samp>
#define COLOR_RED 0xAA3333AA
new gateobject;
public OnFilterScriptInit() // u have misstake this !!!
{
gateobject = CreateObject(980,1101.7249755859, -1741.2767333984, 15.273958206177, 0, 0, 90);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/pay", cmdtext, true, 10) == 0)
{
if(GetPlayerMoney(playerid) <= 250) return SendClientMessage(playerid, 0xFFFFFF, "You are to far to pay.");
GivePlayerMoney(playerid, -250);
MoveObject(gateobject,1101.724609375,-1741.2763671875,15.273958206177, 5.0); // change this coords cause its the same like ( CreateObject ) ...
SendClientMessage(playerid,COLOR_RED,"You have just paid and the gate is open");
return 1;
}
return 0;
}
Maybe this is simplest way ?? o_0
Re: gate moving problem -
Tom1412 - 24.10.2010
the gate is thier but it still wont open
PHP код:
#include <a_samp>
#define COLOR_RED 0xAA3333AA
new gateobject;
public OnFilterScriptInit()
{
gateobject = CreateObject(980,1101.7249755859, -1741.2767333984, 15.273958206177, 0, 0, 90);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/buyticket", cmdtext, true, 10) == 0)
{
if(GetPlayerMoney(playerid) <= 250) return SendClientMessage(playerid, 0xFFFFFF, "You are to far to pay.");
GivePlayerMoney(playerid, -250); MoveObject(gateobject,1101.7249755859, -1741.2767333984, 15.273958206177, 5.0);
SendClientMessage(playerid,COLOR_RED,"You have just paid and the gate is open");
return 1;
}
return 0;
}
Re: gate moving problem -
JaTochNietDan - 24.10.2010
That's quite simply because you're sending the gate to the same co-ordinates that you created it at, so it's not going to move anywhere. You need to get the co-ordinates of where you want to move it and put them in MoveObject.