| Author |
Sticky: Post
Working Scripts Here |
| Novanus
|
Posted: Thursday, 27 June 04:28AM |
Script: Give player a "Readme"
This script is designed for multiplayer games. When a new player
connects to your server, they will be given an item describing your
rules or any other special information you want them to have.
To use, simply put the script in the Module's "OnClientEnter" event.
Make a custom item (such as a letter or book) with the TAG that matches
the one in the script (default is "Readme"). Edit the "identified text"
for that item to be the information you want the player to have when
they Examine the item. The script also checks to see if the player
already has the item. If they do, it doesn't give it to them again.
Also included is a support function IsInInventory which returns TRUE or
FALSE, depending on whether it finds the specified item in the inventory
of the supplied PC, NPC, chest, etc.
NWScript:
int IsInInventory(object oContainer, string sItemTag)
{
object oItem;
if (GetHasInventory(oContainer))
{
oItem = GetFirstItemInInventory(oContainer);
while ( OBJECT_INVALID != oItem )
{
if (GetTag(oItem) == sItemTag)
{ return TRUE; }
oItem = GetNextItemInInventory(oContainer);
}
}
return FALSE;
}
void main()
{
object oPC = GetEnteringObject();
if (GetIsPC(oPC))
{
if (IsInInventory(oPC,"Readme") == FALSE)
{
CreateItemOnObject("Readme",oPC);
SendMessageToPC(oPC,"You have been given a letter describing the rules of this server - Please examine it.");
}
}
}
|
|