Navigation Menu

Skip to content

Commit

Permalink
Code style Adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
shanapu committed May 26, 2018
1 parent a9064dc commit 4f733b1
Show file tree
Hide file tree
Showing 61 changed files with 1,601 additions and 612 deletions.
9 changes: 6 additions & 3 deletions Code_Contribution_Guidelines.md
Expand Up @@ -22,7 +22,8 @@ Maybe these guidelines could change in future.
**don't forget to credit yourself**
***
### Comment your code
**doing some magic? explain it! you don't need to comment "standard" code**
**doing some magic? explain it!
you don't need to comment "standard" code**
***
### Give credits
**(re)use code from an other author? give him credits as a comment above the snippet**
Expand Down Expand Up @@ -59,6 +60,8 @@ examples:
if (check) {
function(); }
if (check) { function(); }
if (check) {
function();
}
Expand Down Expand Up @@ -86,7 +89,7 @@ examples:
```
... and variants

:alien: exceptions on a return immediately after check:
:alien: exception only on a return immediately after check:
```
if (check)
return Plugin_Continue;
Expand Down Expand Up @@ -318,7 +321,7 @@ examples:
menu.AddItem("1", "Item")
menu.Display(client, MENU_TIME);
```
... and variants
... and variants
:x: bad:
```
Handle panel = CreatePanel();
Expand Down
Expand Up @@ -125,7 +125,7 @@ public Action warden_OnWardenCreate(int client, int caller)



public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));

Expand All @@ -149,9 +149,9 @@ public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroa
}


public Action Timer_SlayPlayer(Handle hTimer, any iUserId)
public Action Timer_SlayPlayer(Handle timer, int userid)
{
int client = GetClientOfUserId(iUserId);
int client = GetClientOfUserId(userid);

if ((IsValidClient(client, false, false)) && (GetClientTeam(client) == CS_TEAM_CT))
{
Expand Down
Expand Up @@ -156,7 +156,7 @@ public Action warden_OnWardenCreate(int client, int caller)
}


public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));

Expand All @@ -183,9 +183,9 @@ public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroa
}


public Action Timer_SlayPlayer(Handle hTimer, any iUserId)
public Action Timer_SlayPlayer(Handle timer, int userid)
{
int client = GetClientOfUserId(iUserId);
int client = GetClientOfUserId(userid);

if ((IsValidClient(client, false, false)) && (GetClientTeam(client) == CS_TEAM_CT))
{
Expand Down
Expand Up @@ -124,7 +124,7 @@ public Action warden_OnWardenCreate(int client, int caller)



public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));

Expand All @@ -148,9 +148,9 @@ public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroa
}


public Action Timer_SlayPlayer(Handle hTimer, any iUserId)
public Action Timer_SlayPlayer(Handle timer, int userid)
{
int client = GetClientOfUserId(iUserId);
int client = GetClientOfUserId(userid);

if ((IsValidClient(client, false, false)) && (GetClientTeam(client) == CS_TEAM_CT))
{
Expand Down
Expand Up @@ -122,7 +122,7 @@ public Action warden_OnWardenCreate(int client, int caller)
return Plugin_Continue;
}

public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));

Expand All @@ -145,9 +145,9 @@ public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroa
return Plugin_Continue;
}

public Action Timer_SlayPlayer(Handle hTimer, any iUserId)
public Action Timer_SlayPlayer(Handle timer, int userid)
{
int client = GetClientOfUserId(iUserId);
int client = GetClientOfUserId(userid);

if ((IsValidClient(client, false, false)) && (GetClientTeam(client) == CS_TEAM_CT))
{
Expand Down
Expand Up @@ -137,7 +137,7 @@ public Action warden_OnWardenCreate(int client, int caller)
}


public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));

Expand All @@ -164,9 +164,9 @@ public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroa
}


public Action Timer_SlayPlayer(Handle hTimer, any iUserId)
public Action Timer_SlayPlayer(Handle timer, int userid)
{
int client = GetClientOfUserId(iUserId);
int client = GetClientOfUserId(userid);

if ((IsValidClient(client, false, false)) && (GetClientTeam(client) == CS_TEAM_CT))
{
Expand Down
Expand Up @@ -122,7 +122,7 @@ public Action warden_OnWardenCreate(int client, int caller)
return Plugin_Continue;
}

public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));

Expand All @@ -145,9 +145,9 @@ public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroa
return Plugin_Continue;
}

public Action Timer_SlayPlayer(Handle hTimer, any iUserId)
public Action Timer_SlayPlayer(Handle timer, int userid)
{
int client = GetClientOfUserId(iUserId);
int client = GetClientOfUserId(userid);

if ((IsValidClient(client, false, false)) && (GetClientTeam(client) == CS_TEAM_CT))
{
Expand Down
Expand Up @@ -100,8 +100,11 @@ public void OnPluginStart()
// Late loading
if (g_bIsLateLoad)
{
for (int i = 1; i <= MaxClients; i++) if (IsClientInGame(i))
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i))
continue;

OnClientPostAdminCheck(i);
}

Expand Down Expand Up @@ -213,7 +216,7 @@ public void OnClientDisconnect(int client)
IsMemberWarden[client] = false;
}

public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));

Expand All @@ -237,9 +240,9 @@ public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroa
}


public Action Timer_SlayPlayer(Handle hTimer, any iUserId)
public Action Timer_SlayPlayer(Handle timer, int userid)
{
int client = GetClientOfUserId(iUserId);
int client = GetClientOfUserId(userid);

if ((IsValidClient(client, false, false)) && (GetClientTeam(client) == CS_TEAM_CT))
{
Expand Down
Expand Up @@ -84,7 +84,7 @@ public Action MyJailbreak_OnJoinGuardQueue(int client)
return Plugin_Continue;
}

public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));

Expand All @@ -107,9 +107,9 @@ public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroa
return Plugin_Continue;
}

public Action Timer_SlayPlayer(Handle hTimer, any iUserId)
public Action Timer_SlayPlayer(Handle timer, int userid)
{
int client = GetClientOfUserId(iUserId);
int client = GetClientOfUserId(userid);

if ((IsValidClient(client, false, false)) && (GetClientTeam(client) == CS_TEAM_CT))
{
Expand Down
Expand Up @@ -84,7 +84,7 @@ public Action MyJailbreak_OnJoinGuardQueue(int client)
return Plugin_Continue;
}

public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));

Expand All @@ -107,9 +107,9 @@ public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroa
return Plugin_Continue;
}

public Action Timer_SlayPlayer(Handle hTimer, any iUserId)
public Action Timer_SlayPlayer(Handle timer, int userid)
{
int client = GetClientOfUserId(iUserId);
int client = GetClientOfUserId(userid);

if ((IsValidClient(client, false, false)) && (GetClientTeam(client) == CS_TEAM_CT))
{
Expand Down
19 changes: 11 additions & 8 deletions addons/sourcemod/scripting/MyJailbreak/Add-ons/ratio_steamrep.sp
Expand Up @@ -94,8 +94,11 @@ public void OnPluginStart()
// Late loading
if (g_bIsLateLoad)
{
for (int i = 1; i <= MaxClients; i++) if (IsClientInGame(i))
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i))
continue;

OnClientConnected(i);
OnClientPostAdminCheck(i);
}
Expand Down Expand Up @@ -133,7 +136,7 @@ public void OnClientPostAdminCheck(int client)
SocketConnect(socket, OnSocketConnected, OnSocketReceive, OnSocketDisconnected, "steamrep.com", 80);
}

public int OnSocketConnected(Handle socket, any userid)
public int OnSocketConnected(Handle socket, int userid)
{
// socket is connected, send the http request
int client = GetClientOfUserId(userid);
Expand Down Expand Up @@ -162,7 +165,7 @@ public int OnSocketConnected(Handle socket, any userid)
}
}

public int OnSocketReceive(Handle socket, char[] receiveData, const int dataSize, any userid)
public int OnSocketReceive(Handle socket, char[] receiveData, const int dataSize, int userid)
{
// receive chunk
int client = GetClientOfUserId(userid);
Expand All @@ -176,13 +179,13 @@ public int OnSocketReceive(Handle socket, char[] receiveData, const int dataSize
g_IsScammer[client] = true;
}

public int OnSocketDisconnected(Handle socket, any client)
public int OnSocketDisconnected(Handle socket, int client)
{
// Connection: close advises the webserver to close the connection when the transfer is finished
CloseHandle(socket);
}

public int OnSocketError(Handle socket, const int errorType, const int errorNum, any client)
public int OnSocketError(Handle socket, const int errorType, const int errorNum, int client)
{
// a socket error occured
LogError("socket error %d (errno %d)", errorType, errorNum);
Expand All @@ -200,7 +203,7 @@ public Action MyJailbreak_OnJoinGuardQueue(int client)
return Plugin_Continue;
}

public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));

Expand All @@ -223,9 +226,9 @@ public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroa
return Plugin_Continue;
}

public Action Timer_SlayPlayer(Handle hTimer, any iUserId)
public Action Timer_SlayPlayer(Handle timer, int userid)
{
int client = GetClientOfUserId(iUserId);
int client = GetClientOfUserId(userid);

if ((IsValidClient(client, false, false)) && (GetClientTeam(client) == CS_TEAM_CT))
{
Expand Down
Expand Up @@ -85,7 +85,7 @@ public Action MyJailbreak_OnJoinGuardQueue(int client)
return Plugin_Continue;
}

public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));

Expand All @@ -109,9 +109,9 @@ public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroa
return Plugin_Continue;
}

public Action Timer_SlayPlayer(Handle hTimer, any iUserId)
public Action Timer_SlayPlayer(Handle timer, int userid)
{
int client = GetClientOfUserId(iUserId);
int client = GetClientOfUserId(userid);

if ((IsValidClient(client, false, false)) && (GetClientTeam(client) == CS_TEAM_CT))
{
Expand Down
Expand Up @@ -86,7 +86,7 @@ public Action MyJailbreak_OnJoinGuardQueue(int client)
return Plugin_Continue;
}

public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));

Expand All @@ -109,9 +109,9 @@ public Action Event_OnPlayerSpawn(Event event, const char[] name, bool bDontBroa
return Plugin_Continue;
}

public Action Timer_SlayPlayer(Handle hTimer, any iUserId)
public Action Timer_SlayPlayer(Handle timer, int userid)
{
int client = GetClientOfUserId(iUserId);
int client = GetClientOfUserId(userid);

if ((IsValidClient(client, false, false)) && (GetClientTeam(client) == CS_TEAM_CT))
{
Expand Down
Expand Up @@ -155,6 +155,6 @@ public void MyJailbreak_MenuHandler(Menu menu, MenuAction action, int client, in
// Remove this part for your own custom plugin!
public void OnMapStart()
{
SetFailState("This file is an template for developer and should'n run on productive servers! please remove");
SetFailState("This file is an template for developer and should'nt run on productive servers! please remove");
}

0 comments on commit 4f733b1

Please sign in to comment.