[Solved half] moving gate
#1

Can someone make a script for me, so the gate moves when i stand for it,
or a command?

When he is closed:
Код:
CreateObject(986,-302.628,1507.450,76.070,0.0,0.0,0.0);
When he is open:

Код:
CreateObject(986,-293.828,1507.450,76.070,0.0,0.0,0.0);
Ty is ya can that
Reply
#2

On top of the script:
Код:
new gate;
Instead of 'CreateObject(986,-302.628,1507.450,76.070,0.0,0.0,0.0);' use

Код:
gate = CreateObject(986,-302.628,1507.450,76.070,0.0,0.0,0.0);
At: "public OnPlayerCommandText(playerid,cmdtext[])", place this:

Код:
if(strcmp("/opengate", cmdtext, true, 10) == 0) 
{
MoveObject(gate,-293.828,1507.450,76.070,1.5000); // 1.5000 means how fast it has to open
return 1;
}
That's the most easy one I can make, I think :P

Oh, and he has to close it ofcourse :P

Код:
if (strcmp("/closegate",cmdtext,true,10) == 0)
{
MoveObject(gate,-302.628,1507.450,76.070,1.500);
return 1;
}
It's not very nice, but it works
Reply
#3

on top of the script:
pawn Код:
new gate;
OnFilterScriptInit / OnGameModeInit:
pawn Код:
gate = CreateObject(986,-302.628,1507.450,76.070,0.0,0.0,0.0);
On the bottom of your script:
pawn Код:
forward CheckGate();
public CheckGate()
{
  for(new i = 0; i < GetMaxPlayers(); i++) {
    if(!IsPlayerConnected(i)) continue;
    if(IsPlayerInRangeOfPoint(i, 10.0, -302.628,1507.450,76.070) && OpenGate[i] == 0) {
      MoveObject(gate,-293.828,1507.450,76.070,10);
      OpenGate[i] = 1;
    }
    else if(!IsPlayerInRangeOfPoint(i, 10.0, -302.628,1507.450,76.070) && OpenGate[i] == 1) {
      MoveObject(gate,-302.628,1507.450,76.070,10);
      OpenGate[i] = 0;
    }
}
This one checks if a player is near the object.
Reply
#4

Quote:
Originally Posted by KnooL
on top of the script:
pawn Код:
new gate;
OnFilterScriptInit / OnGameModeInit:
pawn Код:
gate = CreateObject(986,-302.628,1507.450,76.070,0.0,0.0,0.0);
On the bottom of your script:
pawn Код:
forward CheckGate();
public CheckGate()
{
  for(new i = 0; i < GetMaxPlayers(); i++) {
    if(!IsPlayerConnected(i)) continue;
    if(IsPlayerInRangeOfPoint(i, 10.0, -302.628,1507.450,76.070) && OpenGate[i] == 0) {
      MoveObject(gate,-293.828,1507.450,76.070,10)
      OpenGate[i] = 1;
    }
    else if(!IsPlayerInRangeOfPoint(i, 10.0, -302.628,1507.450,76.070) && OpenGate[i] == 1) {
      MoveObject(gate,-302.628,1507.450,76.070,10)
      OpenGate[i] = 0;
    }
}
This one checks if a player is near the object.
got 4 errors

Reply
#5

Код:
Line 394: forward CheckGate();
Line 395: public CheckGate()
Line 396: {
Line 397:  for(new i = 0; i < GetMaxPlayers(); i++) {
Line 398:    if(!IsPlayerConnected(i)) continue;
Line 399:    if(IsPlayerInRangeOfPoint(i, 10.0, -302.628,1507.450,76.070) && OpenGate[i] == 0);
Line 400:      MoveObject(gate,-293.828,1507.450,76.070,10)
Line 401:      OpenGate[i] = 1;
Line 402:    }
Line 403:    else if(!IsPlayerInRangeOfPoint(i, 10.0, -302.628,1507.450,76.070) && OpenGate[i] == 1) {
Line 404:      MoveObject(gate,-302.628,1507.450,76.070,10)
Line 405:      OpenGate[i] = 0;
Line 406:    }
Line 407:}
Error's:
Код:
C:\Users\Mike\Desktop\Night Life Roleplay\gamemodes\SFFB.pwn(348) : warning 217: loose indentation
C:\Users\Mike\Desktop\Night Life Roleplay\gamemodes\SFFB.pwn(350) : warning 217: loose indentation
C:\Users\Mike\Desktop\Night Life Roleplay\gamemodes\SFFB.pwn(399) : error 017: undefined symbol "OpenGate"
C:\Users\Mike\Desktop\Night Life Roleplay\gamemodes\SFFB.pwn(399) : warning 215: expression has no effect
C:\Users\Mike\Desktop\Night Life Roleplay\gamemodes\SFFB.pwn(399) : error 001: expected token: ";", but found "]"
C:\Users\Mike\Desktop\Night Life Roleplay\gamemodes\SFFB.pwn(399) : error 029: invalid expression, assumed zero
C:\Users\Mike\Desktop\Night Life Roleplay\gamemodes\SFFB.pwn(399) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#6

on top of the script:
pawn Код:
new gate;
OnFilterScriptInit / OnGameModeInit:
pawn Код:
gate = CreateObject(986,-302.628,1507.450,76.070,0.0,0.0,0.0);
On the bottom of your script:
pawn Код:
forward CheckGate();
public CheckGate()
{
  for(new i = 0; i < GetMaxPlayers(); i++) {
    if(!IsPlayerConnected(i)) continue;
    if(IsPlayerInRangeOfPoint(i, 10.0, -302.628,1507.450,76.070) && OpenGate[i] == 0) {
      MoveObject(gate,-293.828,1507.450,76.070,10);
      OpenGate[i] = 1;
    }
    else if(!IsPlayerInRangeOfPoint(i, 10.0, -302.628,1507.450,76.070) && OpenGate[i] == 1) {
      MoveObject(gate,-302.628,1507.450,76.070,10);
      OpenGate[i] = 0;
    }
  }
Reply
#7

Quote:
Originally Posted by KnooL
on top of the script:
pawn Код:
new gate;
OnFilterScriptInit / OnGameModeInit:
pawn Код:
gate = CreateObject(986,-302.628,1507.450,76.070,0.0,0.0,0.0);
On the bottom of your script:
pawn Код:
forward CheckGate();
public CheckGate()
{
  for(new i = 0; i < GetMaxPlayers(); i++) {
    if(!IsPlayerConnected(i)) continue;
    if(IsPlayerInRangeOfPoint(i, 10.0, -302.628,1507.450,76.070) && OpenGate[i] == 0) {
      MoveObject(gate,-293.828,1507.450,76.070,10);
      OpenGate[i] = 1;
    }
    else if(!IsPlayerInRangeOfPoint(i, 10.0, -302.628,1507.450,76.070) && OpenGate[i] == 1) {
      MoveObject(gate,-302.628,1507.450,76.070,10);
      OpenGate[i] = 0;
    }
  }
same errors
Reply
#8

pawn Код:
if(IsPlayerInRangeOfPoint(i, 10.0, -302.628,1507.450,76.070) && OpenGate[i] == 0);
must be

pawn Код:
if(IsPlayerInRangeOfPoint(i, 10.0, -302.628,1507.450,76.070) && OpenGate[i] == 0) {
Reply
#9

Quote:
Originally Posted by KnooL
pawn Код:
if(IsPlayerInRangeOfPoint(i, 10.0, -302.628,1507.450,76.070) && OpenGate[i] == 0);
must be

pawn Код:
if(IsPlayerInRangeOfPoint(i, 10.0, -302.628,1507.450,76.070) && OpenGate[i] == 0) {
i have:
Код:
forward CheckGate();
public CheckGate()
{
for(new i = 0; i < GetMaxPlayers(); i++) {
  if(!IsPlayerConnected(i)) continue;
  if(IsPlayerInRangeOfPoint(i, 10.0, -302.628,1507.450,76.070) && OpenGate[i] == 0) {
    MoveObject(gate,-293.828,1507.450,76.070,10);
		OpenGate[i] = 1;
  }
	else if(!IsPlayerInRangeOfPoint(i, 10.0, -302.628,1507.450,76.070) && OpenGate[i] == 1) {
    MoveObject(gate,-302.628,1507.450,76.070,10);
    OpenGate[i] = 0;
	}
}
With that i getting errors
Reply
#10

On top on your script:
pawn Код:
new OpenGate[MAX_PLAYERS];
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)