Thread: Making a code work PI

Results 1 to 2 of 2
  1. #1 Making a code work PI 
    Registered Member
    Join Date
    Jun 2012
    Posts
    121
    Thanks given
    2
    Thanks received
    1
    Rep Power
    12
    Basically i have tried so many times to get this to work ....



    Basically what i want to do is, Instead of having 1 code for each npc, i want all npc's to be in one code

    EG

    Instead of this, where each npc has its own code! I want it to be like, Every npc that give's 1 point, is in this code!

    Code:
    if (npcs[i].npcType == 1265) {
    					    c.randomPoints += 1;
    					    c.sendMessage("You have been awarded [<col=990000>1</col>] NPC point!");
    if (npcs[i].npcType == 9999) {
    					    c.randomPoints += 1;
    					    c.sendMessage("You have been awarded [<col=990000>1</col>] NPC point!");
    if (npcs[i].npcType == 1010) {
    					    c.randomPoints += 1;
    					    c.sendMessage("You have been awarded [<col=990000>1</col>] NPC point!");
    					
    					}





    Tried this, and only the first npc gives the NPC point and send's that message, the other 2 npc's listed dont!
    Code:
    if (c != null) {
    						int[] NpcMonstersPointsSystem = { 1265, 1678, 117};
    						for (int j : NpcMonstersPointsSystem) {
    							if (npcs[i].npcType == j) {
    									c.randomPoints += 1;
    									c.sendMessage("You Have Been Awarded [<col=990000>1</col>]Npc Point!");
    							
    							}

    Then i tried this, with the || and it still did the same thing, only first one give's the points and sends the message

    Code:
    if (npcs[i].npcType == 1265 || npcs[i].npcType == 1678 || npcs[i].npcType == 117) {
    					    c.randomPoints += 1;
    					    c.sendMessage("You have been awarded [<col=990000>1</col>] NPC point!");
    }
    Then i tried it with &&, and it still didnt work, same thing, first npc gave poiints and sent message the rest didnt!...



    Code:
    if (npcs[i].npcType == 1265 && npcs[i].npcType == 1678 && npcs[i].npcType == 117) {
    					    c.randomPoints += 1;
    					    c.sendMessage("You have been awarded [<col=990000>1</col>] NPC point!");
    					
    					}
    Reply With Quote  
     

  2. #2  

    Supreme's Avatar
    Join Date
    May 2011
    Posts
    769
    Thanks given
    454
    Thanks received
    270
    Rep Power
    3494
    Code:
    if (npcs[i].npcType == 131 || npcs[i].npcType == 1265 || npcs[i].npcType == 2885 ||  npcs[i].npcType == 140) {
    					c.npcPoints += 1;
    					c.sendMessage("You recieve 1 npc point. You now have <col=255>" +c.npcPoints+ "</col> Npc points ");
    					}
    Try this just change the npc ids.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [PI]How do the DSPK Client color codes work?[PI[
    By pistolpete332 in forum Help
    Replies: 1
    Last Post: 04-21-2011, 05:04 AM
  2. Replies: 6
    Last Post: 01-08-2011, 08:07 PM
  3. Replies: 9
    Last Post: 12-12-2010, 05:05 AM
  4. Making Ladders work [PI] Easy to follow.
    By Treq in forum Tutorials
    Replies: 17
    Last Post: 10-15-2010, 04:31 AM
  5. How would i make this code work
    By Demon in forum Help
    Replies: 4
    Last Post: 10-31-2009, 02:03 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •