SA-MP Forums Archive
[Tutorial] How to make enter command - Creating Pickups - 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: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to make enter command - Creating Pickups (/showthread.php?tid=274796)



How to make enter command - Creating Pickups - Mr.1337 - 07.08.2011

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.



Re: How to make enter command - Creating Pickups - Basicz - 07.08.2011

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.


Re: How to make enter command - Creating Pickups - Mr.1337 - 07.08.2011

Sorry mate, didnt notice, - Fixed -


Re: How to make enter command - Creating Pickups - VitalRP - 07.08.2011

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;
}



Re: How to make enter command - Creating Pickups - Elorreli - 07.08.2011

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


Re: How to make enter command - Creating Pickups - Ehab1911 - 17.08.2011

Awesome lol


Re: How to make enter command - Creating Pickups - MrRollexo - 09.12.2011

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 =)


Re: How to make enter command - Creating Pickups - Mr.1337 - 12.12.2011

Thanks man.


Re: How to make enter command - Creating Pickups - navroopsingh - 30.12.2012

I really need a scripter HELP ME!