[FilterScript] Simple Fallout Minigame
#1

Simple Fallout Minigame
Hey everyone! I'm here to release one of my first Filterscripts, the Fallout Event. Since it's a minigame that i love i wanted to code it and here it is!

For those who don't know what Fallout is:

Fallout is an event where you spawn on a giant platform, the platform will be destroyed one by one, meanwhile you have to try to not fall.
If you're the Last man standing on the platform you will win the minigame.


Commands:

/startevent RCON Admin command
/joinfallout Command to join the event

You can edit inside the script the Time for the start and the money given to the winner on top of the gamemode with EVENT_START and MONEY.

For now i'm releasing it like this, i didn't find any bug, if you find one just post it inside this topic.
I will add more features soon~

Screenshot: http://imgur.com/a/bS80L

Download: http://pastebin.com/BSv2eC1Q


Thanks to: Zeex for ZCMD include
Reply
#2

Nothing is spcail , but good job +REP
Reply
#3

Quote:
Originally Posted by ItzzWesty
View Post
Nothing is spcail , but good job +REP
Thank you! For now it's a simple script, i'll add more features soon~
Reply
#4

256 cells? That is a waste.
PHP Code:
new string[256];
format(string,sizeof(string),"The Fallout event is about to start in %d minute(s), join it by typing '/joinfallout'",EVENT_START); //let's send everyone a string with the time until start and the join command 
Uh? What? 128 cells for a name?
PHP Code:
new name[128];
GetPlayerName(i,name,128); 
This:
PHP Code:
new FalloutPlayer[MAX_PLAYERS]; //Player Variable that let us know if the player is inside the event or not
new FalloutStarted 0//Global Variable to know if the Event has started or not
new FalloutPlayers 0//Global Variable to know how much players we have in the event, if < 1 the event will NOT start.
new FalloutWaiting 0//Global variable to know if we're waiting for the event to start or not 
Could be like this:

PHP Code:
new FalloutPlayer[MAX_PLAYERS], //Player Variable that let us know if the player is inside the event or not
FalloutStarted 0//Global Variable to know if the Event has started or not
FalloutPlayers 0//Global Variable to know how much players we have in the event, if < 1 the event will NOT start.
FalloutWaiting 0//Global variable to know if we're waiting for the event to start or not 
Reply
#5

Quote:
Originally Posted by Jelly23
View Post
256 cells? That is a waste.
PHP Code:
new string[256];
format(string,sizeof(string),"The Fallout event is about to start in %d minute(s), join it by typing '/joinfallout'",EVENT_START); //let's send everyone a string with the time until start and the join command 
Uh? What? 128 cells for a name?
PHP Code:
new name[128];
GetPlayerName(i,name,128); 
This:
PHP Code:
new FalloutPlayer[MAX_PLAYERS]; //Player Variable that let us know if the player is inside the event or not
new FalloutStarted 0//Global Variable to know if the Event has started or not
new FalloutPlayers 0//Global Variable to know how much players we have in the event, if < 1 the event will NOT start.
new FalloutWaiting 0//Global variable to know if we're waiting for the event to start or not 
Could be like this:

PHP Code:
new FalloutPlayer[MAX_PLAYERS], //Player Variable that let us know if the player is inside the event or not
FalloutStarted 0//Global Variable to know if the Event has started or not
FalloutPlayers 0//Global Variable to know how much players we have in the event, if < 1 the event will NOT start.
FalloutWaiting 0//Global variable to know if we're waiting for the event to start or not 
Code optimization is not my best thing atm, thank you for the tips

EDIT: Added the version with less cells on strings
Reply
#6

Please also fix your indentation.
Reply
#7

Quote:
Originally Posted by Infinity
View Post
Please also fix your indentation.
Where are those indentation problems? I got no warnings in the compiler
Reply
#8

Quote:
Originally Posted by Flamehaze7
View Post
Where are those indentation problems? I got no warnings in the compiler
Even if you have no warnings, you can't convince me that the code below is properly indented:
Code:
    if(FalloutPlayers == 1) //Checking if there's 1 player remaining
    {
    for ( new z; z < MAX_PLAYERS; z++)
    {
    if(FalloutPlayer[z] == 1) //Checking if he's a fallout player
    {
    SendClientMessage(z,Green,"Congratz, you're the last man standing on the platform, you won! And you got some extra money for it!"); //Let's send him a message
    GivePlayerMoney(z,MONEY); //Give him the money for the victory you can change it from the top of the Filterscript
    SpawnPlayer(z); //Spawn him
    SetPlayerVirtualWorld(z,0); //Reset his virtual world
    
    //Reset everything for a new run
    FalloutPlayer[z] = 0;
    FalloutStarted = 0;
    FalloutPlayers = 0;
    
	SetTimer("RegenPlatforms",5000,0); //Let's recreate all the platforms in 20 seconds meanwhile they get destroyed and recreated
	
    //Now let's destroy all objects and reset them
    for(new o=0;o<sizeof(PlatformObject);o++) //Cycle to get all the objects
    {
    if(IsValidObject(PlatformObject[o])) //Then destroy it
    {
    DestroyObject(PlatformObject[o]);
    }
    }

    }
    }
    }
Reply
#9

Quote:
Originally Posted by Infinity
View Post
Even if you have no warnings, you can't convince me that the code below is properly indented:
Code:
    if(FalloutPlayers == 1) //Checking if there's 1 player remaining
    {
    for ( new z; z < MAX_PLAYERS; z++)
    {
    if(FalloutPlayer[z] == 1) //Checking if he's a fallout player
    {
    SendClientMessage(z,Green,"Congratz, you're the last man standing on the platform, you won! And you got some extra money for it!"); //Let's send him a message
    GivePlayerMoney(z,MONEY); //Give him the money for the victory you can change it from the top of the Filterscript
    SpawnPlayer(z); //Spawn him
    SetPlayerVirtualWorld(z,0); //Reset his virtual world
    
    //Reset everything for a new run
    FalloutPlayer[z] = 0;
    FalloutStarted = 0;
    FalloutPlayers = 0;
    
	SetTimer("RegenPlatforms",5000,0); //Let's recreate all the platforms in 20 seconds meanwhile they get destroyed and recreated
	
    //Now let's destroy all objects and reset them
    for(new o=0;o<sizeof(PlatformObject);o++) //Cycle to get all the objects
    {
    if(IsValidObject(PlatformObject[o])) //Then destroy it
    {
    DestroyObject(PlatformObject[o]);
    }
    }

    }
    }
    }
Oh, that code was rushed a bit, that's why it has poor indentation, now i fixed it.
Reply
#10

That was just one part. If you just browse through your code, you should find that +/- half of it is/was badly indented.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)