NOTE: You may find this post offensive, while i want you to improve.
Line number 139 till 155:
PHP код:
//=============================//
//========[TEAMS ZONES]========//
//=============================//
#define TEAM_ZONE_POLICE_COLOR 0x0065E196
#define TEAM_ZONE_MAFIA_COLOR 0xC90E5496
//===========================//
//===========================//
//===========================//
//==============================//
//========[TEAMS COLORS]========//
//==============================//
#define TEAM_POLICE_COLOR 0x0065E196
#define TEAM_MAFIA_COLOR 0xC90E5496
//===========================//
//===========================//
//===========================//
What the heck is this? -_-
Line number 164 till 170 and other lines as well:
PHP код:
new Text:Kill1;
new Text:Kill2;
new Text:Countdown;
new PoliceKills = 0;
new MafiaKills = 0;
new CountDownTime = 1800;
new CDChange;
Can be optimized as
PHP код:
new Text:Kill1, Text:Kill2, Text:Countdown, PoliceKills, MafiaKills, CountDownTime, CDChange;
Looks like a copy-paste from a script:
PHP код:
new tCP[30]; // why 30 here
new UnderAttack[30] = 0; // why 30 here and by default, a variable value is zero
new CP[30]; // why 30 here
new Zone[30]; // why 30 here
new Captured[MAX_PLAYERS][30]; // why 30 here
new UpdateTimer[MAX_PLAYERS];
new timer[MAX_PLAYERS][30]; // why 30 here
new CountVar[MAX_PLAYERS][30]; // why 30 here
new Text:CountText[MAX_PLAYERS];
new Text:BLine;
new IsPlayerCapturing[MAX_PLAYERS][30]; // why 30 here?
new CP_EnterBank, CP_ExitBank, CP_RobBank;
new // what's with the lines from now?
IsPossible,
general_timer[MAX_PLAYERS],
bool:gPlayerRobbing[MAX_PLAYERS]
;
PHP код:
CreateObject(................)
Use streamer as you've already included it.
Line number 997 and onwards:
PHP код:
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
CountText[playerid] = TextDrawCreate(31.666643, 321.481628, "~r~0/25 ~w~seconds left to capture");
TextDrawLetterSize(CountText[playerid], 0.200555, 1.091853);
TextDrawAlignment(CountText[playerid], 1);
TextDrawColor(CountText[playerid], -1);
TextDrawSetShadow(CountText[playerid], 0);
TextDrawSetOutline(CountText[playerid], 1);
TextDrawBackgroundColor(CountText[playerid], 51);
TextDrawFont(CountText[playerid], 3);
TextDrawSetProportional(CountText[playerid], 1);
}
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
TDown4[playerid] = TextDrawCreate(41.000000, 432.600097, "NAME: ~r~Zero");
TextDrawLetterSize(TDown4[playerid], 0.174999, 1.053999);
TextDrawAlignment(TDown4[playerid], 1);
TextDrawColor(TDown4[playerid], -1);
TextDrawSetShadow(TDown4[playerid], 0);
TextDrawSetOutline(TDown4[playerid], 0);
TextDrawBackgroundColor(TDown4[playerid], 51);
TextDrawFont(TDown4[playerid], 2);
TextDrawSetProportional(TDown4[playerid], 1);
TDown6[playerid] = TextDrawCreate(200.000000, 432.862579, "CASH: ~r~0~g~$");
TextDrawLetterSize(TDown6[playerid], 0.189000, 1.063332);
TextDrawAlignment(TDown6[playerid], 1);
TextDrawColor(TDown6[playerid], -1);
TextDrawSetShadow(TDown6[playerid], 0);
TextDrawSetOutline(TDown6[playerid], 0);
TextDrawBackgroundColor(TDown6[playerid], 51);
TextDrawFont(TDown6[playerid], 2);
TextDrawSetProportional(TDown6[playerid], 1);
....
Much more copy-paste work... and indentation is poor, PasteBin fuckery is visible as it adds extra tabs
OnPlayerDeath callback:
PHP код:
public OnPlayerDeath(playerid, killerid, reason)
{
...
No invalid player check...
PHP код:
SetPlayerHealth(playerid, 99999.0);
This isn't infinite...
No proper use of Streamer
No use of switch in OnDialogResponse, also use EasyDialog it's bug-proof.
No need to use Whirlpool it's 2016 and almost 2017, use SHA256 with a salt.
Extremely poor indentation
Some functions are with 'stock' keyword and some are not.
no proper use of functions.
Using the same capture zone code from COD gamemode without credits to the author, Jarnu.
Capture zone is exploitable, either fix it or move towards Gammix' code.
So much large bullshit under OnPlayerUpdate
PHP код:
CMD:day( playerid, params[ ] ) return SetPlayerTime( playerid, 13, 0 );
CMD:night( playerid, params[ ] ) return SetPlayerTime( playerid, 0, 0 );
No need to use params[] here, simply use CMD:day(playerid)
How can you fix the following errors and what you learned- Use gammix' code for capture zone
- Use player textdraws where necessary and needed, else use global
- Remove useless code from OPU, learn why you shouldn't use it, it's called at a minimum rate of 30 times per second.
- Use GetPlayerPoolSize for looping, it get's the highest player id that's playing.
- params parameter isn't necessary as you aren't using it
- Move towards EasyDialog and EasyDB