SA-MP Forums Archive
[SOLVED] Help..... - 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: [SOLVED] Help..... (/showthread.php?tid=130077)



[SOLVED] Help..... - [LSR]State_Trooper - 25.02.2010

Ok, Im trying to make it so I can press a key and open the gate and then press it again and it will close. So far I have the open part working. This is my code.


Код:
if(newkeys == KEY_ACTION)
  {
  if(gteam[playerid] == Team_LSPD)
   {
    MoveObject(PDA,1540.2041015625, -1627.822265625, 6.6545753479004,6);
		SendClientMessage(playerid,0x2641FEAA,"You have opened the Police Department Main gatee.");

	  return 1;
	}
	}
The code for closeing:

Код:
MoveObject(PDA,1540.2049560547,-1627.8229980469,14.9045753479,6);
		SendClientMessage(playerid,0x2641FEAA,"You have Closed the Police Department Main gate.");
I need it to know if the gate is alreayd open and to close it. I will keep playing around with it, any help is appreciated


Re: Help..... - mansonh - 25.02.2010

There are a ton of gates tutorials, do a search
or check out https://sampwiki.blast.hk/wiki/Category:Tutorials


---edit
Your comment right after makes no sense.
Tutorials are used by scripters too to see how to do something.
So as you said you needed to see how to finish, well look at a fraking tutorial, they will show you how it can be done.
--Being a scripter doesn't mean tutorials are useless. RTFM exists for a reason.


Re: Help..... - [LSR]State_Trooper - 25.02.2010

Quote:
Originally Posted by mansonh
There are a ton of gates tutorials, do a search
or check out https://sampwiki.blast.hk/wiki/Category:Tutorials
I'm scripter, I dont need a Gat tut, I can make gates quite fine tyvm!!

I asked a question. I have most of it worjking, Im just missing a few things. I'm asking for help.


Re: Help..... - [LSR]State_Trooper - 25.02.2010

**Bump**


Re: Help..... - Retardedwolf - 25.02.2010

Add a
pawn Код:
new GateOpen;
on top.

Not tested.

pawn Код:
if(newkeys == KEY_ACTION)
  {
  if(gteam[playerid] == Team_LSPD) && if(GateOpen == 0)
   {
    MoveObject(PDA,1540.2041015625, -1627.822265625, 6.6545753479004,6);
    SendClientMessage(playerid,0x2641FEAA,"You have opened the Police Department Main gate.");
       }
  else if(GateOpen == 1) && if(gteam[playerid] == Team_LSPD)
    {
    MoveObject(PDA,1540.2049560547,-1627.8229980469,14.9045753479,6);
    SendClientMessage(playerid,0x2641FEAA,"You have Closed the Police Department Main gate.");
    return 1;
}



Re: Help..... - [LSR]State_Trooper - 25.02.2010

Quote:
Originally Posted by www.******.com
Add a
pawn Код:
new GateOpen;
on top.

Not tested.

pawn Код:
if(newkeys == KEY_ACTION)
  {
  if(gteam[playerid] == Team_LSPD) && if(GateOpen == 0)
   {
    MoveObject(PDA,1540.2041015625, -1627.822265625, 6.6545753479004,6);
    SendClientMessage(playerid,0x2641FEAA,"You have opened the Police Department Main gate.");
       }
  else if(GateOpen == 1) && if(gteam[playerid] == Team_LSPD)
    {
    MoveObject(PDA,1540.2049560547,-1627.8229980469,14.9045753479,6);
    SendClientMessage(playerid,0x2641FEAA,"You have Closed the Police Department Main gate.");
    return 1;
}
Didn't worl got about 8 error's. Thanks for attempting tho


Re: Help..... - [LSR]State_Trooper - 25.02.2010

**Bump**


Re: Help..... - VonLeeuwen - 25.02.2010

Код:
new GateOpen; // on top
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  if(newkeys == KEY_ACTION)
  	{
	  if(gTeam[playerid] == Team_LSPD && GateOpen == 0)
	  {
	    MoveObject(PDA,1540.2041015625, -1627.822265625, 6.6545753479004,6);
	    SendClientMessage(playerid,0x2641FEAA,"You have opened the Police Department Main gate.");
	    GateOpen = 1;
	  }
	  else if(GateOpen == 1 && gTeam[playerid] == Team_LSPD)
	  {
	    MoveObject(PDA,1540.2049560547,-1627.8229980469,14.9045753479,6);
	    SendClientMessage(playerid,0x2641FEAA,"You have Closed the Police Department Main gate.");
	    GateOpen = 0;
		}
	}
	return 1;
}
Also, not tested ingame, but without compiling errors


Re: Help..... - [LSR]State_Trooper - 25.02.2010

Quote:
Originally Posted by VonLeeuwen
Код:
new GateOpen; // on top
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  if(newkeys == KEY_ACTION)
  	{
	  if(gTeam[playerid] == Team_LSPD && GateOpen == 0)
	  {
	    MoveObject(PDA,1540.2041015625, -1627.822265625, 6.6545753479004,6);
	    SendClientMessage(playerid,0x2641FEAA,"You have opened the Police Department Main gate.");
	    GateOpen = 1;
	  }
	  else if(GateOpen == 1 && gTeam[playerid] == Team_LSPD)
	  {
	    MoveObject(PDA,1540.2049560547,-1627.8229980469,14.9045753479,6);
	    SendClientMessage(playerid,0x2641FEAA,"You have Closed the Police Department Main gate.");
	    GateOpen = 0;
		}
	}
	return 1;
}
Also, not tested ingame, but without compiling errors
Thanks tryed and got this:

Код:
C:\Users\Natalie\Desktop\Radical RP\Radical RP Server\samp03asvr_R4_win32\gamemodes\Test1.pwn(14213) : error 017: undefined symbol "gTeam"
C:\Users\Natalie\Desktop\Radical RP\Radical RP Server\samp03asvr_R4_win32\gamemodes\Test1.pwn(14213) : warning 215: expression has no effect
C:\Users\Natalie\Desktop\Radical RP\Radical RP Server\samp03asvr_R4_win32\gamemodes\Test1.pwn(14213) : error 001: expected token: ";", but found "]"
C:\Users\Natalie\Desktop\Radical RP\Radical RP Server\samp03asvr_R4_win32\gamemodes\Test1.pwn(14213) : error 029: invalid expression, assumed zero
C:\Users\Natalie\Desktop\Radical RP\Radical RP Server\samp03asvr_R4_win32\gamemodes\Test1.pwn(14213) : fatal error 107: too many error messages on one line



Re: Help..... - VonLeeuwen - 25.02.2010

What do you use to set player's teams? gTeam, or SetPlayerTeam or something?


Re: Help..... - [LSR]State_Trooper - 25.02.2010

Teams,

Team_LSPD would b = if(gteam[playerid] == Team_LSPD)


Re: Help..... - VonLeeuwen - 25.02.2010

Oh sorry, had a capital T in gTeam..

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  if(newkeys == KEY_ACTION)
  	{
	  if(gteam[playerid] == Team_LSPD && GateOpen == 0)
	  {
	    MoveObject(PDA,1540.2041015625, -1627.822265625, 6.6545753479004,6);
	    SendClientMessage(playerid,0x2641FEAA,"You have opened the Police Department Main gate.");
	    GateOpen = 1;
	  }
	  else if(GateOpen == 1 && gteam[playerid] == Team_LSPD)
	  {
	    MoveObject(PDA,1540.2049560547,-1627.8229980469,14.9045753479,6);
	    SendClientMessage(playerid,0x2641FEAA,"You have Closed the Police Department Main gate.");
	    GateOpen = 0;
		}
	}
	return 1;
}



Re: Help..... - [LSR]State_Trooper - 25.02.2010

OMG< Thanks sooo Much!!


Re: Help..... - VonLeeuwen - 25.02.2010

No problem


Re: Help..... - [LSR]State_Trooper - 25.02.2010

If you have MSN add me: bradley@policecarmods.com ( Im not a n00b so I wont bug u lol =D )