GATE HELP! -
TyThaBomb - 18.06.2011
Well, I put together a gate script to where when you type certain commands, the gates open and close. But only ONE of the gates works, and I can't seem to find out why. Any help?
Код:
#include <a_samp>
new agate1;
new agate2;
new tygate;
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
agate1 = CreateObject(3049, -2243.1083984375, 645.521484375, 50.687446594238, 0, 0, 92.999267578);
agate2 = CreateObject(3037, -2201.75390625, 668.16943359375, 68.796875, 0, 0, 0);
tygate = CreateObject(988, 1497.4320068359, -699.79998779297, 93.75, 0, 0, 0);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp("/agate1close", cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, -2243.1083984375, 645.521484375, 50.687446594238))
{
MoveObject(agate1, -2243.1083984375, 645.521484375, 50.687446594238, 1);
}
return 1;
}
if (!strcmp("/agate2close", cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, -2204.9787597656, 686.09515380859, 66.60084533694))
{
MoveObject(agate2, -2204.9787597656, 686.09515380859, 66.60084533694, 1);
}
return 1;
}
if (!strcmp("/tygatec", cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, -2243.1083984375, 645.521484375, 50.687446594238))
{
MoveObject(tygate, 1497.4320068359, -699.79998779297, 93.75, 1);
}
return 1;
}
if (!strcmp("/agate1open", cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, -2243.1083984375, 645.521484375, 50.687446594238))
{
MoveObject(agate1, -2243.1083984375, 645.521484375, 46.687446594238, 1);
}
return 1;
}
if (!strcmp("/agate2open", cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, -2243.1083984375, 645.521484375, 50.687446594238))
{
MoveObject(agate2, -2204.9787597656, 686.09515380859, 66.60084533694, 1);
}
return 1;
}
if (!strcmp("/tygateo", cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 1497.4320068359, -699.79998779297, 93.75))
{
MoveObject(tygate, 1497.4320068359, -699.79998779297, 89.55, 1);
}
return 1;
}
return 0;
}
Re: GATE HELP! -
Lorenc_ - 18.06.2011
Which is the one gate that works? And had you checked the co-ordinates?
Re: GATE HELP! -
Sascha - 18.06.2011
also add a "else return SendClientMessage(playerid, 0x999999AA, "Not in range");"
as else statement to the "if(IsPlayerInRangeOfPoint(...))" to check whether the "MoveObject" code even gets called
Re: GATE HELP! -
TyThaBomb - 18.06.2011
Yes, I've checked the coordinates, and I'm going to try that other option.
Re: GATE HELP! -
TyThaBomb - 18.06.2011
I got the error "C:\Users\tyler\Desktop\SERVER\filterscripts\gates .pwn(100) : error 029: invalid expression, assumed zero" when trying to add the line.
Re: GATE HELP! -
The_J0ker - 18.06.2011
Here it compiled fine for me.
pawn Код:
#include <a_samp>
new agate1;
new agate2;
new tygate;
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
agate1 = CreateObject(3049, -2243.1083984375, 645.521484375, 50.687446594238, 0, 0, 92.999267578);
agate2 = CreateObject(3037, -2201.75390625, 668.16943359375, 68.796875, 0, 0, 0);
tygate = CreateObject(988, 1497.4320068359, -699.79998779297, 93.75, 0, 0, 0);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp("/agate1close", cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, -2243.1083984375, 645.521484375, 50.687446594238))
{
MoveObject(agate1, -2243.1083984375, 645.521484375, 50.687446594238, 1);
}
return 1;
}
if (!strcmp("/agate2close", cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, -2204.9787597656, 686.09515380859, 66.60084533694))
{
MoveObject(agate2, -2204.9787597656, 686.09515380859, 66.60084533694, 1);
}
return 1;
}
if (!strcmp("/tygatec", cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, -2243.1083984375, 645.521484375, 50.687446594238))
{
MoveObject(tygate, 1497.4320068359, -699.79998779297, 93.75, 1);
}
return 1;
}
if (!strcmp("/agate1open", cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, -2243.1083984375, 645.521484375, 50.687446594238))
{
MoveObject(agate1, -2243.1083984375, 645.521484375, 46.687446594238, 1);
}
return 1;
}
if (!strcmp("/agate2open", cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, -2243.1083984375, 645.521484375, 50.687446594238))
{
MoveObject(agate2, -2204.9787597656, 686.09515380859, 66.60084533694, 1);
}
return 1;
}
if (!strcmp("/tygateo", cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 1497.4320068359, -699.79998779297, 93.75))
{
MoveObject(tygate, 1497.4320068359, -699.79998779297, 89.55, 1);
}
return 1;
}
return 0;
}
Re: GATE HELP! -
TyThaBomb - 19.06.2011
Okay I've got the script working now, but I don't want it to be where you have to type a command to close it. I have the script for one of the gates here, how would I add a timer to it to where it closes after about 7 seconds? And also make it to where it goes back up to X Coordinate 94.
pawn Код:
}
if (!strcmp("/agate1open", cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, -2243.1083984375, 645.521484375, 50.687446594238))
SendClientMessage(playerid, 0x999999AA, "Gate Opened.");
{
MoveObject(agate1, -2243.1083984375, 645.521484375, 46.687446594238, 1);
}
return 1;
Re: GATE HELP! -
TyThaBomb - 19.06.2011
So, I made this script below, and I get this error:
Код:
C:\Users\tyler\Desktop\SERVER\filterscripts\gates.pwn(120) : error 028: invalid subscript (not an array or too many subscripts): "tygate"
SCRIPT:
pawn Код:
}
if (!strcmp("/tygateo", cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 1497.4320068359, -699.79998779297, 94))
SendClientMessage(playerid, 0x999999AA, "Gate Opened.");
{
MoveObject(tygate, 1497.4320068359, -699.79998779297, 89.55, 1);
}
SetTimer(tygate[], 8, 0);
MoveObject(tygate, 1497.4320068359, -699.79998779297, 94, 1);
return 1;
}
return 0;
Re: GATE HELP! -
TyThaBomb - 19.06.2011
Bump! Someone help!
Re: GATE HELP! -
Wesley221 - 19.06.2011
Because of this:
Код:
SetTimer(tygate[], 8, 0);
Remove the [ ]'s, and its probably fixed