SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 13/11/2013, 10:24 PM   #1
EvanA
Big Clucker
 
EvanA's Avatar
 
Join Date: Mar 2013
Posts: 151
Reputation: -11
Default /enter -- Making a simple enter command.

/ENTER - Making a simple enter command.

Hello. Today, I'll be showing you how you can make a very simple /enter command for your server. I will be showing you how you can do this in the following command processors: ZCMD and strcmp. Now, let's get started.

Now, let's get everything set-up. The first part of this tutorial will be done in ZCMD. Let's get our includes ready. If you don't already have a_samp included in your script you might wanna do that.

Code:
#include <a_samp>
Then, the ZCMD include...
Code:
#include ZCMD
Of-course, you'll need the actual ZCMD include so make sure you have that. You can get it from here.

Let's start the actual command now...

The first thing you need to do is set-up your command.

Code:
CMD:enter(playerid, params[])
{
}
After the first bracket({) you'll input the actual code. Now, the first thing you need is "IsPlayerInRangeOfPoint". This will determine whether the player(playerid) is near the point, where you want to /enter at. You'll need two different coordinates for this command. You'll need one set of coordinates(coordinates A) which will be where the player(playerid) will use the /enter command. Then, the next set of coordinates(coordinates B) will be where the player(playerid) enters into. Let's use LSPD as an example. LSPD's coordinate A set is "1554.682495,-1675.988403,16.195312" so the IsPlayerInRangeOfPoint would be:

Code:
if(!IsPlayerInRangeOfPoint(playerid,2,1554.682495,-1675.988403,16.195312))
If they are not near LSPD, send them a message...
Code:
return SendClientMessage(playerid,-1,"You are not near LSPD");
If they are near LSPD then they'll enter the building. You'll need to set their position to LSPD's interior(coordinates B).

Code:
SetPlayerPos(playerid, 246.391220,62.97142,1003.640625);
Then, you'll need to set their interior to 6 or they will just fall from the sky, which we don't want.

Code:
SetPlayerInterior(playerid,6);
And finally, you'll want to return a value...
Code:
return 1;
There you go! Just replace the coordinates with your coordinates and you're all good to go! You should have this if you've followed the tutorial properly...

Code:
// If you're making this a seperate filter-script you'll need to define it as so.
// #define filterscript

#include <a_samp>
#include ZCMD
Code:
CMD:enter(playerid, params[])
{
if(!IsPlayerInRangeOfPoint(playerid,2,1554.682495,-1675.988403,16.195312)) return SendClientMessage(playerid,-1,"You are not at the entrance of the Los Santos PD(LSPD)!"; // Or whatever your coordinates A are for.
SetPlayerPos(playerid, 246.391220,62.97142,1003.640625); // Coordinates B
SetPlayerInterior(playerid,6); // The interior of Coordinates B(if a different interior is used, other than 0).
return 1;
}
It's basically the same thing as if you do it without ZCMD, with the exception of a few things. This is what it would be without using ZCMD.

Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/enter", cmdtext, true, 10) == 0)
	{
		if(!IsPlayerInRangeOfPoint(playerid,2,1554.682495,-1675.988403,16.195312)) return SendClientMessage(playerid,-1,"You are not at the entrance of the Los Santos PD(LSPD)!"); // Or whatever your coordinates A are for.
        SetPlayerPos(playerid, 246.391220,62.97142,1003.640625); // Coordinates B
        SetPlayerInterior(playerid,6); // The interior of Coordinates B(if a different interior is used, other than 0).
		return 1;
	}
	return 0;
}
If you do use the code above, you won't need to have #include ZCMD in your script.

If you want to know how you can use pick-ups for the /enter command just comment below.

Thanks and if you want to see how to do something just PM me, or leave a comment below. Thanks guys!
__________________
County Roleplay:
SERVER IP: 176.31.103.65:9560
Website: countyroleplaysamp.tk

----------------------------------------
If I helped you, please give me some REPUTATION so I can continue giving you all some help in pawno scripting. Thanks, and always remember: respect, respect, and respect!
EvanA is offline   Reply With Quote
Old 13/11/2013, 10:49 PM   #2
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,856
Reputation: 1292
Default Re: /enter -- Making a simple enter command.

I'm sick of seeing the IsPlayerInRangeOfPoint() method for this use dynamic areas.
Pottus is offline   Reply With Quote
Old 13/11/2013, 11:07 PM   #3
EvanA
Big Clucker
 
EvanA's Avatar
 
Join Date: Mar 2013
Posts: 151
Reputation: -11
Default Re: /enter -- Making a simple enter command.

Thanks for the feedback/suggestion!
__________________
County Roleplay:
SERVER IP: 176.31.103.65:9560
Website: countyroleplaysamp.tk

----------------------------------------
If I helped you, please give me some REPUTATION so I can continue giving you all some help in pawno scripting. Thanks, and always remember: respect, respect, and respect!
EvanA is offline   Reply With Quote
Old 15/11/2013, 08:15 PM   #4
ReD_DeVi
Banned
 
Join Date: Aug 2012
Location: In Bed Room
Posts: 520
Reputation: 34
Default Re: /enter -- Making a simple enter command.

Good Job..!
ReD_DeVi is offline   Reply With Quote
Old 15/11/2013, 08:22 PM   #5
MBilal
Gangsta
 
MBilal's Avatar
 
Join Date: May 2013
Posts: 812
Reputation: 57
Default Re: /enter -- Making a simple enter command.

Better dude Keep it up
MBilal is offline   Reply With Quote
Old 15/11/2013, 08:35 PM   #6
EvanA
Big Clucker
 
EvanA's Avatar
 
Join Date: Mar 2013
Posts: 151
Reputation: -11
Default Re: /enter -- Making a simple enter command.

Thanks.
__________________
County Roleplay:
SERVER IP: 176.31.103.65:9560
Website: countyroleplaysamp.tk

----------------------------------------
If I helped you, please give me some REPUTATION so I can continue giving you all some help in pawno scripting. Thanks, and always remember: respect, respect, and respect!
EvanA is offline   Reply With Quote
Old 15/11/2013, 08:35 PM   #7
Akira297
Banned
 
Join Date: Jul 2012
Posts: 1,277
Reputation: 183
Default Re: /enter -- Making a simple enter command.

Quote:
Originally Posted by [uL]Pottus View Post
I'm sick of seeing the IsPlayerInRangeOfPoint() method for this use dynamic areas.
I am on the same boat with him. You should think of another effective way of making a /enter command without it.
Akira297 is offline   Reply With Quote
Old 17/11/2013, 04:54 PM   #8
alimash
Big Clucker
 
alimash's Avatar
 
Join Date: Apr 2013
Location: Tehran
Posts: 105
Reputation: 13
Default Re: /enter -- Making a simple enter command.

Thank you for helping me
alimash is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help making enter and exit keys Desi_Dude Scripting Help 12 04/11/2012 08:32 AM
[HELP] Making it /enter joeri55 Help Archive 0 23/05/2011 02:51 PM
Making multiple /enter and /exit commands? Luis- Help Archive 2 22/05/2010 12:35 PM
how to create an /exit and /enter command to enter an costum interior? sandisk125 Help Archive 5 18/08/2009 01:07 PM
Simple /enter command problem Annihalation Help Archive 10 16/07/2009 09:07 AM


All times are GMT. The time now is 09:57 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.