SA-MP Forums Archive
Questions with gate - 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: Questions with gate (/showthread.php?tid=89283)



Questions with gate - tturvas - 01.08.2009

OK, so i made command /mgate what opens the gate of bike parking. And it cost 2000$ to open the gate, closing cost nothing. But when i try to close the gate with less than 2000$, it will say that i dont have enough money...So the problem is: I want that "You dont have enough money" say ONLY for OPENING the gate.

Код:
	if(strcmp(cmdtext,"/mgate",true ) == 0 )
	
	if(GetPlayerMoney(playerid) < 2000)
	{
		SendClientMessage(playerid, red, "You dont have enough money");
		return 1;
	}
	
		else

	{
	  if(PlayerToPoint(10.0,playerid,-505.2811,2592.9241,53.4345))
		{
			if(mgate == 1)
			{
				MoveObject(gate, -504.925720, 2590.153564, 53.475311, 2.0);
				MoveObject(gate2, -504.894165, 2595.635498, 53.470360, 2.0);
				SendClientMessage(playerid, aqua, "Gate of bike parking is now closed");
				mgate = 0;
			}
			else
			{
			MoveObject(gate,-504.925720, 2584.749756, 53.475311, 2.00 );
			MoveObject(gate2,-504.894165, 2601.114014, 53.470360, 2.00);
			GivePlayerMoney(playerid, -2000);
			SendClientMessage(playerid, aqua, "Gate of bike parking is now opened, it cost you 2000$");
			mgate = 1;
			}
			return 1;
			
		}
		else
		{
			SendClientMessage(playerid, 0x804040FF, "You're not near the gate!");
			return 1;
		}
And another question:
How can i add timer to it? Like: if the gate is opened, then it will close after 1 min ?


Re: Questions with gate - Yuryfury - 01.08.2009

pawn Код:
//PUT THIS UNDER #INCLUDE <samp>
forward gateclose(playerid);
////////////////////////////////

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext,"/mgate",true ) == 0 )
    {
          if(PlayerToPoint(10.0,playerid,-505.2811,2592.9241,53.4345))
            {
                if(mgate == 0)
                {
                    if(GetPlayerMoney(playerid) < 2000)
                    {
                        SendClientMessage(playerid, red, "You dont have enough money");
                        return 1;
                    }
                    else
                    {
                        MoveObject(gate,-504.925720, 2584.749756, 53.475311, 2.00 );
                        MoveObject(gate2,-504.894165, 2601.114014, 53.470360, 2.00);

                        new money;
                        money = GetplayerMoney(playerid);
                        GivePlayerMoney(playerid, money-2000);
                        SendClientMessage(playerid, aqua, "Gate of bike parking is now opened, it cost you 2000$");
                        SetTimer("gateclose",60000,0);
                        mgate = 1;
                    }

            }
            else
            {
                SendClientMessage(playerid, 0x804040FF, "You're not near the gate!");
            }
    return 1;
}

public gateclose(playerid)
{
    MoveObject(gate, -504.925720, 2590.153564, 53.475311, 2.0);
    MoveObject(gate2, -504.894165, 2595.635498, 53.470360, 2.0);
    SendClientMessage(playerid, aqua, "Gate of bike parking is now closed");}
    mgate = 0;
    return 1;
}




Re: Questions with gate - tturvas - 01.08.2009

delete


Re: Questions with gate - Yuryfury - 01.08.2009

Quote:
Originally Posted by tturvas
delete
does it work?

btw don't delete it, someone else might have the same question in the future and can learn from this


Re: Questions with gate - tturvas - 01.08.2009

Quote:
Originally Posted by Yuryfury
Quote:
Originally Posted by tturvas
delete
does it work?

btw don't delete it, someone else might have the same question in the future and can learn from this
It says error

C:\Program Files\Rockstar Games\GTA San Andreas\samp02Xserver.win32\gamemodes\tturvas.pwn( 483) : error 017: undefined symbol "GetplayerMoney"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

In that text there was nothing important, i made it before you edited your reply


Re: Questions with gate - Abernethy - 01.08.2009

Capitalize, GetPlayerMoney.


Re: Questions with gate - tturvas - 01.08.2009

Quote:
Originally Posted by Abernethy
Capitalize, GetPlayerMoney.
Oh yeah...right. Okey i go try it in game.

-----

It works but i want it to close if i write /mgate again....that timer is in case if somebody will forgot to close the gate


Re: Questions with gate - Abernethy - 01.08.2009

Script. Request. Thread. Nobody is going to do it for you, Sheesh.


Re: Questions with gate - tturvas - 01.08.2009

So i made the code by my self, but it says error

Код:
	if(strcmp(cmdtext,"/mgate",true ) == 0 )
{
		if(PlayerToPoint(13.0,playerid,-505.2811,2592.9241,53.4345))
		{
		SendClientMessage(playerid,red,"To open the gate type /mgate");
		}
		
		if(mgate == 0)
		{
	 				if(GetPlayerMoney(playerid) < 2000)
					{
						SendClientMessage(playerid, red, "You dont have enough money");
						return 1;
					}
					else
					{

						MoveObject(gate,-504.925720, 2584.749756, 53.475311, 2.00 );
						MoveObject(gate2,-504.894165, 2601.114014, 53.470360, 2.00);
						SendClientMessage(playerid, aqua, "Gate of bike parking is now opened, it cost you 2000$");
						GivePlayerMoney(playerid,-2000);
						SetTimer("gateclose",60000,0);
						mgate = 1;
						return 1;
   					}

  					}
					else
  					{
						MoveObject(gate, -504.925720, 2590.153564, 53.475311, 2.0);
						MoveObject(gate2, -504.894165, 2595.635498, 53.470360, 2.0);
						SendClientMessage(playerid, aqua, "Gate of bike parking is now closed");
						mgate = 0;
						return 1;
					 	}
 				 	}
					else
				 	{
 				 		{
						SendClientMessage(playerid, 0x804040FF, "You're not near the gate!");
						return 1;
 						}
			}
}
	return 0;
}
Error:
Код:
C:\Program Files\Rockstar Games\GTA San Andreas\samp02Xserver.win32\gamemodes\tturvas.pwn(509) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: Questions with gate - Serediucr - 01.08.2009

Quote:
Originally Posted by tturvas
So i made the code by my self, but it says error

Код:
	if(strcmp(cmdtext,"/mgate",true ) == 0 )
{
		if(PlayerToPoint(13.0,playerid,-505.2811,2592.9241,53.4345))
		{
		SendClientMessage(playerid,red,"To open the gate type /mgate");
		}
		
		if(mgate == 0)
		{
	 				if(GetPlayerMoney(playerid) < 2000)
					{
						SendClientMessage(playerid, red, "You dont have enough money");
						return 1;
					}
					else
					{

						MoveObject(gate,-504.925720, 2584.749756, 53.475311, 2.00 );
						MoveObject(gate2,-504.894165, 2601.114014, 53.470360, 2.00);
						SendClientMessage(playerid, aqua, "Gate of bike parking is now opened, it cost you 2000$");
						GivePlayerMoney(playerid,-2000);
						SetTimer("gateclose",60000,0);
						mgate = 1;
						return 1;
  					}

 					}
					else
 					{
						MoveObject(gate, -504.925720, 2590.153564, 53.475311, 2.0);
						MoveObject(gate2, -504.894165, 2595.635498, 53.470360, 2.0);
						SendClientMessage(playerid, aqua, "Gate of bike parking is now closed");
						mgate = 0;
						return 1;
					 	}
 				 	}
					else
				 	{
 				 		{
						SendClientMessage(playerid, 0x804040FF, "You're not near the gate!");
						return 1;
 						}
			}
}
Error:
Код:
C:\Program Files\Rockstar Games\GTA San Andreas\samp02Xserver.win32\gamemodes\tturvas.pwn(509) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
and line 509 is..