|
BANNED
|
10-06-2016
, 16:03
Re: [ANY?] Contracts
|
#28
|
Arkarr, buddy, you don't need multiple versions of the same plugin for different games. Just use EngineVersion! Trust me, it works. It's the same system I'm using in my Chat-Processor Tags plugin (which I removed as I'm recoding it to use MoreColors because ColorVariables has too many nuances and bugs in it right now)
EngineVersion usage snippet inside
PHP Code:
#include <sourcemod>
#pragma semicolon 1 #pragma newdecls required
// Set up g_EngineVersion globally EngineVersion g_EngineVersion;
// Determine engine version here. public APLRes AskPluginLoad2(Handle hMyself, bool bLate, char[] strError, int iErrMax) { g_EngineVersion = GetEngineVersion();
return APLRes_Success; }
// I also added it here in a plugin I'm testing, just in case. public void OnPluginStart() { g_EngineVersion = GetEngineVersion(); // And here's a small example of how to use it: switch(g_EngineVersion) { case Engine_TF2: { PrintToChatAll("[SM] Engine detected as Team Fortress 2!"); } case Engine_CSGO: { PrintToChatAll("[SM] Engine detected as Counter-Strike: Global Offensive!"); } default: { PrintToChatAll("[SM] Fiddlesticks! What engine is this?"); } } }
// Now let's say you want to print a message, but have it automatically configure itself based on the engine. Simple! // Let's take your existing "sm_contract" command, and make it...GLORIOUS!
public Action CMD_DisplayContractInfo(int client, int args) { if (!IsValidClient(client)) return Plugin_Handled; if (!IsInContract[client]) { CPrintToChat(client, "%s You don't have any contract now.", PLUGIN_TAG); return Plugin_Handled; } if(g_EngineVersion == Engine_CSGO) { CPrintToChat(client, "%s Your current mission is : %s", PLUGIN_TAG, contractDescription[client]); CPrintToChat(client, "%s Your contract progresse is : \x07%i\x01/\x07%i\x01", PLUGIN_TAG, contractProgress[client], contractObjective[client]); CPrintToChat(client, "%s You will be rewarded with \x07%i\x01 credits.", PLUGIN_TAG, contractReward[client]); } else if(g_EngineVersion == Engine_TF2) { CPrintToChat(client, "%s Your current mission is : %s", PLUGIN_TAG, contractDescription[client]); CPrintToChat(client, "%s Your contract progresse is : {red}%i{default}/{red}%i{default}", PLUGIN_TAG, contractProgress[client], contractObjective[client]); CPrintToChat(client, "%s You will be rewarded with {red}%i{default} credits.", PLUGIN_TAG, contractReward[client]); } return Plugin_Handled; }
Also, I'd remove the [ANY] tag from the plugin filename. Keep it simple!
Last edited by 404UserNotFound; 10-06-2016 at 16:04.
|
|
|
|