YSI:Adding Properties

From SA-MP Wiki

Jump to: navigation, search

Contents

Introduction

The YSI property system allows you to create houses, banks, ammunations and more in one or two very simple functions without worrying about how all the checkpoints will show up, or how the accounts, weapons and payments are dealt with.

Properties

Properties are basically houses or businesses you buy and earn money from periodically. To create a property all you need to do is add the following function to Script_OnGameModeInit:

CreateProperty("my house", 100.0, 200.0, 10.0, 100000, 20000);

That will create a property at position 100.0,200.0,10.0 called "my house" which costs $100000 and earns you $20000 every minute. The name is used in the list of properties (which it is added to automatically) and is displayed to people when they enter the checkpoint.

You can do this as many times as you like, adding as many properties as you like (by default the limit is 256).

You can also add an extra parameter on to the end to control how often people earn money from a property, so if you wanted to make that property give it's owner $20000 every 5 minutes (300 seconds, 300000 milliseconds) you would simply do:

CreateProperty("my house", 100.0, 200.0, 10.0, 100000, 20000, 300000);

This will not affect any of the other properties.

Banks

Creating banks is as simple as creating properties, simply do:

CreateBank(200.0, 100.0, 10.0);

That will create a bank marker at the given location from which you can withdraw and deposit money. You can also name the bank but this doesn't really do a lot besides display it's name when you enter the bank:

CreateBank(200.0, 100.0, 10.0, "Bank of San Andreas");

Ammunations

An ammunation marker is a place where you can buy weapons, either for immediate use, for spawning with or both. This is a little bit more complicated than the other property items as you need to define what weapons can be bought from the shop but this isn't overly hard. A basic ammunation would look like:

CreateAmmunation(100.0, 100.0, 10.0, 1, 1);

The first three parameters are obviously where the ammunation is. The fourth parameter is whether or not people get the weapons they buy back when they respawn, if it's 0 they will loose purchased weapons when they die, if it's 1 they will get the weapon and all ammo they buy back. The fifth parameter is whether or not the player gets the weapons they buy straight away. If it's 0 they will need to wait till they respawn to get them (assuming the fourth parameter is 1, if they're both 0 it's a rather pointless ammunation which just charges people but doesn't give them anything).

As it is that line will create an ammunation but will not sell any weapons. To add weapons you need to define the type, cost and ammo you get when you buy it (ammo should always be at least 1 due to bugs in SA with melee weapons):

CreateAmmunation(100.0, 100.0, 10.0, 1, 1
    , WEAPON_BRASSKNUCKLE, 1, 1000
);

That will create an ammunation which sells brassknucles for $1000. The list of weapons can be found in a_samp.inc plus the system has added:

WEAPON_ARMOUR

so you can sell Armour from ammunations. To add more weapons simply add more to the list:

CreateAmmunation(100.0, 100.0, 10.0, 1, 1
    , WEAPON_BRASSKNUCKLE, 1, 1000
    , WEAPON_TEC9, 1000, 10000
    , WEAPON_ARMOUR, 1, 200
);

That will now sell the brassknucles for $1000, a TEC9 with 1000 ammo for $10000 and Armour for $200.

All the selling is handled with menus and if you have more than 12 weapons the system will create multiple pages of weapons for you to browse through. There are 40 weapons to choose from (including armour, camera and parachute "WEAPON_VEHICLE", "WEAPON_DROWN" and "WEAPON_COLLISION" aren't valid weapons and will just be ignored.

Personal tools
Navigation
Toolbox