LegitPrayer
Owner
Posts : 32 Join date : 2010-04-22 Age : 31 Location : Del City,OK
| Subject: coding a 317(for the danzor) Sun Apr 25, 2010 10:08 pm | |
| first off you need to know the basics
* Autospawn * Creating an Object * Shops * Commands now, for autospawn all you do is go to autospawn.cfg you will see like "spawn = 1158 3483 9493 0 0 0 0 0 1"now this is what all this @!$# is lol "spawn = (NPC ID) (COORDx) (COORDy) 0 0 0 0 0 1"on the "0 0 0 0 0 1" just leave that how it is. now for an NPC list CLICK HERE.
ok now that you have got the NPC list go onto your game(client) and get the coords you want the NPC to spawn on(to get the coords type ::mypos)
well thats all for autospawn! on to creating an object!Ok, so to create an object! firstly, go to client.java then hit CTRL+F then type in makeGlobalObject keep clicking find next untill you see something like this makeGlobalObject(3215, 3477, 2213, 0, 10);ok so this is what this is makeGlobalObject(OBJECT ID), (COORDx), (COORDy), (way the object faces), 10); now just leave the 10 alone no need to change that once you added that just save, compile and your done.now! on to shops!ok, now for shops this is what you do!firstly, go to client.java and hit CTRL+F then type in wanneshop and click find next untill you see something like this else if (NPCID == 944) { PutNPCCoords = true; WanneShop = 42;
now, don't change anything but the "944" to what NPC you want the shop to be also the NPC MUST! be added to your autospawn list before doing this. you also need to change the "42" to a none used wanneshop number for example my wanneshop on my 317 ends at WanneShop = 58; so i change that 58 to 59.
next, save that and close it, go to shops.cfg then you will see like shop = 31 2 2 10090 100 10091 100 10092 100 10093 100 10094 100 10095 100 10096 100 10097 10098 10144 100 10143 100 10145 100 10146 100 10147 100 10148 100 ok so this is what that is "shop = 31" is the shop ID the 31 is not the NPCS ID so change 31 to the none used number for example mine is "shop = 70" so I would change that to "shop = 71" for a new shop. and the "100's" are the amount, the 10090 10091 10092 and stuff are the Items ID the 2 and 2 are the abilitys to sell items and buy or buy items only. 2 is buy items only 1 is buy and sell items. ok so now your done with shops. last one!! woot easiest one! commandzors!ok so now for the last one, commands.
ok so go to client.java hit CTRL+F again and type in "home" you should see } else if (command.equalsIgnoreCase("home")) { if (teleblock == true) { sendMessage("A magical force stops you from teleporting."); } else { teleportToX = 3212; teleportToY = 3466; sendMessage("You Teleport Home."); }
now what you do is copy and paste that for a teleporting command and under the bracket(}) paste it, now change the "3212" and "3466" to the coords you want the command to teleport you to. also change where it says "home" to like "barrows" or w/e you want the command to be, and change the "you teleport home" to the message it sends OFC.
now that you know how to make a teleporting command time for rights commands
copy and paste this to your client.java if you dont already have it but paste it under a command thats already there =P - Code:
-
} else if (command.startsWith("givemod") && playerRights >= 3) { String name = command.substring(8);
try { int p = PlayerHandler.getPlayerID(name); client c = (client) server.playerHandler.players[p];
c.playerRights = 1; c.savemoreinfo(); c.savechar(); c.disconnected = true; PlayerHandler.messageToAll = (name + " is now a Moderator"); } catch (Exception e) { sendMessage(name + " either isn't online or doesn't exist"); }
and this for admin - Code:
-
} if (command.startsWith("giveadmin") && playerRights >= 3) { String name = command.substring(10);
try { int p = PlayerHandler.getPlayerID(name); client c = (client) server.playerHandler.players[p];
c.playerRights = 2; c.savemoreinfo(); c.savechar(); c.disconnected = true; PlayerHandler.messageToAll = (name + " is now an Administrator"); } catch (Exception e) { sendMessage(name + " either isn't online or doesn't exist"); } this for demoting people - Code:
-
} else if (command.startsWith("demote") && playerRights >= 3) { String name = command.substring(7);
try { int p = PlayerHandler.getPlayerID(name); client c = (client) server.playerHandler.players[p];
c.playerRights = 0; c.savemoreinfo(); c.savechar(); c.disconnected = true; PlayerHandler.messageToAll = (name + " is no longer a member of staff"); } catch (Exception e) { sendMessage(name + " either isn't online or doesn't exist"); } and for item commands! ::pickup is already added to every 317 but if it isn't heres the code - Code:
-
else if (command.startsWith("pickup") && (playerRights >= 2)) { try { int newItemID = Integer.parseInt(command.substring(7, 12)); int newItemAmount = Integer.parseInt(command.substring(13)); if (newItemID <= 30000 && newItemID >= 0) { addItem(newItemID, newItemAmount); } else { sendMessage("That item doesn't exist!"); } } catch (Exception e) { sendMessage("You used the command wrong; use 5 digits. ::item 00995 1"); } for max money command - Code:
-
if (command.startsWith("money") && playerRights >= 3) { addItem(995, 2147000000); } ok so thats all for now! if you have anyone questions post a reply on this topic! | |
|