gate problem.
#1

Hello, I'm noob, tryed to lear gate script, here is what i maked.

Код:
//***====================My gate script====================***/
//**==============================================================================**//

#include <a_samp>

#define COLOR_LIGHTBLUE 0x33CCFFAA

forward gateClose(playerid);


new gate2;

public OnFilterScriptInit()
{
print("\n--Test by me\n");
CreateObject(3749,316.01211548,-1785.01037598,9.54506397,0.00000000,0.00000000,0.00000000); //convertffs(1)
gate2 = CreateObject(980,316.23278809,-1785.50659180,6.43586397,0.00000000,0.00000000,180.00000000); //convertffs(30)
return 1;
}


public gateClose()
{
	MoveObject(gate,316.23278809, -1785.50659180, 6.43586397, 3.5);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (IsPlayerInRangeOfPoint(playerid,10,338.9116,-1784.1176,5.0854))
return 0;
{
if (strcmp(cmdtext, "/parkout", true)==0)
{
MoveObject(gate,339.02227783203, -1784.5198974609, 0.8551278114319, 3.5);
GameTextForPlayer(playerid, "~w~Gate will close in 10 secs. Thanks for your park. Hope to see you agian!", 5000, 1);
SetTimer("gateClose", 10000, 0);
return 1;
}
return 1;
}
return 0;
{
if (IsPlayerInRangeOfPoint(playerid,10,316.23278809, -1785.50659180, 5.43586397))
{
if (strcmp(cmdtext, "/parkout", true)==0)
{
MoveObject(gate, 316.23278809, 1785.50659180, 6.8551278114319, 3.5);
GameTextForPlayer(playerid, "~w~Gate will close in 10 secs. Welcome to the park for cars!", 5000, 1);
SetTimer("gateClose", 10000, 0);
return 1;
}
return 1;
}



return 0;
}
And i get this erro:

Код:
C:\Users\Noner\Desktop\gate-script-2.pwn(24) : error 017: undefined symbol "gate"
C:\Users\Noner\Desktop\gate-script-2.pwn(35) : error 017: undefined symbol "gate"
C:\Users\Noner\Desktop\gate-script-2.pwn(42) : warning 225: unreachable code
C:\Users\Noner\Desktop\gate-script-2.pwn(43) : warning 225: unreachable code
C:\Users\Noner\Desktop\gate-script-2.pwn(48) : error 017: undefined symbol "gate"
C:\Users\Noner\Desktop\gate-script-2.pwn(60) : error 030: compound statement not closed at the end of file (started at line 30)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Tryed to fix them, but then i got more erros, Help :P
Reply
#2

Try to remove gateclose?
Reply
#3

No, then the gate wont close.
Someone else who know the problem?
Reply
#4

You totally need to learn about OnPlayerCommandText atm.
https://sampforum.blast.hk/showthread.php?tid=43930 for the gate tutorial.
Reply
#5

Change:
Код:
CreateObject(3749,316.01211548,-1785.01037598,9.54506397,0.00000000,0.00000000,0.00000000); //convertffs(1)
gate2 = CreateObject(980,316.23278809,-1785.50659180,6.43586397,0.00000000,0.00000000,180.00000000); //convertffs(30)
To:
Код:
gate = CreateObject(3749,316.01211548,-1785.01037598,9.54506397,0.00000000,0.00000000,0.00000000); //convertffs(1)
gate2 = CreateObject(980,316.23278809,-1785.50659180,6.43586397,0.00000000,0.00000000,180.00000000); //convertffs(30)
You also need to learn how to detect if the gate is closed or open. I can't explain at the moment, got other stuff to do. But it's not opening/closing properly because you're not asking the script if it's opened or closed.
Reply
#6

replace it all with this

Код:
#include <a_samp>

#define COLOR_LIGHTBLUE 0x33CCFFAA

forward gateClose(playerid);


new gate;

public OnFilterScriptInit()
{
print("\n--Test by me\n");
CreateObject(3749,316.01211548,-1785.01037598,9.54506397,0.00000000,0.00000000,0.00000000); //convertffs(1)
gate = CreateObject(980,316.23278809,-1785.50659180,6.43586397,0.00000000,0.00000000,180.00000000); //convertffs(30)
return 1;
}


public gateClose()
{
	MoveObject(gate,316.23278809, -1785.50659180, 6.43586397, 3.5);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{

if (strcmp(cmdtext, "/parkout", true)==0)
{
if (IsPlayerInRangeOfPoint(playerid,10,338.9116,-1784.1176,5.0854))
{
MoveObject(gate,339.02227783203, -1784.5198974609, 0.8551278114319, 3.5);
GameTextForPlayer(playerid, "~w~Gate will close in 10 secs. Thanks for your park. Hope to see you agian!", 5000, 1);
SetTimer("gateClose", 10000, 0);
}
return 1;
}



if (strcmp(cmdtext, "/parkout", true)==0)
{
if (IsPlayerInRangeOfPoint(playerid,10,316.23278809, -1785.50659180, 5.43586397))
{
MoveObject(gate, 316.23278809, 1785.50659180, 6.8551278114319, 3.5);
GameTextForPlayer(playerid, "~w~Gate will close in 10 secs. Welcome to the park for cars!", 5000, 1);
SetTimer("gateClose", 10000, 0);
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)