[Tutorial] How to make enter command - Creating Pickups
#1

Hello, there, Today, I am going to show you how to make enter command, with pickup.

So, Lets get started.
At the top of your script, write this:
Code:
#include <a_samp>
Now, the functions you need are:
Code:
IsPlayerInRangeOfPoint(playerid,Float:range, Float:x, Float:y, Float:z);
This line means, Is player in range of the place, you want to place the enter command, Now, to get the cords ( X,Y,Z ), Go to the place that you want to enter, and type /save. After that, Check My Documents\GTA San Andreas User Files\SAMP, Then open "savedpositions"And you will see the cords there

You need also:
Code:
SetPlayerPos(playerid,Float:x,Float:y,Float:z);
This line means, The place you want to go when you press enter, You can get the cords by doing /save..blabla.

Code:
SetPlayerInterior(playerid, InteriorID);
This line means, Change the player's current interior. A list of currently known interiors with their positions can be found on this page. Also, you can get it ingame, by typing "/interior".

Code:
SetPlayerVirtualWorld(playerid, VirtualWorldID);
This line means, Set the virtual world of a player. They can only see other players or vehicles if they are in that same world.

And at the end, you have to:
Code:
return 1;
Now, lets do an example:
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/enter",cmdtext, true, 10) == 0)
	{
	if(IsPlayerInRangeOfPoint(playerid,3.0,681.5620,-474.2185,16.5363))
         SetPlayerPos(playerid, 678.2614,-464.6447,-25.6172);
         SetPlayerInterior(playerid, 1);
         SetPlayerVirtualWorld(playerid, 1);
         return 1;
         }
Now, Creating Pickups.

At the top of your script:
Code:
new pickupname;
Then, write this, under
Code:
public OnGameModeInit()
{
write:
Code:
pickupname = CreatePickup(model, type, Float:X, Float:Y, Float:Z, Virtualworld)
You can get the models here
You can get the type here
You can get the cords (X,Y,Z) by typing /save, blabla.

Example:
Code:
new Mr1337;
Code:
Public OnGameModeInit()
{
      Mr1337 = CreatePickup(1318, 23, 2165.9231,-1671.2072,15.0732,-1);
      return 1;
}
Hope i helped.
Reply
#2

Did you even compiled this
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
      if(IsPlayerInRangeOfPoint(playerid,3.0,681.5620,-474.2185,16.5363))
      {
         SetPlayerPos(playerid, 678.2614,-464.6447,-25.6172);
          { // wha ??
           SetPlayerInterior(playerid, 1);
            { // wha ??
             SetPlayerVirtualWorld(playerid, 1);
             return 1;
             }
Gosh, you put an opening bracket every function.

I don't think so it would work, when I'm in front of the door, I used /help, I'm in the interior.
Reply
#3

Sorry mate, didnt notice, - Fixed -
Reply
#4

This is how I would do the enter cmd.

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/enter", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, 681.5620, -474.2185, 16.5363))
        {
            SetPlayerPos(playerid, 678.2614,-464.6447,-25.6172);
            SetPlayerInterior(playerid, 1);
            SetPlayerVirtualWorld(playerid, 1);
        }
        else
        {
            SendClientMessage(playerid, 0xDEEE20FF, "You are not near an entrance.");
        }
    }
    return 1;
}
Reply
#5

This stinks, why would you need to change your virtual world to enter something anyway?
Reply
#6

Awesome lol
Reply
#7

Really useful, helped me of getting understanding how to do a customized gang HQ's, it's soo easy and thanks for the tutorial, i'll rep you man =)
Reply
#8

Thanks man.
Reply
#9

I really need a scripter HELP ME!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)