[FilterScript] [Event System] Aztecas vs Ballas (Textdraws + Auto end)
#1

Fast Brief
Greetings everyone, I've started working on this project 2 weeks ago and It's finally done, I can gladly say that it's one of the most advanced systems I ever made.




Gameplay
There are two teams, Los Aztecas and Ballas. The area is a big merchandise ship, in which have two bases for both teams, each base has one checkpoint, teams have to defence these checkpoints otherwise other teams will acquire different kind of spells, so basically when someone stand in his enemy's checkpoint for 5 seconds, he will acquire a random spell.. spells can be either useful for your team or extremely dangarous for your enemy's team (An explanation is written about spells down there).

How to win? Your team must reach the set score, gaining team points depends on killing enemies (1 score per one kill)..

Each event has a top fragger (i.e the one with the highest amount of kills)





System and Commands
/Event [max participators] [achievable score] To start an event, you can also set a maximum number for participators so if you set it to 5, only 5 persons can join the event, and the achievable score is the points that teams have to reach to win the event

/Respawn To respawn at your team base, just in case you are stuck in water (The command is made to detect if you are in water, and it can not be spammed)

/Spell To use a spell that you've acquired as a result of standing in the enemy's base checkpoint for 5 seconds

/Endevent To end an event. FAQ; System detects the closest team's score to the main set score and announce this team as a winner, and if both teams have the same score, it's draw then

/Join To join an event

/Einfo A dialog to fill you in with the event's information




FAQ
What if Ballas team's all members left the server? The event will be given to Los Aztecas' sake.

What will happen when I join an event? Nothing for 1 minute, then it will start and you will be teleported automatically, the reason behind this period is to give everyone time to join.

How to get a spell? You've to stand in the enemy's team base checkpoint for 5 seconds.

How to win the event? Your team MUST reach the set score of the event.

I can't join the event, why? Because it's either started or maximum persons joined, that's why you've to be fast.




Spells
Spells can be chaotic to your enemies and extremely useful to your team, acquiring them depends on your sneaking skills, you've to stand in your enemy's base team checkpoints for 5 seconds and that's so hard to do actually..

Spells are much and kind of various, let me list the current available spells:

Negative HP spell: Make the enemy team members have -65 hp! It can be used once.

Healing HP spell: Heal up your team members +65 hp! It can be used once.

Freezing spell: Freeze the enemy team members for 5 seconds! It can be used once.

Fatass curse spell: Change the enemy team members skin to a very fat skin (id 5)





Caution Alarm
When someone from the enemy team sneaks to your team base checkpoint a message will be sent to your team members warning them about this!





Notes
Winner gets 50,000$, if event is draw then every team will get 25,000$

You will respawn to your base automatically when you die until a team reaches the set score and win the event

If you are stuck in water, use /Respawn

System works with auto balance, to make it fair

When you die, your enemy team points increase +1

Spells can be chaotic to your enemies and extremely useful to your team

You have to wait 20 seconds to acquire another spell

You can't acquire multiple spells at once

When you stand on your team base checkpoint, nothing will happen but just a small message motivating you to defence your base




Pictures








Download
Pastebin: https://pastebin.com/dXCBTcuR



Credits, Jlalt (IndentFixer) and Includes creators.
Reply
#2

+rep, really good fs
Reply
#3

I like the realization, but code could be better written. 3 stars
Reply
#4

Quote:
Originally Posted by Modather
View Post
+rep, really good fs
Thanks !


Quote:
Originally Posted by Bolex_
View Post
I like the realization, but code could be better written. 3 stars
Thank you Bolex, I appreciate your judgement, and I will surely optimize/update it by time!
Reply
#5

Idea is well, but the code is not. Here's what you've missed while coding;

PHP Code:
#define TEAM_BLUE 0 // Ballas
#define TEAM_RED 1 // Aztecas
#define TEAM_DEFAULT 2 
Can be done easier by giving it an enum, nothing of a huge deal but prefer using enum's in the future.
PHP Code:
enum {
   
TEAM_BLUE,
   
TEAM_RED,
   
TEAM_DEFAULT


PHP Code:
forward StartEvent();
forward ShowTextDraws(playerid);
forward BasePresents(playerid);
forward ReloadPlayer(playerid);
forward EnemyUnfreeze(playerid); 
If I'd decide to edit your script, and read this; I wouldn't believe those are callbacks, they're named wrongly. Prefer using;
PHP Code:
forward OnEventInit();
forward OnPlayerRequestTextdraws(playerid);
forward OnBasePresents(playerid);
forward OnPlayerReload(playerid);
forward OnPlayerUnfreeze(playerid); 
PHP Code:
new team[MAX_PLAYERS];
new 
InEvent[MAX_PLAYERS];
new 
mykills[MAX_PLAYERS] = 0;
new 
healteam[MAX_PLAYERS]; // spell
new fatasscurse[MAX_PLAYERS]; //spell
new negativehp[MAX_PLAYERS]; // spell
new enemyfreeze[MAX_PLAYERS]; // spell
new freezed[MAX_PLAYERS]; // variable to check if player is freezed
new PendingTimer[MAX_PLAYERS]; // A 5 seconds timer to give you a spell
new HaveSpell[MAX_PLAYERS]; // To check if a player HAS a spell
new SpellQueue[MAX_PLAYERS]; // To check if a player has just acquired a spell recently
new cmdtimer[MAX_PLAYERS]; 
You're creating too many variables for basic use, all those MAX_PLAYERS times the amount of variables could lead up to 10000 empty cells where only 1 or 2 is used per variable. Rather use SetPVarInt or possibly create an array with multiple indexes for each opacity.

PHP Code:
new mykills[MAX_PLAYERS] = 0
Should be
PHP Code:
new mykills[MAX_PLAYERS] = { 0, ... }; 
PHP Code:
new topfragger=-1
Assigning a playerid variable (-1) is never a good idea, simply use INVALID_PLAYER_ID

PHP Code:
new Text:Textdraw0[MAX_PLAYERS]; 
Look into PlayerTextdraws and read your code, understand why you're doing it wrong, simply because you're creating (MAX_PLAYERS) * global textdraws. You're creating global textdraws within an index meant for players.

PHP Code:
format(str,sizeof(str),"[Event System] The event has ended, victory goes to Aztecas! (top fragger: %s)",name); 
What if no one got a kill? Then the top fragger will stand empty.





I'm not gonna bother reading the rest of the code, try to read your code and optimize it better.



Good luck.
Reply
#6

Quote:
Originally Posted by Meller
View Post
Idea is well, but the code is not. Here's what you've missed while coding;

PHP Code:
#define TEAM_BLUE 0 // Ballas
#define TEAM_RED 1 // Aztecas
#define TEAM_DEFAULT 2 
Can be done easier by giving it an enum, nothing of a huge deal but prefer using enum's in the future.
PHP Code:
enum {
   
TEAM_BLUE,
   
TEAM_RED,
   
TEAM_DEFAULT


PHP Code:
forward StartEvent();
forward ShowTextDraws(playerid);
forward BasePresents(playerid);
forward ReloadPlayer(playerid);
forward EnemyUnfreeze(playerid); 
If I'd decide to edit your script, and read this; I wouldn't believe those are callbacks, they're named wrongly. Prefer using;
PHP Code:
forward OnEventInit();
forward OnPlayerRequestTextdraws(playerid);
forward OnBasePresents(playerid);
forward OnPlayerReload(playerid);
forward OnPlayerUnfreeze(playerid); 
PHP Code:
new team[MAX_PLAYERS];
new 
InEvent[MAX_PLAYERS];
new 
mykills[MAX_PLAYERS] = 0;
new 
healteam[MAX_PLAYERS]; // spell
new fatasscurse[MAX_PLAYERS]; //spell
new negativehp[MAX_PLAYERS]; // spell
new enemyfreeze[MAX_PLAYERS]; // spell
new freezed[MAX_PLAYERS]; // variable to check if player is freezed
new PendingTimer[MAX_PLAYERS]; // A 5 seconds timer to give you a spell
new HaveSpell[MAX_PLAYERS]; // To check if a player HAS a spell
new SpellQueue[MAX_PLAYERS]; // To check if a player has just acquired a spell recently
new cmdtimer[MAX_PLAYERS]; 
You're creating too many variables for basic use, all those MAX_PLAYERS times the amount of variables could lead up to 10000 empty cells where only 1 or 2 is used per variable. Rather use SetPVarInt or possibly create an array with multiple indexes for each opacity.

PHP Code:
new mykills[MAX_PLAYERS] = 0
Should be
PHP Code:
new mykills[MAX_PLAYERS] = { 0, ... }; 
PHP Code:
new topfragger=-1
Assigning a playerid variable (-1) is never a good idea, simply use INVALID_PLAYER_ID

PHP Code:
new Text:Textdraw0[MAX_PLAYERS]; 
Look into PlayerTextdraws and read your code, understand why you're doing it wrong, simply because you're creating (MAX_PLAYERS) * global textdraws. You're creating global textdraws within an index meant for players.

PHP Code:
format(str,sizeof(str),"[Event System] The event has ended, victory goes to Aztecas! (top fragger: %s)",name); 
What if no one got a kill? Then the top fragger will stand empty.





I'm not gonna bother reading the rest of the code, try to read your code and optimize it better.



Good luck.
Thank you and I will surely optimize it by time, and your points are helpful enough to look for.. About the topfragger =-1; i made it so if none is a topfragger it will remain empty, and no way there's no topfragger so it's not a big deal.. Thank you for your time once again I appreciate it

(Something want to say: For me, once everything is working perfectly I consider the job done) I need much time to understand memory & cells issue
Reply
#7

Great job +Rep !

Keep up the good work mate
Reply
#8

Thanks R4nd4ll, I'm so happy to hear that from you!
Reply
#9

Good Job +Rep
Reply
#10

Bump! see this everybody
Reply
#11

Quote:
Originally Posted by OverflowJ
View Post
Bump! see this everybody
Well, the code was removed from pastebin, so there's nothing to see.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)