Eclipse
January 05, 2009, 11:16:14 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 +-
My Custom GUI by <insert username here>
Today at 11:15:54 PM

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

Combine Usernames! by <insert username here>
Today at 11:14:21 PM

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

Count to 1,000,000! by <insert username here>
Today at 11:13:09 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

I need a little help by The Roujo
Today at 11:07:41 PM

Members Online +-
8 Guests, 14 Users
FS:CG Admin[Shadowwulf],
HawkStorm95,
<insert username here>,
Baron,
‪‫‬‭‮‪‫Kusy,
Marsh,
kira423,
Simius Cruentus,
Leaf [zach],
MrMiguu™,
Kreator,
The Roujo,
Karl,
Nospheratus
Pages: [1] 2
  Print  
Author Topic: CTF Script  (Read 2695 times)
0 Members and 1 Guest are viewing this topic.
Brutal - Zeldo
Ex-Eclipse Programmer
Global Moderator
Active Member
*
Offline Offline

Posts: 324

Pie


View Profile Email
« on: July 13, 2006, 07:55:57 PM »

Ok i got a request for this in my request topic so i made it...
Difficulty unknown/5 lol yep i dont know again

Ok First Place This At the bottom of your main.txt

Code: [Select]
Sub when_you_die_for_ctf(index)
If GetVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "playing") = 1 Then
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "playing", 0)
If GetVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "has_flag") = 1 Then
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "has_flag", 0)
If GetVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "color") = 1 Then
Call PutVar("CTF.ini " , "CTF", "blue_captured", 0)
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "color", 0)
Call PlayerMsg(index, "You had the Blue flag when you died... You Have Been Removed From the game. Good Luck Next Time", 2)
ElseIf GetVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "color") = 2 Then
Call PutVar("CTF.ini " , "CTF", "red_captured", 0)
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "color", 0)
Call PlayerMsg(index, "You had the Red flag when you died... You Have Been Removed From the game. Good Luck Next Time", 2)
End If
ElseIf GetVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "has_flag") = 0 Then
Call PlayerMsg(index, "You Didnt have the flag when you died... You Have Been Removed From the game.", 2)
End If
Else
Call PlayerMsg(index, "I see you have once played Capture The Flag Come Play Again!", 2)
End If
End Sub

'******************************************
Sub start_C_T_F_red(index)'***************
'By Brutal <-- (must stay if code edited)**
'******************************************
On Error Resume next
Dim playing_red
Dim players_playing_red
Dim color_red
Dim amount_needed_red
Dim red_start_map
Dim red_start_y
Dim red_start_x
Dim red_ban
Dim red_game

red_start_map = GetVar("CTF.ini ", "CTF", "red_start_map")
red_start_x = GetVar("CTF.ini ", "CTF", "red_start_x")
red_start_y = GetVar("CTF.ini ", "CTF", "red_start_y")
red_ban = GetVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "banned")

playing_red = GetVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "playing")
color_red = GetVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "color")
players_playing_red = GetVar("CTF.ini ", "CTF", "playersplayingred")
amount_needed_red = GetVar("CTF.ini ", "CTF", "amountofplayersneededforred")
red_game = GetVar("CTF.ini ", "CTF", "gamegoing")
if red_game = 0 Then
If red_ban = 0 Then
If playing_red = 0 Then
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "playing", Int(1))
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "has_flag", 0)
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "color", 2)
If players_playing_red = 0 Then
players_playing_red = 1
Call PutVar("CTF.ini " , "CTF", "playersplaying", Int(players_playing_red))
Call MapMsg(GetPlayerMap(index), "There is now " & players_playing_red & " Player and you need " & amount_needed_red & " Players to start the game once there is enough players please step on the portal again to start the game!!!", 6)
ElseIf players_playing_red > 0 Then
Call PutVar("CTF.ini " , "CTF", "playersplaying", players_playing_red+1)
Call MapMsg(GetPlayerMap(index), "There is now " & players_playing_red+1 & " Players and you need " & amount_needed_red & " Players to start the game once there is enough players please step on the portal again to start the game!!!", 6)
End If
ElseIf playing_red > 0 Then
If color_red = 1 Then
If players_playing_red = amount_needed_red Then
Call PlayerWarp(index, red_start_map, red_start_x, red_start_y)
Call PutVar("CTF.ini " , "CTF", "gamegoing", 1)
Else
If color_red = 2 Then
Call PlayerMsg(index, "You Are Already Waiting for a game to start. you are the color Red going for the Blue flag", 2)
Else
Call PlayerMsg(index, "You Are Already Waiting for a game to start. you are the color Blue going for the Red flag", 2)
End If
End If
Else
Call PlayerMsg(index, "Get On your own portal!!!!", 2)
End If
End If
ElseIf red_ban = 1 Then
Call PlayerMsg(index, "you have been banned do not return here until a mod unbans you...", 2)
End If
ElseIf red_game = 1 Then
Call PlayerMsg(index, "Sorry there is already a game going", 2)
End If

End Sub


'******************************************
Sub start_C_T_F_blue(index)'***************
'By Brutal <-- (must stay if code edited)**
'******************************************
On Error Resume next
Dim playing_blue
Dim players_playing_blue
Dim color_blue
Dim amount_needed
Dim blue_start_map
Dim blue_start_y
Dim blue_start_x
Dim blue_ban

blue_start_map = GetVar("CTF.ini ", "CTF", "blue_start_map")
blue_start_x = GetVar("CTF.ini ", "CTF", "blue_start_x")
blue_start_y = GetVar("CTF.ini ", "CTF", "blue_start_y")
blue_ban = GetVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "banned")

playing_blue = GetVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "playing")
color_blue = GetVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "color")
players_playing_blue = GetVar("CTF.ini ", "CTF", "playersplaying")
amount_needed = GetVar("CTF.ini ", "CTF", "amountofplayersneeded")
blue_game = GetVar("CTF.ini ", "CTF", "gamegoing")


if blue_game = 0 Then
 If blue_ban = 0 Then

If playing_blue = 0 Then
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "playing", Int(1))
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "has_flag", 0)
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "color", 2)
If players_playing_blue = 0 Then
players_playing_blue = 1
Call PutVar("CTF.ini " , "CTF", "playersplaying", Int(players_playing_blue))
Call MapMsg(GetPlayerMap(index), "There is now " & players_playing_blue & " Player and you need " & amount_needed & " Players to start the game once there is enough players please step on the portal again to start the game!!!", 6)
ElseIf players_playing_blue > 0 Then
Call PutVar("CTF.ini " , "CTF", "playersplaying", players_playing_blue+1)
Call MapMsg(GetPlayerMap(index), "There is now " & players_playing_blue+1 & " Players and you need " & amount_needed & " Players to start the game once there is enough players please step on the portal again to start the game!!!", 6)
End If
ElseIf playing_blue > 0 Then
If color_blue = 2 Then
If players_playing_blue = amount_needed Then
Call PlayerWarp(index, blue_start_map, blue_start_x, blue_start_y)
Call PutVar("CTF.ini " , "CTF", "gamegoing", 1)
Else
If color_blue = 2 Then
Call PlayerMsg(index, "You Are Already Waiting for a game to start. you are the color blue going for the red flag", 2)
Else
Call PlayerMsg(index, "You Are Already Waiting for a game to start. you are the color red going for the blue flag", 2)
End If
End If
ElseIf color_blue = 1 Then
Call PlayerMsg(index, "Get On your own portal!!!!", 2)
End If
End If
ElseIf blue_ban = 1 Then
Call PlayerMsg(index, "you have been banned do not return here until a mod unbans you...", 2)
End If
ElseIf blue_game = 1 Then
Call PlayerMsg(index, "Sorry there is already a game going", 2)
End If
End Sub



'******************************************
Sub blue_flag(index)'**********************
'By Brutal <-- (must stay if code edited)**
'******************************************
Dim Get_Color
Dim Get_Red_Map
Dim Get_Blue_Map
Dim Get_Has_Flag
Dim game_portals_Map
Dim game_portals_Y
Dim game_portals_X
Dim players_playing_blue2
Dim Game_Over
Get_Color = GetVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "color")
Get_Red_Map = GetVar("CTF.ini ", "CTF", "red_start_map")
Get_Blue_Map = GetVar("CTF.ini ", "CTF", "blue_start_map")
Game_Over = GetVar("CTF.ini ", "CTF", "game_over")

game_portals_Map = GetVar("CTF.ini ", "CTF", "game_portals_map")
game_portals_X = GetVar("CTF.ini ", "CTF", "game_portals_x")
game_portals_Y = GetVar("CTF.ini ", "CTF", "game_portals_y")
players_playing_blue2 = GetVar("CTF.ini ", "CTF", "playersplaying")
Get_Has_Flag = GetVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "has_flag")

If Get_Color = 1 Then
Call PlayerMsg(index, "You Got There Flag Now Take It Back To Your Flag and Stand UNder Yours!!! Hurry and dont die!!!", 2)
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "has_flag", 1)
Call MapMsg(Get_Red_Map, GetPlayerName(index) & "Has The Red Flag You Better Kill Him Red Team!!!", 15)
Call MapMsg(Get_Blue_Map, GetPlayerName(index) & "Has The Red Flag You Better Kill Him Red Team!!!", 15)
ElseIf Get_Color = 2 Then
Get_Has_Flag = GetVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "has_flag")
If Get_Has_Flag = 1 Then
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "has_flag", 0)
Call PutVar("CTF.ini ", "CTF", "game_over", 1)
Call MapMsg(Get_Red_Map, GetPlayerName(index) & "Has Won The Game For The Red Team!!! Return to a flag to be warp out(a new game cannot be started while someone is in the playing field and mods can ban you from the game)", 15)
Call MapMsg(Get_Blue_Map, GetPlayerName(index) & "Has Won The Game For The Red Team!!!Return to a flag to be warp out(a new game cannot be started while someone is in the playing field and mods can ban you from the game)", 15)
Else

If Game_Over = 1 Then
If players_playing_blue2 > 1 Then
Call PutVar("CTF.ini " , "CTF", "playersplaying", Int(players_playing_blue2-1))
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "color", 0)
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "playing", 0)
Call PlayerWarp(index, game_portals_Map, game_portals_X, game_portals_Y)
ElseIf players_playing_blue2 = 1 Then
Call PutVar("CTF.ini " , "CTF", "playersplaying", Int(players_playing_blue2-1))
Call PutVar("CTF.ini " , "CTF", "gamegoing", 0)
Call PutVar("CTF.ini " , "CTF", "gave_over", 0)
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "color", 0)
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "playing", 0)
Call PlayerWarp(index, game_portals_Map, game_portals_X, game_portals_Y)
End If
ElseIf Game_Over = 0 Then
Call PlayerMsg(index, "Return Once You Have The Flag!!! Or the game is over!", 2)
End If
End If
End If
End Sub



'******************************************
Sub red_flag(index)'**********************
'By Brutal <-- (must stay if code edited)**
'******************************************
Dim Get_Color2
Dim Get_Red_Map2
Dim Get_Blue_Map2
Dim Get_Has_Flag2
Dim game_portals_Map2
Dim game_portals_Y2
Dim game_portals_X2
Dim players_playing_blue22
Dim Game_Over2
Get_Color2 = GetVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "color")
Get_Red_Map2 = GetVar("CTF.ini ", "CTF", "red_start_map")
Get_Blue_Map2 = GetVar("CTF.ini ", "CTF", "blue_start_map")
Game_Over2 = GetVar("CTF.ini ", "CTF", "game_over")

game_portals_Map2 = GetVar("CTF.ini ", "CTF", "game_portals_map")
game_portals_X2 = GetVar("CTF.ini ", "CTF", "game_portals_x")
game_portals_Y2 = GetVar("CTF.ini ", "CTF", "game_portals_y")
players_playing_blue22 = GetVar("CTF.ini ", "CTF", "playersplaying")
Get_Has_Flag = GetVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "has_flag")

If Get_Color2 = 2 Then
Call PlayerMsg(index, "You Got There Flag Now Take It Back To Your Flag and Stand UNder Yours!!! Hurry and dont die!!!", 2)
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "has_flag", 1)
Call MapMsg(Get_Red_Map, GetPlayerName(index) & "Has The Red Flag You Better Kill Him Red Team!!!", 15)
Call MapMsg(Get_Blue_Map, GetPlayerName(index) & "Has The Red Flag You Better Kill Him Red Team!!!", 15)
ElseIf Get_Color2 = 1 Then
Get_Has_Flag2 = GetVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "has_flag")
If Get_Has_Flag2 = 1 Then
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "has_flag", 0)
Call PutVar("CTF.ini ", "CTF", "game_over", 1)
Call MapMsg(Get_Red_Map2, GetPlayerName(index) & "Has Won The Game For The Red Team!!! Return to a flag to be warp out(a new game cannot be started while someone is in the playing field and mods can ban you from the game)", 15)
Call MapMsg(Get_Blue_Map2, GetPlayerName(index) & "Has Won The Game For The Red Team!!!Return to a flag to be warp out(a new game cannot be started while someone is in the playing field and mods can ban you from the game)", 15)
Else

If Game_Over2 = 1 Then
If players_playing_blue22 > 1 Then
Call PutVar("CTF.ini " , "CTF", "playersplaying", Int(players_playing_blue22-1))
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "color", 0)
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "playing", 0)
Call PlayerWarp(index, game_portals_Map2, game_portals_X2, game_portals_Y2)
ElseIf players_playing_blue22 = 1 Then
Call PutVar("CTF.ini " , "CTF", "playersplaying", Int(players_playing_blue22-1))
Call PutVar("CTF.ini " , "CTF", "gamegoing", 0)
Call PutVar("CTF.ini " , "CTF", "gave_over", 0)
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "color", 0)
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CTF", "playing", 0)
Call PlayerWarp(index, game_portals_Map2, game_portals_X2, game_portals_Y2)
End If
ElseIf Game_Over2 = 0 Then
Call PlayerMsg(index, "Return Once You Have The Flag!!! Or the game is over!", 2)
End If
End If
End If
End Sub


Then Find This
Code: [Select]
Sub OnDeath(index)
Dim mapnum
Dim x
Dim y
Dim i
i = GetPlayerClass(index)

mapnum = GetVar("Classes\Class" & i & ".ini", "CLASS", "Map")
y = GetVar("Classes\Class" & i & ".ini", "CLASS", "y")
x = GetVar("Classes\Class" & i & ".ini", "CLASS", "x")
Call PlayerWarp(index, mapnum, x, y)
End Sub


And REPLACE it with this
Code: [Select]
Sub OnDeath(index)
Dim mapnum
Dim x
Dim y
Dim i
i = GetPlayerClass(index)

mapnum = GetVar("Classes\Class" & i & ".ini", "CLASS", "Map")
y = GetVar("Classes\Class" & i & ".ini", "CLASS", "y")
x = GetVar("Classes\Class" & i & ".ini", "CLASS", "x")
Call PlayerWarp(index, mapnum, x, y)
Call when_you_die_for_ctf(index)
End Sub


Then Find This
Code: [Select]
'********************************
Sub ScriptedTile(index, Script)  
'********************************

Select Case Script


And Put This Under it CHANGEING THE CASES ACCORDINGLY TO WHAT U ALREADY HAVE!!!!!!!!!
Code: [Select]
'<><><><><>
Case 0
Call start_C_T_F_red(index)
'<><><><><>
Case 1
Call start_C_T_F_blue(index)
'<><><><><>
Case 2
Call blue_flag(index)
'<><><><><>
Case 3
Call red_flag(index)


Then Make an CTF.ini that says this
Code: [Select]
[CTF]
amountofplayersneeded=#replace with amount of players you want per game#
red_start_map=#replace with map with the red flag#
red_start_x=#replace this with an x right next to the red flag#
red_start_y=#replace this with an y right next to the red flag#
blue_start_map=#replace with map with the blue flag#
blue_start_x=#replace this with an x right next to the blue flag#
blue_start_y=#replace this with an y right next to the blue flag#
playersplaying=0
game_portals_map=#replace with map that the blue and red portals are on#
game_portals_x=#replace with A x that the blue and red portals are on#
game_portals_y=#replace with A y that the blue and red poertals are on#
game_over=0
gamegoing=0



Ok and thats it(atleast i think i didnt leave out anything it was alot of code so sry if i did...)

HOW TO USE
ok place the first 2 scripted tiles on the map you want the portals to start the game to be on. Then fill out the CTF.ini accordingly DO NOT MESS WITH THE GAME_OVER GAMEGOING OR PLAYERSPLAYING OR IT WILL NOT WORK!!!!!. put the 3 scriptited tile i gave you where the blue flag goes and the fourth scripted tile where the red flag go's. There is a way to ban the ppl but u have to have access to there server file for now ill prolly change this later. Thats all feel free to ask questions but be spicific(spelled wrong) but i might just tell you to go away so ya....


~Brutal
jackal27
Tales of Adriana creator
Global Moderator
Advanced Member
*
Offline Offline

Posts: 692



View Profile Email
« Reply #1 on: July 14, 2006, 03:14:33 AM »

I haven't tryed this out yet, i will tomorrow so I'm not sure if it works, but if it does... TY TY TY TY!! I know alot of people have been wanting this!
unnown
Teh Uberleet
*****
Offline Offline

Posts: 3,659


-Admin-


View Profile Email
« Reply #2 on: July 14, 2006, 04:12:53 AM »

you can't play the ctf when you do? wy not just adding a place to spwan when they die?
Brutal - Zeldo
Ex-Eclipse Programmer
Global Moderator
Active Member
*
Offline Offline

Posts: 324

Pie


View Profile Email
« Reply #3 on: July 14, 2006, 02:08:37 PM »

didnt have the time XD also helps limit the time of the game if ppl just keep respawning in the game it could last forever
unnown
Teh Uberleet
*****
Offline Offline

Posts: 3,659


-Admin-


View Profile Email
« Reply #4 on: July 14, 2006, 04:28:29 PM »

you could set a max score?
Brutal - Zeldo
Ex-Eclipse Programmer
Global Moderator
Active Member
*
Offline Offline

Posts: 324

Pie


View Profile Email
« Reply #5 on: July 14, 2006, 09:03:16 PM »

no the score is one XD once someone get those other colors flag back to there's the game is over and once everyone leave a new one can be started
unnown
Teh Uberleet
*****
Offline Offline

Posts: 3,659


-Admin-


View Profile Email
« Reply #6 on: July 15, 2006, 04:47:01 AM »

hmm...k...that's one way to do it...i think most people like it your way :P
Lee_Dragoon
Active Member
***
Offline Offline

Posts: 167



View Profile Email
« Reply #7 on: July 15, 2006, 12:01:31 PM »

*puts in main.txt* ty!

wait, in what folder do we put the CTF .ini?
Brutal - Zeldo
Ex-Eclipse Programmer
Global Moderator
Active Member
*
Offline Offline

Posts: 324

Pie


View Profile Email
« Reply #8 on: July 15, 2006, 12:02:38 PM »

lol np :P
master5006
Active Member
***
Offline Offline

Posts: 155



View Profile WWW Email
« Reply #9 on: July 16, 2006, 04:52:50 PM »

I dont get it i mean i set everything but when you get 2 players the game wont start...
unnown
Teh Uberleet
*****
Offline Offline

Posts: 3,659


-Admin-


View Profile Email
« Reply #10 on: July 16, 2006, 05:07:08 PM »

you changed the ini right?
master5006
Active Member
***
Offline Offline

Posts: 155



View Profile WWW Email
« Reply #11 on: July 16, 2006, 05:10:04 PM »

ya
unnown
Teh Uberleet
*****
Offline Offline

Posts: 3,659


-Admin-


View Profile Email
« Reply #12 on: July 16, 2006, 05:53:45 PM »

could you show it?
master5006
Active Member
***
Offline Offline

Posts: 155



View Profile WWW Email
« Reply #13 on: July 16, 2006, 05:59:30 PM »

i have it set up for the test so they are by each other but
Code: [Select]
[CTF]
amountofplayersneeded=2
red_start_map=1
red_start_x=14
red_start_y=1
blue_start_map=1
blue_start_x=13
blue_start_y=1
playersplaying=0
game_portals_map=1
game_portals_x=12
game_portals_y=1
game_over=0
gamegoing=0
unnown
Teh Uberleet
*****
Offline Offline

Posts: 3,659


-Admin-


View Profile Email
« Reply #14 on: July 16, 2006, 06:03:22 PM »

strange should work maby you did something wrong adding it?
master5006
Active Member
***
Offline Offline

Posts: 155



View Profile WWW Email
« Reply #15 on: July 16, 2006, 06:45:28 PM »

when i get 2 ppl on the game wont start =\ so that might be a bug in it.
Brutal - Zeldo
Ex-Eclipse Programmer
Global Moderator
Active Member
*
Offline Offline

Posts: 324

Pie


View Profile Email
« Reply #16 on: July 17, 2006, 10:05:42 PM »

no... did u set the amountfofplayersneeded to 2?