AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Translation Request (https://forums.alliedmods.net/forumdisplay.php?f=25)
-   -   Please help me (https://forums.alliedmods.net/showthread.php?t=308028)

a39719511 06-04-2018 01:26

Please help me
 
/*By:Lysis 修改:Cser↘ QQ:960537874*/
new PlVers:__version = 5;
new Float:NULL_VECTOR[3];
new String:NULL_STRING[1];
new Extension:__ext_core = 64;
new MaxClients;
new Extension:__ext_sdktools = 180;
new Handle:sg_hTeamScoreSDK;
new Handle:sg_hConf;
new Handle:sg_hGameMode;
new Handle:sg_hGiveItemTimer;
new Handle:cg_hGiveItemDelay;
new Handle:cg_hGameModeActive;
new sg_nRoundCounter;
new bool:sg_bBeforeMapStart = 1;
public __ext_core_SetNTVOptional()
{
MarkNativeAsOptional("GetFeatureStatus");
MarkNativeAsOptional("RequireFeature");
MarkNativeAsOptional("AddCommandListener");
MarkNativeAsOptional("RemoveCommandListener") ;
VerifyCoreVersion();
return 0;
}

public OnPluginStart()
{
PrepareAllSDKCalls();
sg_hGameMode = FindConVar("mp_gamemode");
HookEvent("round_start", EventHook:3, EventHookMode:1);
HookEvent("round_end", EventHook:1, EventHookMode:1);
cg_hGiveItemDelay = CreateConVar("l4d2_ig_delay", "10.0", "Item give delay from time when player enters the game. Float in Seconds.", 262400, true, 0, true, 120);
cg_hGameModeActive = CreateConVar("l4d2_gamemodesactive", "versus,teamversus,mutation12", " Set the game modes for which the plugin should be activated (same usage as sv_gametypes, i.e. add all game modes where you want it active separated by comma) ", 0, false, 0, false, 0);
AutoExecConfig(true, "L4D2_RoundStartGiveItems", "sourcemod");
GetMaxClients();
return 0;
}

public Action:EventRoundStart(Handle:event, String:name[], bool:dontBroadcast)
{
new nScoreA = TeamScore_GetCampaign(1);
new nScoreB = TeamScore_GetCampaign(2);
decl String:sCurrentMap[32];
decl String:sGameMode[64];
decl String:sGameModeActive[64];
GetConVarString(sg_hGameMode, sGameMode, 64);
GetConVarString(cg_hGameModeActive, sGameModeActive, 64);
if (StrContains(sGameModeActive, sGameMode, true) == -1)
{
return Action:0;
}
if (sg_bBeforeMapStart)
{
sg_nRoundCounter = 0;
}
else
{
sg_nRoundCounter = 1;
}
GetCurrentMap(sCurrentMap, 32);
new var2;
if (sg_nRoundCounter == 1)
{
sg_hGiveItemTimer = CreateTimer(GetConVarFloat(cg_hGiveItemDelay) , TimerHdr_GiveItem2LossTeam, any:0, 0);
}
else
{
sg_hGiveItemTimer = CreateTimer(GetConVarFloat(cg_hGiveItemDelay) , TimerHdr_GiveItem2WinTeam, any:0, 0);
}
return Action:0;
}

public Action:EventRoundEnd(Handle:event, String:name[], bool:dontBroadcast)
{
if (sg_hGiveItemTimer)
{
KillTimer(sg_hGiveItemTimer, false);
sg_hGiveItemTimer = 0;
}
return Action:0;
}

public Action:TimerHdr_GiveItem2LossTeam(Handle:time r)
{
if (timer != sg_hGiveItemTimer)
{
return Action:0;
}
sg_hGiveItemTimer = 0;
if (GetConVarInt(FindConVar("survivor_limit")) > GetNumOfSurvivorsInGame())
{
sg_hGiveItemTimer = CreateTimer(GetConVarFloat(cg_hGiveItemDelay) , TimerHdr_GiveItem2LossTeam, any:0, 0);
return Action:0;
}
GiveItem2EachSurvivor("rifle_m60");
GiveItem2EachSurvivor("sniper_awp");
GiveItem2EachSurvivor("first_aid_kit");
GiveItem2EachSurvivor("pain_pills");
return Action:0;
}

public Action:TimerHdr_GiveItem2WinTeam(Handle:timer )
{
if (timer != sg_hGiveItemTimer)
{
return Action:0;
}
sg_hGiveItemTimer = 0;
if (GetConVarInt(FindConVar("survivor_limit")) > GetNumOfSurvivorsInGame())
{
sg_hGiveItemTimer = CreateTimer(GetConVarFloat(cg_hGiveItemDelay) , TimerHdr_GiveItem2WinTeam, any:0, 0);
return Action:0;
}
GiveItem2EachSurvivor("first_aid_kit");
GiveItem2EachSurvivor("pain_pills");
return Action:0;
}

public OnMapStart()
{
sg_bBeforeMapStart = 0;
return 0;
}

public OnMapEnd()
{
sg_bBeforeMapStart = 1;
if (sg_hGiveItemTimer)
{
KillTimer(sg_hGiveItemTimer, false);
sg_hGiveItemTimer = 0;
}
return 0;
}

PrepareAllSDKCalls()
{
sg_hConf = LoadGameConfigFile("left4downtown.l4d2");
if (!sg_hConf)
{
ThrowError("Could not load gamedata/left4downtown.l4d2.txt");
}
StartPrepSDKCall(SDKCallType:3);
if (PrepSDKCall_SetFromConf(sg_hConf, SDKFuncConfSource:1, "GetTeamScore"))
{
PrepSDKCall_AddParameter(SDKType:4, SDKPassMethod:1, 0, 0);
PrepSDKCall_AddParameter(SDKType:8, SDKPassMethod:1, 0, 0);
PrepSDKCall_SetReturnInfo(SDKType:4, SDKPassMethod:1, 0, 0);
sg_hTeamScoreSDK = EndPrepSDKCall();
if (sg_hTeamScoreSDK)
{
DebugPrintToAll("[TEST] Function 'GetTeamScore' initialized.");
}
else
{
DebugPrintToAll("[TEST] Function 'GetTeamScore' found, but something went wrong.");
}
}
else
{
DebugPrintToAll("[TEST] Function 'GetTeamScore' not found.");
}
return 0;
}

DebugPrintToAll(String:format[])
{
if (format[0])
{
return 0;
}
return 0;
}

TeamScore_GetCampaign(nTeamNum)
{
if (sg_hTeamScoreSDK)
{
return SDKCall(sg_hTeamScoreSDK, nTeamNum, 1);
}
return -1;
}

GetNumOfSurvivorsInGame()
{
new NumRecvSurvivors = 0;
new client = 1;
while (client <= MaxClients) {
new var1;
if (IsClientInGame(client))
{
NumRecvSurvivors++;
client++;
}
client++;
}
return NumRecvSurvivors;
}

GiveItem2EachSurvivor(String:Item[24])
{
new NumRecvSurvivors = 0;
new client = 1;
while (client <= MaxClients) {
new var1;
if (IsClientInGame(client))
{
GiveItem(client, Item);
NumRecvSurvivors++;
client++;
}
client++;
}
return NumRecvSurvivors;
}

GiveItem(Client, String:Item[24])
{
new flags = GetCommandFlags("give");
SetCommandFlags("give", flags & -16385);
FakeClientCommand(Client, "give %s", Item);
SetCommandFlags("give", flags);
return 0;
}

Rivotril 06-04-2018 11:48

Re: Please help me
 
Help with what? this is a translation request for plugins, not for code helping

Relaxing 06-09-2018 18:00

Re: Please help me
 
This is SourceMOD homeboy.


All times are GMT -4. The time now is 02:25.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.