[Include] Intel - Call-of-Duty-like Intel searching for your players!
#1

Intel

Overview
This include allows you to set up "intel" points. They're honeypots hidden around the world for players to search for. You can control the rewards of the intel item. The include was, of course, inspired by Call of Duty.

When the script starts, the first intel item is spawned. When a player gets to it and does /claimitem, it is deleted, the player is rewarded, and a new one is spawned. If no one finds it within 5 minutes (configurable), a new one will appear instead. Intel items can be given different levels based on their difficulty to find, and you can use this when working with your rewards!

Demonstration
[ame="http://www.youtube.com/watch?v=XdD1P6uNa70"]Intel Demo[/ame]

Usage
To use this, you first need to download and install YSI. Once you've installed that, download the Intel include from below and place it in your pawno/includes folder. I recommend using the file name "intel.inc". Then, in your gamemode, you'll need to make a few modifications.

In OnGameModeInit, you'll need to add some Intel points. The code to do this is as follows:
pawn Код:
INTEL_AddIntelSpawn(Intel name, Intel X, Intel Y, Intel Z, Angle X, Angle Y, Angle Z, Intel Level);
pawn Код:
INTEL_AddIntelSpawn("Employee names", 1958.4, 1344.2, 15.4, 45.0, 0.0, 0.0, 1);
You can add up to 50 Intel items, by default. If you wish to add more, simply do this (replace 75 with your desired number!):
pawn Код:
#undef MAX_INTEL SPAWNS
#define MAX_INTEL_SPAWNS 75
After adding all your spawns, you'll need to then call INTEL_SpawnNewIntel() in OnGameModeInit.

In order for players to claim Intel items, you need to give them the permission to do so. Execute the code below (I recommend placing it in OnPlayerConnect):
pawn Код:
INTEL_SetClaimPermission(playerid, true);
Lastly, you need the callback for when a player has claimed an Intel item. Copy and paste the code below into your script, playerid is the ID of the player who claimed the intel, name is the name of the intel and level is the level of the intel.
pawn Код:
public INTEL_OnPlayerClaim(playerid, name[], level)
{

}
There's an example script available below!

Customisation
There are a few ways to customise this include to your liking.
As explained above, you can increase the number of possible Intel spawns. Let's change it to 75:
pawn Код:
#undef MAX_INTEL_SPAWNS
#define MAX_INTEL_SPAWNS 75
You can change the object for the Intel (in the demo above, it is an old TV). Let's make it use an NOS tank instead:
pawn Код:
#undef INTEL_OBJECT_ID
#define INTEL_OBJECT_ID 1010
You can change the amount of time it takes for intel to be respawned if no one finds it. By default, it's 5 minutes. Let's make it 10:
pawn Код:
#undef INTEL_REFRESH_RATE
#define INTEL_REFRESH_RATE 10
You can change the distance from which players can claim Intel. By default, it's a 5 metre range. Let's make it 15:
pawn Код:
#undef INTEL_CLAIM_RANGE
#define INTEL_CLAIM_RANGE 15
You can change the message colour, however this involves two edits. To change it from 5CD147 to FF0000, you'd need to do this:
pawn Код:
#undef INTEL_MESSAGE_COLOR
#undef INTEL_MESSAGE_COLOR_EMBED
#define INTEL_MESSAGE_COLOR 0xFF0000FF
#define INTEL_MESSAGE_COLOR_EMBED "FF0000"
To customise the rewards, simply place your own code into the callback!

I will attempt to provide support for this script however I cannot guarantee it. The script is released under the MIT license so you are free to do as you please with it - if anyone makes a significant improvement/modification to the script then I will incorporate that into the original, with their permission.
Reply
#2

Nice & simple.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)