13.11.2013, 22:24
/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>
Code:
#include ZCMD
Let's start the actual command now...
The first thing you need to do is set-up your command.
Code:
CMD:enter(playerid, params[]) { }
Code:
if(!IsPlayerInRangeOfPoint(playerid,2,1554.682495,-1675.988403,16.195312))
Code:
return SendClientMessage(playerid,-1,"You are not near LSPD");
Code:
SetPlayerPos(playerid, 246.391220,62.97142,1003.640625);
Code:
SetPlayerInterior(playerid,6);
Code:
return 1;
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; }
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 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!