Programming Interface For DEFCON via PAWN (SmallC)

Ideas for expansions and improvements to Defcon

Moderator: Defcon moderators

Dyflmez
level1
level1
Posts: 10
Joined: Sun Nov 05, 2006 1:42 pm

Programming Interface For DEFCON via PAWN (SmallC)

Postby Dyflmez » Sun Nov 05, 2006 9:26 pm

Things that I would like to see from Introversion.
I've programmed in PAWN for quite some time, but any one can pick it up and make something use full. It's very easy to learn, it's very fast, and it would make an awesome in between langue. potential plugin makers that really don't know all that much about data types, don't need to know it with this, it makes the learning curve very soft. I would be more then happy to help people with starting to program in PAWN. PAWN is free and it is published under the zLib license (this is a liberal license, and it allows using pawn in commercial applications). You guys have got to give this a shot! Come on, ya know ya want to!

  • SmallC plugin interface (Now known as PAWN) for making plugins would be nice.
    • client_connect - When a client connects.
    • client_disconnect - When a client disconnects.
    • client_launches - When a client launches a nuke.
    • client_targets - When a client sets a target (for a silo, a plane (bomber, or fighter) or ship (carrier, or battleship).
    • client_directs - When a client sets a destination (for a plane (bomber or fighter) or ship (carrier, or battleship).
    • client_get_cords - Gets the client's position (X, Y) for everything that is placed.
  • Nukes that can go north a south would be nice.


Code: Select all

#include <defcon>

public plugin_init() {
   register_plugin("Example Plugin","0.1","Dyflmez")
}

client_disconnect(cid) {
   new UName[32]
   UName = get_user_name(cid)
   chat_print(0, "Oh no, we lost %s!", UName)
}

client_connect(cid) {
   new UName[32]
   UName = get_user_name(cid)
   chat_print(0, "Awsome, %s has joined us!", UName)
   chat_print(cid, "Welcome to the server %s.", UName)
}

client_lunches(cid) {
   new UName[32]
   UName = get_user_name(cid)
   chat_print(0, "Ohhhhh shit!\n%s has lunched a nuke!, UName)
}


plugins would be compiled, and then placed into the /DEFCON/plugins dir. From there they would be automatically loaded by DEFCON on startup. From there the pluing takes over and does all of the work that is asked of it. Event handling and what not.
Last edited by Dyflmez on Sun Nov 05, 2006 9:38 pm, edited 1 time in total.
Darksun
level5
level5
Posts: 6461
Joined: Sat Dec 07, 2002 7:08 pm
Location: 127.0.0.1

Re: Programming Interface For DEFCON via PAWN (SmallC)

Postby Darksun » Sun Nov 05, 2006 9:33 pm

Dyflmez wrote:[*]client_lunches - When a client lunches a nuke.


hehe. Lunch a nuke. Tasty!
Dyflmez
level1
level1
Posts: 10
Joined: Sun Nov 05, 2006 1:42 pm

Postby Dyflmez » Sun Nov 05, 2006 9:37 pm

Some sample code, that has nothing to do with DEFCON.
Note that you don't need the ; at the end of every line.
I do most of my programming in PHP, so I'm just used to it, and it's good practice for PHP, C, and C++.

Code: Select all

main() {
   new i, j, k;
   new x, y, z;
   x = 0;
   y = 0;
   z = 0;
   for (i = 0; i < 100; i++) {
      x++;
      for (j = 0; j < 100; j++) {
         y++;
         for (k = 0; k < 100; k++) {
            z++;
         }
      }
   }
   printf("X : %d\nY : %d\nZ : %d\n", x, y, z);
}



[edit]
Darksun wrote:
Dyflmez wrote:[*]client_lunches - When a client lunches a nuke.


hehe. Lunch a nuke. Tasty!


Edited, good spot.[/edit]

Return to “Think Tank”

Who is online

Users browsing this forum: No registered users and 3 guests