Welcome to The Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads

Coding And Source Mod


Recommended Posts

(im not trying to steal your servers stuff i would just like to test it like debug)

Most staff don't even have access to our plugins. Not only will you not get access to those any time soon, but not many will really. Even if you did have the plugins, you wouldn't be able to see the source for it so there is no point in hosting a dedicated server just to play jailbreak alone. The source is highly protected, and with the little knowledge you have of sourcemod it would not benefit you to see such a complex set of plugins in their entirety. If you want I will write something simple using as many concepts as I can and you can see how the code works on your own server.
Link to comment
Share on other sites

#include <sourcemod>

public Plugin myinfo =

{

name = "test 123",

author = "nielsfalko",

description = "My first plugin ever",

version = "1.0",

url = "http://www.sourcemod.net/"

};

public void onpluginstart()

{

PrintToServer("hello world"); //You forgot the semi-colon

}

Link to comment
Share on other sites

This was one of the first plugins I ever built. Its kinda shitty but you can see some new concepts that you might not know.

 

#include <sourcemod> //include sourcemod which is required
#include <sdktools> //Sdk tools is something I always include
#include <cstrike>  //As this is for cstrike I included cstrike for checking the team
#define HG "[\x04HG\x01]\x04" //Define our custom prefix
new Float:Office[3] = {-1921.8, 838.5, 308.0}; //Register the teleport location
new bool:TP_Allowed = true; //Bool to disable the command (I should have used a convar)
new bool:TP_Enabled = true; //Bool to disable the command after 30 seconds of round start
new Handle: TPTIMER;    //Timer handle
public Plugin:myinfo = { //My beautiful info
   name = "Thomasjosif's Cell opener",
   author = "[HG] Thomasjosif [M]",
   description = "",
   url = "https://hellsgamers.com"
};
public OnPluginStart() //Called when the plugin starts
{
   RegConsoleCmd("sm_cells", hg_cells,""); //Reg the command that everyone can use
   RegAdminCmd("sm_cellson", hg_cellson,ADMFLAG_UNBAN,""); //Debug commands that only people with the "unban flag" can use
   RegAdminCmd("sm_cellsoff", hg_cellsoff,ADMFLAG_UNBAN,"");
   HookEvent("round_start", OnRoundStart); //Hook round start
}
public OnRoundStart(Handle event, const char[] name, bool db) //Called on round start
{
   TP_Allowed = true; //Enables the command
   CreateTimer(30.0, Can_Use_TP,Handle:TPTIMER); //Creates a 30 second timer
}

public Action Can_Use_TP(Handle timer) //Timer callback
{
   TP_Allowed = false; //Disables the command
}
//
//
//Debug
//
//
public Action:hg_cellson(client, args)
{
   if(!TP_Allowed) //If teleport is auto disabled it will enable it
{
 TP_Enabled = true;
 TP_Allowed = true;
 PrintToChatAll("%s \x01 %N \x04 has manually re-enabled Warden's Office teleport.", HG, client);
 return Plugin_Handled;
}

else    //Does the same thing with a different message. This could have been compressed alot but again, this was my first plugin.
{
 TP_Enabled = true;
 TP_Allowed = true;
 PrintToChatAll("%s \x01 %N \x04 has manually enabled Warden's Office teleport.", HG, client); //%S is the string for HG which is our prefix. client is the client index of the person running the command which we can print with %N
 return Plugin_Handled; //Return that the plugin has successfully completed
}


}
public Action:hg_cellsoff(client, args) //opposite of the above command
{
if(!TP_Enabled)
{
 PrintToChat(client, "[\x04HG\x01]\x04 Teleport is allready manually disabled!"); //Manually used the prefix here for some reason.
 return Plugin_Handled;
}


else
   {
 TP_Enabled = false;
 TP_Allowed = false;
 PrintToChatAll("%s \x01 %N \x04 has manually disabled Warden's Office teleport.", HG, client);
 return Plugin_Handled;
}
}

//
//
//Command
//
//
public Action:hg_cells(client, args) //The command client is the client args although this is sourcemod 1.6 which is different from sourcemod 1.7 where it changes
{
if(!TP_Enabled) //If the command is disabled stop and print a message
{
 PrintToChat(client, "%s Command has been disabled.", HG)
 return Plugin_Handled
}

else if(!TP_Allowed) //If 30 seconds has passed stop and print a messages
   {
    PrintToChat(client, "%s Command cant be used past the first\x07 30 seconds \x04of the round!", HG);
    return Plugin_Handled;
   }


   else if(GetClientTeam(client) != CS_TEAM_CT) //If the client is on spec/t do not allow it
   {
    PrintToChat(client, "%s Only Guards can teleport to the Warden's Office!", HG);
    return Plugin_Handled;
   }


   else //Everthing checks out here lets go to the next sptep
   {
    if(!IsPlayerAlive(client)) //Are they alive?
 }
  PrintToChat(client, "%s You must be alive to teleport to the Warden's Office!", HG);
	    return Plugin_Handled;
 }

 else //Lets teleport them now.
 {
  TeleportEntity(client, Office, NULL_VECTOR , NULL_VECTOR);
  PrintToChat(client, "%s You have been teleported to the Warden's Office!", HG);
  return Plugin_Handled;
 }

   }
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share