SA-MP Forums Archive
[FilterScript] h_inteirors: AddInterior () & RemoveInterior () - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] h_inteirors: AddInterior () & RemoveInterior () (/showthread.php?tid=273147)



h_inteirors 1.1 - perfekt for own house system! - [LoD]Hauke - 31.07.2011

Good afternoon,
iґve made a fast method to create enterable interiors with use of pickups.
Its a filterscript with an include for gamemodes an other filterscripts.

Included functions:
pawn Код:
AddInterior ( iM[ ] , iVW , iI , Float:iX , Float:iY , Float:iZ , Float:iA , iPT , iPM , iG , iAK , oM[ ] , oVW , oI , Float:oX , Float:oY , Float:oZ , Float:oA , oPT , oPM , oG , oAK )
RemoveInterior ( interior )
On first look, may it's incredible confused, but it isnґt! Itґs much simplier than creating pickup for pickup.

Function description:
AddInterior ( ... )
iM: . . . . . . . . Message to show for player while entering interior. Itґs a textdraw.
iVW: . . . . . . . VirtualWorld of Interior. So youґre able to use interiors more than one time
iI: . . . . . . . . . InteriorID of interior.
iX: . . . . . . . . . X position of entrance-pickup. And itґs the exit X coordinate.
iY: . . . . . . . . . Y position of entrance-pickup. And itґs the exit Y coordinate.
iZ: . . . . . . . . . Zposition of entrance-pickup. And itґs the exit Z coordinate.
iA: . . . . . . . . . FacingAngle for player at exit point
iPT: . . . . . . . . .The pickuptype of enter pickup. Normally itґs set to NULL, but you can change if you want.
iPM: . . . . . . . . .The pickupmodel from enter pickup. Normally its set to NULL, but you can change if you want.
iG: . . . . . . . . . .The gametextstyle from entrance. Normally its set to NULL, but you can change if you want.
iAK: . . . . . . . . .If you want players to use the ENTER key to enter interior too, set to YES, else set to NO.
oM: . . . . . . . . .Message to show for player while leaving interior. Itґs a textdraw too.
oVW: . . . . . . . .The virtualworld of exit position. Normally 0, but youґre able to change.
oI: . . . . . . . . . .InteriorID of exit position.
oX: . . . . . . . . . X position of exit-pickup. And itґs the entrace X coordinate.
oY: . . . . . . . . . Y position of exit-pickup. And itґs the entrace Y coordinate.
oZ: . . . . . . . . . Z position of exit-pickup. And itґs the entrace Z coordinate.
oA: . . . . . . . . . FacingAngle at entering interior.
oPT: . . . . . . . . .The pickuptype of exit pickup. Normally itґs set to NULL, but you can change if you want.
oPM: . . . . . . . . .The pickupmodel from exit pickup. Normally its set to NULL, but you can change if you want.
oG: . . . . . . . . . The gametextstyle from exit. Normally its set to NULL, but you can change if you want.
oAK: . . . . . . . . .If you want players to use the ENTER key to leave interior too, set to YES, else set to NO.

This function returs the id of new interior. If interior could not created it returns -1.

RemoveInterior ( ... )
interior: . . . . . . . . . Id of interior that should be deleted.

Returns true if interior was deleted, and false if interior does not exist.

Included callbacks:
pawn Код:
OnPlayerEnterInterior ( playerid , interior , method )
OnPlayerLeaveInterior ( playerid , interior , method )
OnPlayerEnteredInterior ( playerid , interior , method )
OnPlayerLeavedInterior ( playerid , interior , method )
Callback description:
OnPlayerEnterInterior
Will be called if the player tries to get into an interior. method is the way of it ( METHOD_KEY = by pressing enter & METHOD_PICKUP = by picking up pickup)
OnPlayerLeaveInterior
Will be called if the player tries to get out of an interior. method is the way of it ( METHOD_KEY = by pressing enter & METHOD_PICKUP = by picking up pickup)
OnPlayerEnteredInterior
Will be called if the player got into an interior. method is the way of it ( METHOD_KEY = by pressing enter & METHOD_PICKUP = by picking up pickup)
OnPlayerLeavedInterior
Will be called if the player out of an interior. method is the way of it ( METHOD_KEY = by pressing enter & METHOD_PICKUP = by picking up pickup)

Exaple code:
Here you will se how easy it is to use!
pawn Код:
#include <a_samp>
#include <h_interiors>

new AdminHouse;

public OnGameModeInit()
{
    AdminHouse = AddInterior ( "Welcome Admin!" , NULL , 0 , 1953.704956 , 1342.881958 , 15.374607 , 86.697219 , NULL , NULL , NULL , YES , "byee" , NULL , 3 , 235.407196 , 1187.490844 , 1080.257812 , 83.480270 , NULL , NULL , NULL , YES );
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if ( !strcmp ( "/remove house" , cmdtext ) )
    {
        RemoveInterior ( AdminHouse);
        return 1;
    }

    if ( !strcmp ( "/addhouse",cmdtext))
    {
        AdminHouse = AddInterior ( "Welcome home!" , NULL , 0 , 1953.704956 , 1342.881958 , 15.374607 , 86.697219 , NULL , NULL , NULL , YES , "byee" , NULL , 3 , 235.407196 , 1187.490844 , 1080.257812 , 83.480270 , NULL , NULL , NULL , YES );
        return 1;
    }
    return 0;
}

public OnPlayerEnterInterior(playerid ,interior ,method)
{
    if ( interior == AdminHouse && !IsPlayerAdmin ( playerid )
    {
        SendClientMessage(playerid,0x666666AA,"This House can only accessed by admins!");
        return 0;
    }
    return 1;
}

public OnPlayerEnteredInterior(playerid ,interior ,method)
{
    new string[ 128 ] , name[ MAX_PLAYER_NAME ] , Method[ 32 ];
    GetPlayerName ( playerid , name , MAX_PLAYER_NAME );
    if ( method == METHOD_KEY )
        format ( Method , 32 , "pressing ENTER key" );
    else
        format ( Method , 32 , "picking up pickup" );
    format ( string , 128 , "Player: %s entered interior: %d by %s" , name , interior , Method );
    SendClientMessage ( playerid , 0x666666AA , string );
    return 1;
}

public OnPlayerLeaveInterior(playerid, interior, method)
{
    return 1;
}

public OnPlayerLeavedInterior(playerid, interior, method)
{
    new string[ 128 ] , name[ MAX_PLAYER_NAME ] , Method[ 32 ];
    GetPlayerName ( playerid , name , MAX_PLAYER_NAME );
    if ( method == METHOD_KEY )
        format ( Method , 32 , "pressing ENTER key" );
    else
        format ( Method , 32 , "picking up pickup" );
    format ( string , 128 , "Player: %s leaved interior: %d by %s" , name , interior , Method );
    SendClientMessage ( playerid , 0x666666AA , string );
    return 1;
}
Optional - AddInteriors generator:
Iґve coded a very simple generator for the AddInterior function. With it you can generate ingame you command with all parameters. It is stored in an .adi file in /scriptfiles
Commands are (you must be logged in as rcon admin!):
Код:
#help
#new
#setenter
#setexit
#spp
Here is a video of it:
[ame]http://www.youtube.com/watch?v=ShcRGbwk20c&feature=channel_video_title[/ame]


Update to 1.1:
Now there are 4 new callbacks, that can be used to easy create an own house system!
Until now you must copy these lines into your code:
pawn Код:
public OnPlayerEnterInterior(playerid ,interior ,method)
{
    return 1;
}

public OnPlayerEnteredInterior(playerid ,interior ,method)
{
    return 1;
}

public OnPlayerLeaveInterior(playerid, interior, method)
{
    return 1;
}

public OnPlayerLeavedInterior(playerid, interior, method)
{
    return 1;
}
It would be very nice, if someone can make a tutorial how to make a house system with this.


Download:
Ohne AddInterior generator 1.1
Ohne AddInterior generator 1.1 - Pastebin
Mit AddInterior generator 1.1
Mit AddInterior generator 1.1 - Pastebin


i hope you find use for it!

greetings from germany - Hauke


Re: h_inteirors: AddInterior () & RemoveInterior () - TheArcher - 31.07.2011

Genial.Whoas


Re: h_inteirors: AddInterior () & RemoveInterior () - [LoD]Hauke - 31.07.2011

Thanks


Re: h_inteirors: AddInterior () & RemoveInterior () - Tigerkiller - 31.07.2011

good job
10/10


AW: h_inteirors: AddInterior () & RemoveInterior () - Pablo Borsellino - 31.07.2011

Good Job Hauke, my assessment is in the German Forum.


Re: h_inteirors: AddInterior () & RemoveInterior () - [LoD]Hauke - 31.07.2011

Thanks, now i released 1.1. Some users of the german forum wanted some callbacks. Now i added 4! From now on its very easy to create your own housesystem with it. Maybe someone will make a tutorial


Re: h_inteirors: AddInterior () & RemoveInterior () - xLewisx - 31.07.2011

I'm liking this. Great job.


Re: h_inteirors: AddInterior () & RemoveInterior () - TheArcher - 31.07.2011

You should add some natives like SetPrice, Buying, Selling etc.


Re: h_inteirors: AddInterior () & RemoveInterior () - [LoD]Hauke - 31.07.2011

Thanks for feedback!
@Anthony_prince: Yes, thats may an idea. But thats not what i wanted to make. I only wanted to make some usefull sa:mp functions, that help you to create enterable Interiors. With this script you can make an dynamic house system very fast and easy. I think i make a tutorial for it soon...


Re: h_inteirors: AddInterior () & RemoveInterior () - TheArcher - 01.08.2011

Quote:
Originally Posted by [LoD]Hauke
Посмотреть сообщение
Thanks for feedback!
@Anthony_prince: Yes, thats may an idea. But thats not what i wanted to make. I only wanted to make some usefull sa:mp functions, that help you to create enterable Interiors. With this script you can make an dynamic house system very fast and easy. I think i make a tutorial for it soon...
Understood. It could be used for bussiness too


Re: h_inteirors: AddInterior () & RemoveInterior () - [LoD]Hauke - 02.08.2011

Yes, there are many ways to use.

Edit: Has someone already used this?