Opening gates -
Devil_ - 05.03.2011
Hey everyone,
First of all sorry for my bad english.
I try to include a script for a samp serv that's open the gates that are mapped. But it won't work.
Here is the script code. I mapped two gates, one opened and one closed.
new obj1;
public OnFilterScriptInit()
{
obj1 = CreateObject(976, 2485.6479492188, 2350.5834960938, 9.8281135559082, 0, 0, 180); //barriere FBI Fermer
return 1;
}
public OnGameModeInit()
{
CreateObject(976, 2485.6479492188, 2350.5834960938, 9.8281135559082, 0, 0, 180); //barriere FBI Fermer
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/opfbi", cmdtext, true)==0)
{
MoveObject(obj1,2485.6479492188, 2350.5834960938, 9.8281135559082, 6.5);
SetTimer("GateClose", 15000, 0);
SendClientMessage(playerid, COLOR_PURPLE,"FBI GATE OPENING - CLOSING IN 15 SECONDS");
return 1;
}
return 0;
}
public GateClose()
{
MoveObject (obj1,2485.6479492188, 2350.5834960938, 9.8281135559082, 3.5);
return 1;
}
Can anyone help me?
Thanks
Re: Opening gates -
Amel_PAtomAXx - 05.03.2011
show us your errors and warnings..
Re : Opening gates -
Devil_ - 05.03.2011
The compile gives no errors and warnings. In game the command work, but the gate won't open. I get a message in chat box "FBI GATE OPENING - CLOSING IN 15 SECONDS" but nothing happens.
Re: Opening gates -
Loppa - 05.03.2011
It doesn't move because you are setting it to move to the same cords.
Re : Opening gates -
Devil_ - 05.03.2011
Witch line do you mean? i don't see the error.
Re : Opening gates -
Devil_ - 05.03.2011
I tryed this one but won't work at all.
new obj1;
public OnFilterScriptInit()
{
obj1 = CreateObject(976, 2485.6479492188, 2350.5834960938, 9.8281135559082, 0, 0, 180); //barriere FBI Fermer
//fbi = CreateObject(969, 2477.1645507813, 2350.5571289063, 9.8203125, 0, 0, 0);// barriere fermйe
return 1;
}
public OnGameModeInit()
{
CreateObject(976, 2485.6479492188, 2350.5834960938, 9.8281135559082, 0, 0, 180); //barriere FBI Fermer
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/opfbi", cmdtext, true)==0)
{
MoveObject(obj1,2477.6479492188, 2350.4584960938, 9.8281135559082, 6.5);
SetTimer("GateClose", 15000, 0);
SendClientMessage(playerid, COLOR_PURPLE,"FBI GATE OPENING - CLOSING IN 15 SECONDS");
return 1;
}
return 0;
}
public GateClose()
{
MoveObject (obj1,2485.6479492188, 2350.5834960938, 9.8281135559082, 3.5);
return 1;
}
Re: Opening gates -
antonio112 - 05.03.2011
I don`t get one thing ...
Why you create the same object in FilterScriptInit and in GameModeInit aswell ? Even if your FilterScript Object would move, the GameModeInit one, would still be there ... so prolly that`s the problem?
Try this:
pawn Код:
new obj1;
public OnGameModeInit()
{
obj 1 = CreateObject(976, 2485.6479, 2350.5834, 9.8281, 0, 0, 180); //barriere FBI Fermer
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/opfbi", cmdtext, true)==0)
{
MoveObject(obj1,2477.6479, 2350.4584, 9.8281, 6.5);
SetTimer("GateClose", 15000, 0);
SendClientMessage(playerid, COLOR_PURPLE,"FBI GATE OPENING - CLOSING IN 15 SECONDS");
return 1;
}
return 0;
}
forward GateClose();
public GateClose()
{
MoveObject (obj1,2485.6479, 2350.5834, 9.8281, 3.5);
return 1;
}
ps: You either put the object in the
FilterScriptInit or in
GameModeInit ... not in both of them.
Re : Opening gates -
Devil_ - 05.03.2011
Thanks i'll try that tommorow and i will report. Thanks a lot
Re: Opening gates -
antonio112 - 05.03.2011
You're welcome ... and don`t worry, I tested it and it works fine:P
Re : Opening gates -
Devil_ - 06.03.2011
Hey everyone,
I tryed the script code but it gives me these errors
[IMG]

[/IMG]