Veteran Member
Join Date: Jan 2019
Location: Brazil
|
10-16-2019
, 16:50
Re: compile problem
|
#8
|
Aya, thanks for the video.
generals, code correction would look something like this, but it still doesn't make sense, because * if * is decompiled code, some information may have been lost during the reverse engineer.
Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#pragma semicolon 1
new String:mSEAGULL[20] = "models/seagull.mdl";
new String:mPIGEON[20] = "models/pigeon.mdl";
new bool:hooked;
new birdindex[15];
public OnMapStart()
{
decl String:sBuffer[32];
GetCurrentMap(sBuffer, 32);
if (!strcmp(sBuffer, "de_dust2", true))
{
hooked = true;
HookEvent("round_start", RoundStart, EventHookMode:2);
CreateTimer(15.0, birdsong, any:0, 3);
PrecacheModel(mSEAGULL, false);
PrecacheModel(mPIGEON, false);
new i = 1;
while (i < 21)
{
FormatEx(sBuffer, 32, "ambient/animal/bird%d.wav", i);
PrecacheSound(sBuffer, false);
i++;
}
}
}
public Action:birdsong(Handle:timer)
{
decl i;
decl String:sBuffer[32];
decl Float:origin[3];
i = 0;
while (i < 15)
{
if (GetRandomInt(1, 100) > 80)
{
FormatEx(sBuffer, 32, "ambient/animal/bird%d.wav", GetRandomInt(1, 20));
GetEntPropVector(birdindex[i], PropType:0, "m_vecOrigin", origin, 0);
EmitAmbientSound(sBuffer, origin, birdindex[i], 75, 0, 1.0, 100, 0.0);
}
if (GetRandomInt(1, 100) > 87)
{
GetEntPropString(birdindex[i], PropType:1, "m_ModelName", sBuffer, 32, 0);
int var1;
if (sBuffer[1] == 's')
{
if (GetRandomInt(0, 1) == 1)
{
var1 = 1988;
}
else
{
var1 = 1992;
}
}
else
{
// if (GetRandomInt(0, 1) == 1)
// {
// var1 = 2000;
// }
var1 = 2008;
}
Format(sBuffer, 6, "%s", var1);
SetVariantString(sBuffer);
AcceptEntityInput(birdindex[i], "SetAnimation", -1, -1, 0);
}
i++;
}
return Action:0;
}
public RoundStart(Handle:event, String:name[], bool:dontBroadcast)
{
decl i;
decl func_rot;
decl bird;
i = 0;
decl String:sTargetName[32];
decl String:sSpeed[8];
decl String:sModel[32];
new birdspeed;
new Float:angels[3] = 0.0;
new Float:func_rot_coords[15][3];
new Float:birds_angels[15][3];
new Float:birds_coords[15][3];
new bool:reverse;
while (i < 15)
{
func_rot = CreateEntityByName("func_rotating", -1);
DispatchKeyValueVector(func_rot, "origin", func_rot_coords[i]);
birdspeed = GetRandomInt(14, 18);
FormatEx(sSpeed, 6, "%d", birdspeed);
FormatEx(sTargetName, 32, "gull_%d", func_rot);
DispatchKeyValue(func_rot, "targetname", sTargetName);
DispatchKeyValue(func_rot, "spawnflags", "64");
DispatchKeyValue(func_rot, "maxspeed", sSpeed);
DispatchSpawn(func_rot);
reverse = GetRandomInt(1, 100) > 85;
if (reverse)
{
new z;
while (z < 3)
{
angels[z] = birds_angels[i][z];
z++;
}
switch (angels[1])
{
case 0:
{
angels[1] = 180.0;
}
case 1119092736:
{
angels[1] = 270.0;
}
case 1132920832:
{
angels[1] = 90.0;
}
default:
{
}
}
}
bird = CreateEntityByName("prop_dynamic_override", -1);
DispatchKeyValueVector(bird, "origin", birds_coords[i]);
new Float:var1[3];
if (reverse)
{
var1 = angels;
}
else
{
var1 = birds_angels[i];
}
DispatchKeyValueVector(bird, "angles", var1);
new var2;
if (GetRandomInt(1, 100) > 80)
{
var2 = 1796;
}
else
{
var2 = 1776;
}
//FormatEx(sModel, 32, var2);
Format(sModel, 6, "%s", var2);
DispatchKeyValue(bird, "model", sModel);
new var3;
if (sModel[1] == 's')
{
if (birdspeed > 16)
{
var3 = 2160;
}
else
{
var3 = 2164;
}
}
else
{
// if (birdspeed > 16)
// {
// var3 = 2172;
// }
var3 = 2180;
}
FormatEx(sSpeed, 6, "%s", var3);
DispatchKeyValue(bird, "DefaultAnim", sSpeed);
DispatchSpawn(bird);
SetVariantString(sTargetName);
AcceptEntityInput(bird, "SetParent", -1, -1, 0);
AcceptEntityInput(func_rot, "Start", -1, -1, 0);
if (reverse)
{
AcceptEntityInput(func_rot, "Reverse", -1, -1, 0);
}
birdindex[i] = bird;
i++;
}
return 0;
}
public OnMapEnd()
{
if (hooked)
{
UnhookEvent("round_start", RoundStart, EventHookMode:2);
hooked = false;
}
}
__________________
Last edited by Marttt; 10-16-2019 at 16:52.
|
|