SA-MP Forums Archive
Entrance 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)
+--- Thread: Entrance Help (/showthread.php?tid=357349)



Entrance Help - Krakuski - 06.07.2012

Before I start this, I would like to say Hello, Im a new scripter and hope to script my own server soon

Alrighty so heres my problem, Im attempting to make a enterance to a door, but it only seems to work in only one specific spot (Ex. Jizzy's club only, or the Police Department), So if you guys can, might you show me how to make many entrances? Thanks!


public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/enter", cmdtext, true, 6) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInRangeOfPoint(playerid,3.0, -2624.3667,1411.8839,7.0938 ))
{
SetPlayerPos(playerid,-2640.762939,1406.682006,906.460937);
SetPlayerInterior(playerid, 3);
SetPlayerFacingAngle(playerid, 90.9048 );
SetCameraBehindPlayer(playerid);
}
else SendClientMessage(playerid, COLOR_WHITE, "You need to be near an entrance!");
}
return 1;
}
//This is the one that does not work, even If I change the Coordinates.
if(strcmp("/enter", cmdtext, true, 6) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInRangeOfPoint(playerid,3.0, -2624.3667,1411.8839,7.0938 ))
{
SetPlayerPos(playerid,-2640.762939,1406.682006,906.460937);
SetPlayerInterior(playerid, 3);
SetPlayerFacingAngle(playerid, 90.9048 );
SetCameraBehindPlayer(playerid);
}
else SendClientMessage(playerid, COLOR_WHITE, "You need to be near an entrance!");
}
return 1;
}
if(strcmp("/exit", cmdtext, true, 5) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInRangeOfPoint(playerid,5.0, -2640.762939,1406.682006,906.460937))
{
SetPlayerPos(playerid,-2624.3667,1411.8839,7.0938 );
SetPlayerInterior(playerid, 0);
SetPlayerFacingAngle(playerid, 195.0774);
SetCameraBehindPlayer(playerid);
}
else SendClientMessage(playerid, COLOR_WHITE, "You need to be near an exit!");
}
return 1;
}


Re: Entrance Help - Karol56 - 06.07.2012

Shouldn't you make like /enter2 because /enter already exists?
Am a beginner too :P


Re: Entrance Help - Krakuski - 06.07.2012

Well Not all servers are like that, If i want like 50 doors, you wouldnt expect for players to try all 50 /enter's would you?


Re: Entrance Help - CmZxC - 06.07.2012

pawn Code:
if(strcmp("/enter", cmdtext, true, 6) == 0)
{
   if(IsPlayerConnected(playerid))
   {
      if(IsPlayerInRangeOfPoint(playerid,3.0, -2624.3667,1411.8839,7.0938 ))
      {
         SetPlayerPos(playerid,-2640.762939,1406.682006,906.460937);
         SetPlayerInterior(playerid, 3);
         SetPlayerFacingAngle(playerid, 90.9048 );
         SetCameraBehindPlayer(playerid);
      }
      else if(IsPlayerInRangeOfPoint(playerid,3.0, -2624.3667,1411.8839,7.0938 ))
      {
         SetPlayerPos(playerid,-2640.762939,1406.682006,906.460937);
         SetPlayerInterior(playerid, 3);
         SetPlayerFacingAngle(playerid, 90.9048 );
         SetCameraBehindPlayer(playerid);
      }
      else SendClientMessage(playerid, COLOR_WHITE, "You need to be near an entrance!");
   }  
   return 1;
}



Re: Entrance Help - Karol56 - 06.07.2012

Yeah I know what you mean.

Number the sequence each time.. set it with a different number, I don't exactly know how though..
And thanks, you gave me an idea how to do a pickup etc (no copy no worries)


Re: Entrance Help - Krakuski - 06.07.2012

No Problem Karol, and Thank you CmZxC!!!! REP+ for you!