This is a little script ive been working on, not much... Also, not completed yet so expect updates but this system allows you to create weapons to fight with people! It works with melee atm.
But you will have to script the hurting etc.
Here ya go
Weapon Creation Code:
PHP Code:
function onActionServerSide()
{
if (params[0] == "Generate")
{
echo("[ITEM GENERATOR]: "@params[5]@" Created "@params[1]@" Which Does "@params[2]@" Damage, Gani = "@params[3]@"!");
findplayer(params[5]).clientr.weps.add(params[1]);
savelog2("logs/Items",params[5]@" Created "@params[1]@" That does "@params[2]@" Damage, with the Gani "@params[3]@" and a freeze of "@params[4]@"!");
ItemDB.GenerateItem(params[1], params[2], params[3], params[4], params[5]);
}
}
//#CLIENTSIDE
function onPlayerChats()
{
if (player.chat == "/items")
{
openGenerator();
player.chat = "";
}
}
function openGenerator() {
new GuiWindowCtrl("Generator_Window1") {
profile = GuiBlueWindowProfile;
clientrelative = true;
clientextent = "320,130";
canmove = true;
canresize = false;
closequery = false;
canmaximize = false;
canminimize = false;
destroyonhide = false;
text = "Item Generator";
x = mousescreenx;
y = mousescreeny;
new GuiTextEditCtrl("Generator_TextEdit1") {
profile = GuiBlueTextEditProfile;
height = 20;
width = 80;
x = 18;
y = 19;
}
new GuiTextCtrl("Generator_Text1") {
profile = GuiBlueTextProfile;
height = 20;
text = "Name";
width = 27;
x = 42;
y = 35;
}
new GuiTextEditCtrl("Generator_TextEdit2") {
profile = GuiBlueTextEditProfile;
height = 20;
width = 80;
x = 115;
y = 19;
}
new GuiTextCtrl("Generator_Text2") {
profile = GuiBlueTextProfile;
height = 20;
text = "Damage";
width = 39;
x = 135;
y = 34;
}
new GuiTextEditCtrl("Generator_TextEdit3") {
profile = GuiBlueTextEditProfile;
height = 20;
width = 80;
x = 216;
y = 20;
}
new GuiTextEditCtrl("Generator_TextEdit4") {
profile = GuiBlueTextEditProfile;
height = 20;
width = 80;
x = 19;
y = 55;
}
new GuiTextCtrl("Generator_Text4") {
profile = GuiBlueTextProfile;
height = 20;
text = "Freeze Time";
width = 100;
x = 28;
y = 75;
}
new GuiTextCtrl("Generator_Text3") {
profile = GuiBlueTextProfile;
height = 20;
text = "Gani (without .gani)";
width = 100;
x = 210;
y = 35;
}
new GuiButtonCtrl("Generator_Button1") {
profile = GuiBlueButtonProfile;
height = 34;
text = "Generate Weapon";
width = 320;
y = 96;
}
Generator_Window1.show();
}
}
function Generator_Button1.onAction() {
temp.w_name = Generator_TextEdit1.getText();
temp.dmg = Generator_TextEdit2.getText();
temp.gani = Generator_TextEdit3.getText();
temp.freeze = Generator_TextEdit4.getText();
triggerserver("gui",this.name,"Generate",temp.w_name,temp.dmg,temp.gani,temp.freeze,player.account);
Generator_Window1.hide();
player.chat = "Generated "@temp.w_name@"!";
}
Weapon Inventory:
PHP Code:
join("object_inventory");
function onActionServerSide()
{
if (params[0] == "Equip")
{
clientr.equipped = params[1];
}
if (params[0] == "getStats")
{
temp.freeze = ItemDB.("Item_"@params[1]@"_Freeze");
temp.ani = ItemDB.("Item_"@params[1]@"_Gani");
temp.damage = ItemDB.("Item_"@params[1]@"_Damage");
triggerclient("gui",this.name,"getStats",temp.ani,temp.damage,temp.freeze);
}
}
//#CLIENTSIDE
function onCreated()
{
setTimer(.005, 1);
}
function onTimeOut(time, id)
{
selectedweapon = NULL;
setTimer(.005);
player.chat = "Time: "@params[0]@" ID: "@id;
}
function onKeyPressed(code, key, scancode)
{
if (key == "q")
{
if (this.open == false)
{
temp.wep = getItems();
onOpenInv(temp.wep);
Inventory_Window.show();
this.open = true;
}
else
{
this.open = false;
Inventory_Window.hide();
}
}
if (key == "d")
{
if (findweapon("Test"))
{
player.chat = "!!! WEAPONS WORK !!!";
player.clientr.equipped.trigger( "onWeaponFired", "" );
}
else
{
triggerserver("gui",this.name,"getStats",clientr.equipped);
temp.ani = ItemDB.("Item_"@item@"_Gani");
setAni(this.gani,NULL);
UseItem(clientr.equipped);
triggeraction(player.x + 1.5 + vecx(player.dir) * 2, player.y + 2 + vecy(player.dir) * 2, "melee",player.account,this.dmg);
freezeplayer(this.freeze);
}
}
}
function onOpenInv(items) {
new GuiWindowCtrl("Inventory_Window") {
profile = GuiBlueWindowProfile;
clientrelative = true;
clientextent = "320,300";
canmove = true;
canresize = false;
canclose = false;
canminimize = false;
canmaximize = false;
closequery = false;
destroyonhide = false;
text = "Inventory";
x = 509;
y = 203;
new GuiButtonCtrl("Inventory_Button1") {
profile = GuiBlueButtonProfile;
text = "Close";
width = 320;
y = 270;
}
new GuiButtonCtrl("Inventory_Button2") {
profile = GuiBlueButtonProfile;
height = 31;
text = "Equip Item";
width = 320;
y = 209;
}
new GuiButtonCtrl("Inventory_Button3") {
profile = GuiBlueButtonProfile;
text = "Drop Item";
width = 320;
y = 240;
}
new GuiScrollCtrl("Inventory_TextList_Scroll") {
profile = GuiBlueScrollProfile;
height = 155;
hscrollbar = "alwaysOff";
vscrollbar = "dynamic";
width = 320;
x = 0;
y = 0;
new GuiTextListCtrl("Inventory_TextList") {
profile = GuiBlueTextListProfile;
height = 135;
horizsizing = "width";
width = 295;
clearrows();
for (temp.i = 0; temp.i < clientr.weps.size(); temp.i ++)
{
addrow(temp.i, clientr.weps[(@temp.i)]);
}
for (temp.e = 0; temp.e < player.weapons.size(); temp.e ++)
{
if (!(player.weapons[(@temp.e)].name.starts("-")))
{
addrow(temp.i + temp.e, player.weapons[(@temp.e)].name);
}
}
}
}
Inventory_Window.show();
}
}
function getItems()
{
for (clientr.weps : temp.weps)
{
return temp.weps;
}
}
function Inventory_Button1.onAction() {
// Button "Close" has been pressed
}
function Inventory_Button2.onAction() {
temp.item = Inventory_TextList.getSelectedText();
triggerserver("gui",this.name,"Equip",temp.item);
}
function Inventory_Button3.onAction() {
// Button "Drop Item" has been pressed
}
function onActionClientSide()
{
if (params[0] == "getStats")
{
this.gani = params[1];
this.dmg = params[2];
this.freeze = params[3];
}
}
Class object_inventory:
PHP Code:
public function UseItem(item)
{
temp.gani = ItemDB.("Item_"@item@"_Gani");
setAni(temp.gani,NULL);
temp.dmg = ItemDB.("Item_"@item@"_Damage");
triggeraction(player.x + 1.5 + vecx(player.dir) * 2, player.y + 2 + vecy(player.dir) * 2, "melee",player.account,item,temp.dmg);
}
HAVE FUN!!!
O, Say /items to open the generator =D!