Eclipse
January 05, 2009, 11:20:13 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Congratulations Adulese.
Eclipse Desktop Contest
 
   Home   Chat Help Rules Arcade Search Calendar Gallery Login Register  
 
 
 
Recent Topics +-
Count to 1,000,000! by kira423
Today at 11:19:42 PM

Combine Usernames! by kira423
Today at 11:19:05 PM

Last one to post Wins by <insert username here>
Today at 11:18:30 PM

My Custom GUI by kira423
Today at 11:17:31 PM

Eclipse Desktop Contest by Marsh
Today at 11:14:33 PM

Party system : is it possible? by MrMiguu™
Today at 11:13:28 PM

Big city... by <insert username here>
Today at 11:11:49 PM

Necesito mappers y scripter para un proyecto de Zelda de alta calidad by MrMiguu™
Today at 11:11:33 PM

how will the person above die. by kira423
Today at 11:10:42 PM

Lostica [Project Revamp] by MrMiguu™
Today at 11:09:53 PM

Members Online +-
9 Guests, 14 Users
Devogen,
<insert username here>,
Kreator,
kira423,
HawkStorm95,
FS:CG Admin[Shadowwulf],
Baron,
‪‫‬‭‮‪‫Kusy,
Marsh,
Simius Cruentus,
Leaf [zach],
MrMiguu™,
The Roujo,
Karl
Pages: [1]
  Print  
Author Topic: Mod+Admin News Script  (Read 1298 times)
0 Members and 1 Guest are viewing this topic.
Niko
Official Eclipse Nazi Admin
Administrator
Teh Uberleet
*
Offline Offline

Posts: 3,316


Fear me for I have the power of the BAN HAMMER!


View Profile Email
« on: August 01, 2006, 06:44:36 AM »

Yo guys, im just getting into the scripting thing, and i gotta tell ya it unlocks alot of cool features for your games.  alright so imma start posting some of my scripts up see what u guys think. Heres a sceript i made a while ago.. one of my firsts.

You guys know when u loggin it says "welcome to <yourgame>"   Well i made a script for when a person with lvl 1 access or higher loggs in it posts a little news on whats going on development side. Only mods+ can see. To change what the news says, just type in the text, then save the main. The jump over to your server contorl panel and click reload scripts.



Put this under the player join sub... you can edit to your likings, just replace the old welcome script with this.



Script:

Code: [Select]
If GetPlayerAccess(index)>=1 Then
Call PlayerMsg(index, "Welcome Mods & Admins <News>", 4)
Else
Call PlayerMsg (index, "welcome to" & GameName &"!", 15)
End If
Heytherejake
Eclipse Evolution Dev
Active Member
***
Offline Offline

Posts: 426

Currently working on C++ 3D


View Profile WWW Email
« Reply #1 on: August 01, 2006, 06:52:52 AM »

I edited it a bit:

Add this command
Code: [Select]
If LCase(Mid(TextSay, 1, 10)) = "/adminnews" Then
     If GetPlayerAccess => 4
       If Len(TextSay) > 5 Then
           TextSay = Mid(TextSay, 5, Len(TextSay) - 4)          
           Call PUtvar("adminnews.ini", "News", Current, Trim(Textsay))
           Call PlayerMsg(index, "The Admin News has been changed to" & Trim(Textsay), 6)
       End If
      Else
Call PlayerMsg(index, "You are not authorized to use that command!", 4)
End If
       Exit Sub
   End If


And this is the new joingame code
Code: [Select]
If GetPlayerAccess(index)>=1 Then
Call PlayerMsg(index, "Welcome! The Current News is:" & getvar("adminnews.ini", "News", Current), 4)
Else
Call PlayerMsg (index, "welcome to" & GameName &"!", 15)
End If


Tell me if I made a mistake anywhere...
Niko
Official Eclipse Nazi Admin
Administrator
Teh Uberleet
*
Offline Offline

Posts: 3,316


Fear me for I have the power of the BAN HAMMER!


View Profile Email
« Reply #2 on: August 01, 2006, 07:02:10 AM »

Looks good, and im still beginer so.. yeah thnxs

And if u guys didnt no, the sencond scirpt will make a .ini and u type in the admin anf devloper emssage their and it shows up when anyone lvl 1access and above loggs in. So they can be intouch with the latest in development news.
Heytherejake
Eclipse Evolution Dev
Active Member
***
Offline Offline

Posts: 426

Currently working on C++ 3D


View Profile WWW Email
« Reply #3 on: August 01, 2006, 07:03:11 AM »

No problem. I have no clue if its correct, cuz I only started with vars last night...
Niko
Official Eclipse Nazi Admin
Administrator
Teh Uberleet
*
Offline Offline

Posts: 3,316


Fear me for I have the power of the BAN HAMMER!


View Profile Email
« Reply #4 on: August 01, 2006, 07:09:17 AM »

can ya give it a test id love to see if it works, and if it dont we can try to give it a nice de bugging.
Heytherejake
Eclipse Evolution Dev
Active Member
***
Offline Offline

Posts: 426

Currently working on C++ 3D


View Profile WWW Email
« Reply #5 on: August 01, 2006, 07:16:39 AM »

I cant, my computer is being evil and wont load any servers....
The Emblem
Uber Programmer
Emblem
Advanced Member
******
Offline Offline

Posts: 517


The game


View Profile Email
« Reply #6 on: August 01, 2006, 08:09:02 AM »

Quote from: heytherejake
I edited it a bit:

Add this command
Quote
If LCase(Mid(TextSay, 1, 10)) = "/adminnews" Then
     If GetPlayerAccess => 4 Then
       If Len(TextSay) > 11 Then
           TextSay = Mid(TextSay, 11, Len(TextSay) - 10)          
           Call PutVar("adminnews.ini", "News", Current, Trim(Textsay))
           Call PlayerMsg(index, "The Admin News has been changed to: " & Trim(Textsay), 6)
       End If
      Else
   Call PlayerMsg(index, "You are not authorized to use that command!", 4)
   End If
       Exit Sub
   End If


And this is the new joingame code
Quote
If GetPlayerAccess(index)>=1 Then
Call PlayerMsg(index, "Welcome! The Current News is:" & Trim(GetVar("adminnews.ini", "News", Current)), 4)
'Note: I added a trim to the above line to remove any errors, Its not required though
Else
Call PlayerMsg (index, "Welcome to " & GameName &"!", 15)
'ERROR: You didnt define GameName
End If


Tell me if I made a mistake anywhere...


I changed any errors i found in the code above...
I hilighted them in red

Edit: For the record.. its still untested...
Heytherejake
Eclipse Evolution Dev
Active Member
***
Offline Offline

Posts: 426

Currently working on C++ 3D


View Profile WWW Email
« Reply #7 on: August 01, 2006, 08:25:23 AM »

Thanks! I knew I screwed SOMETHING up... And for not defining game name, its earlier on, i should have posted teh whole sub
Heytherejake
Eclipse Evolution Dev
Active Member
***
Offline Offline

Posts: 426

Currently working on C++ 3D


View Profile WWW Email
« Reply #8 on: August 01, 2006, 08:27:47 AM »

Could you explain the numbers for textsay though? I just copied the Bio script for that part...
Brutal - Zeldo
Ex-Eclipse Programmer
Global Moderator
Active Member
*
Offline Offline

Posts: 324

Pie


View Profile Email
« Reply #9 on: August 01, 2006, 08:59:06 AM »

Ok i change it to the format i use :P and fix it emblem u missed an then after the If GetPlayerAccess => 4 Then

Here what i came up with(if i post it it messes up the code for some reason so i uploaded it to a file host i have)

Code Here
The Emblem
Uber Programmer
Emblem
Advanced Member
******
Offline Offline

Posts: 517


The game


View Profile Email
« Reply #10 on: August 01, 2006, 09:37:43 AM »

Ooo good catch brutal :P


The numbers are just.. well.. its hard to explain... it gets the text after the /adminnews
Heytherejake
Eclipse Evolution Dev
Active Member
***
Offline Offline

Posts: 426

Currently working on C++ 3D


View Profile WWW Email
« Reply #11 on: August 01, 2006, 09:42:00 AM »

Is there a tutorial anywhere?
Brutal - Zeldo
Ex-Eclipse Programmer
Global Moderator
Active Member
*
Offline Offline

Posts: 324

Pie


View Profile Email
« Reply #12 on: August 01, 2006, 09:51:55 AM »

Ya right here XD

If LCase(Mid(TextSay, 1, 10)) = "/adminnews" Then
If Len(TextSay) > 11 Then

The 10 is how long the command is (including the /) The first 11 is to make sure they have more than just the command if u still dont understand msn me
Heytherejake
Eclipse Evolution Dev
Active Member
***
Offline Offline

Posts: 426

Currently working on C++ 3D


View Profile WWW Email
« Reply #13 on: August 01, 2006, 09:56:43 AM »

I dont get the eleven, and I dont use msn.. I use aim
Brutal - Zeldo
Ex-Eclipse Programmer
Global Moderator
Active Member
*
Offline Offline

Posts: 324

Pie


View Profile Email
« Reply #14 on: August 02, 2006, 04:22:00 AM »

The 11 is the make sure they have more than /adminnews when they go to use the command
Heytherejake
Eclipse Evolution Dev
Active Member
***
Offline Offline

Posts: 426

Currently working on C++ 3D


View Profile WWW Email
« Reply #15 on: August 02, 2006, 06:05:38 AM »

So if I didnt want to make sure theres more... I would put it as a case? Or make the number the same?
The Emblem
Uber Programmer
Emblem
Advanced Member
******
Offline Offline

Posts: 517


The game


View Profile Email
« Reply #16 on: August 02, 2006, 08:08:57 AM »

Quote
If LCase(Mid(TextSay, 1, 10)) = "/adminnews" Then
'If LowerCase of 10 charactors of TextSay starting at charactor #1 is equal to /adminnews
If Len(TextSay) > 11 Then
'If the length of textsay is Greater than 11 (To make sure they have more than the command)


There ya go, exactly what the code does :P

Edit: If anyone can make this sound better (im confusing myself) then go ahead...
Pages: [1]
  Print  
 
 

Powered by EzPortal
Powered by MySQL Powered by PHP Powered by SMF 2.0 Beta 4 | SMF © 2006–2008, Simple Machines LLC | Sitemap Valid XHTML 1.0! Valid CSS!
Page created in 0.345 seconds with 35 queries.