Én csak annyit edilteltem rajta h amit tudtam lefordítottam, és kijavítottam néhány buggot.
scriptet letöltheted innen :
http://data.hu/get/6976242/haym.pwnVagy innen:
//includes
#include <a_samp>
//defines
#define ConvertTime(%0,%1,%2,%3,%4) \\
new \\
Float: %0 = floatdiv(%1, 60000) \\
;\\
%2 = floatround(%0, floatround_tozero); \\
%3 = floatround(floatmul(%0 - %2, 60), floatround_tozero); \\
%4 = floatround(floatmul(floatmul(%0 - %2, 60) - %3, 1000), floatround_tozero)
#define ORANGE 0xDB881AAA
#define HAY_X 4
#define HAY_Y 4
#define HAY_Z 30
#define HAY_B 146
#define HAY_R 4
#define SPEED_FACTOR 3000.0
#define ID_HAY_OBJECT 3374
//forwards
forward TimerMove ();
forward TimerScore ();
forward FinishTimer (id, xq, yq, zq);
forward TDScore ();
//news
new JoinedHay[MAX_PLAYERS] = -1;
new WhatLevel[MAX_PLAYERS] = -1;
new TimeInHay[MAX_PLAYERS];
new Speed_xy;
new Speed_z;
new Center_x;
new Center_y;
new Matrix[HAY_X][HAY_Y][HAY_Z];
new Hays[HAY_B];
new Text:HAYTD[MAX_PLAYERS];
//publics/stocks
public OnGameModeInit()
{
print(\"\\n--------------------------------------\");
print(\" Hay Minigame By ScRaT\");
print(\"--------------------------------------\\n\");
RestartEveryThing ();
for(new i=0; i<MAX_PLAYERS; i++)
{
HAYTD = TextDrawCreate(549.000000,397.000000,\"~h~~y~Hay Minigame~n~~r~Szint: ~w~0/31 ~n~~r~Idõ: ~w~00:00:00\");
TextDrawFont(HAYTD , 1);
TextDrawSetProportional(HAYTD, 1);
TextDrawSetOutline(HAYTD, 0);
TextDrawColor(HAYTD,-65281);
TextDrawLetterSize(HAYTD ,0.310000,1.400000);
TextDrawTextSize(HAYTD , 640.000000,0.000000);
TextDrawAlignment(HAYTD,1);
TextDrawSetShadow(HAYTD, 0);
TextDrawUseBox(HAYTD, 1);
TextDrawBoxColor(HAYTD, 255);
TextDrawBackgroundColor(HAYTD, 255);
}
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
TextDrawHideForPlayer(playerid,HAYTD[playerid]);
JoinedHay[playerid] = 0;
return 1;
}
public OnPlayerConnect(playerid)
{
WhatLevel[playerid] = 0;
JoinedHay[playerid] = 0;
TextDrawHideForPlayer(playerid,HAYTD[playerid]);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
TextDrawHideForPlayer(playerid,HAYTD[playerid]);
return 1;
}
public OnPlayerSpawn(playerid)
{
JoinedHay[playerid] = 0;
SetPlayerWorldBounds(playerid, 20000.0000, -20000.0000, 20000.0000, -20000.0000);
TextDrawHideForPlayer(playerid,HAYTD[playerid]);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
TextDrawHideForPlayer(playerid,HAYTD[playerid]);
JoinedHay[playerid] = 0;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(\"/hay\", cmdtext, true, 10) == 0)
{
if(JoinedHay[playerid] == 0)
{
JoinedHay[playerid] = 1;
SetPlayerWorldBounds(playerid, 116.7788, -70.06725, 105.1009, -116.7788);
TimeInHay[playerid] = GetTickCount();
SetPlayerPos(playerid, 0, 6.5, 3.2);
SetPlayerFacingAngle( playerid, 135 );
SetPlayerVirtualWorld(playerid, 50);
ResetPlayerWeapons(playerid);
return 1;
}
if(JoinedHay[playerid] == 1)
{
JoinedHay[playerid] = 0;
SetPlayerWorldBounds(playerid, 20000.0000, -20000.0000, 20000.0000, -20000.0000);
SetPlayerVirtualWorld(playerid, 0);
TextDrawHideForPlayer(playerid,HAYTD[playerid]);
SpawnPlayer(playerid);
return 1;
}
return 1;
}
return 0;
}
RestartEveryThing ()
{
new xq, yq, zq;
new Number;
Speed_xy = 2000 / (HAY_Z + 1);
Speed_z = 1500 / (HAY_Z + 1);
for (new i=0 ; i<MAX_PLAYERS ; i++)
{
if (IsPlayerConnected (i))
{
WhatLevel = 0;
}
}
for (xq=0 ; xq<HAY_X ; xq++)
{
for (yq=0 ; yq<HAY_Y ; yq++)
{
for (zq=0 ; zq<HAY_Z ; zq++)
{
Matrix[xq][yq][zq] = 0;
}
}
}
for (Number=0 ; Number<HAY_B ; Number++)
{
do
{
xq = random (HAY_X);
yq = random (HAY_Y);
zq = random (HAY_Z);
}
while (Matrix[xq][yq][zq] != 0);
Matrix[xq][yq][zq] = 1;
Hays[Number] = CreateObject (ID_HAY_OBJECT, xq*(-4), yq*(-4), (zq+1)*3, 0.0, 0.0, random (2)*180,50);
}
Center_x = (HAY_X + 1) * -2;
Center_y = (HAY_Y + 1) * -2;
CreateObject (ID_HAY_OBJECT, Center_x, Center_y, HAY_Z*3 + 3, 0, 0, 0,50);
SetTimer (\"TimerMove\", 100, 0);
SetTimer (\"TDScore\", 1000, 1);
}
public TimerMove ()
{
new rand;
new Hay;
new Move = -1;
new xq, yq, zq;
new Float:x2, Float:y2, Float:z2;
new Timez;
new Float:Speed;
rand = random (HAY_B);
Hay = Hays[rand];
if(IsObjectMoving(Hay))
{
SetTimer (\"TimerMove\", 200, 0);
return 1;
}
Move = random (6);
GetObjectPos (Hay, x2, y2, z2);
xq = floatround (x2/-4.0);
yq = floatround (y2/-4.0);
zq = floatround (z2/3.0)-1;
if ((Move == 0) && (xq != 0) && (Matrix[xq-1][yq][zq] == 0))
{
Timez = 4000 - Speed_xy * zq;
Speed = SPEED_FACTOR / float (Timez);
SetTimerEx (\"FinishTimer\", Timez, 0, \"iiii\", rand, xq, yq, zq);
xq = xq - 1;
Matrix[xq][yq][zq] = 1;
MoveObject (Hay, x2+4.0, y2, z2, Speed);
}
else if ((Move == 1) && (xq != HAY_X-1) && (Matrix[xq+1][yq][zq] == 0))
{
Timez = 4000 - Speed_xy * zq;
Speed = SPEED_FACTOR / float (Timez);
SetTimerEx (\"FinishTimer\", Timez, 0, \"iiii\", rand, xq, yq, zq);
xq = xq + 1;
Matrix[xq][yq][zq] = 1;
MoveObject (Hay, x2-4.0, y2, z2, Speed);
}
else if ((Move == 2) && (yq != 0) && (Matrix[xq][yq-1][zq] == 0))
{
Timez = 4000 - Speed_xy * zq;
Speed = SPEED_FACTOR / float (Timez);
SetTimerEx (\"FinishTimer\", Timez, 0, \"iiii\", rand, xq, yq, zq);
yq = yq - 1;
Matrix[xq][yq][zq] = 1;
MoveObject (Hay, x2, y2+4.0, z2, Speed);
}
else if ((Move == 3) && (yq != HAY_Y-1) && (Matrix[xq][yq+1][zq] == 0))
{
Timez = 4000 - Speed_xy * zq;
Speed = SPEED_FACTOR / float (Timez);
SetTimerEx (\"FinishTimer\", Timez, 0, \"iiii\", rand, xq, yq, zq);
yq = yq + 1;
Matrix[xq][yq][zq] = 1;
MoveObject (Hay, x2, y2-4.0, z2, Speed);
}
else if ((Move == 4) && (zq != 0) && (Matrix[xq][yq][zq-1] == 0))
{
Timez = 3000 - Speed_z * zq;
Speed = SPEED_FACTOR / float (Timez);
SetTimerEx (\"FinishTimer\", Timez, 0, \"iiii\", rand, xq, yq, zq);
zq = zq - 1;
Matrix[xq][yq][zq] = 1;
MoveObject (Hay, x2, y2, z2-3.0, Speed);
}
else if ((Move == 5) && (zq != HAY_Z-1) && (Matrix[xq][yq][zq+1] == 0))
{
Timez = 3000 - Speed_z * zq;
Speed = SPEED_FACTOR / float (Timez);
SetTimerEx (\"FinishTimer\", Timez, 0, \"iiii\", rand, xq, yq, zq);
zq = zq + 1;
Matrix[xq][yq][zq] = 1;
MoveObject (Hay, x2, y2, z2+3.0, Speed);
}
else if ((Move == 6) && (zq != HAY_Z-1) && (Matrix[xq][yq][zq+1] == 0))
{
Timez = 3000 - Speed_z * zq;
Speed = SPEED_FACTOR / float (Timez);
SetTimerEx (\"FinishTimer\", Timez, 0, \"iiii\", rand, xq, yq, zq);
zq = zq + 1;
Matrix[xq][yq][zq] = 1;
MoveObject (Hay, x2, y2, z2+3.0, Speed);
}
SetTimer (\"TimerMove\", 200, 0);
return 1;
}
//==============================================================================
public FinishTimer (id, xq, yq, zq)
{
Matrix[xq][yq][zq] = 0;
}
//==============================================================================
public TimerScore ()
{
new Float:xq, Float:yq, Float:zq;
for (new i=0 ; i<MAX_PLAYERS ; i++)
{
if (IsPlayerConnected (i))
{
GetPlayerPos (i, xq, yq, zq);
if (xq<=2.0 && xq>=-15.0 && yq<=2.0 && yq>=-15.0)
{
new Level = (floatround (zq)/3) - 1;
WhatLevel = Level;
}
else
{
WhatLevel = 0;
}
}
}
}
public TDScore()
{
TimerScore();
new Level,string[256],PlayerN[MAX_PLAYER_NAME];
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(JoinedHay == 1)
{
new tH,tM,tS;
new TimeStamp = GetTickCount();
new TotalRaceTime = TimeStamp - TimeInHay;
ConvertTime(var, TotalRaceTime, tH, tM, tS);
Level = WhatLevel;
format(string,sizeof(string),\"~h~~y~Hay Minigame~n~~r~Szint: ~w~%d/31 ~n~~r~Ido: ~w~%02d:%02d\\
\",Level,tH,tM,tS);
TextDrawSetString(HAYTD, string);
TextDrawShowForPlayer(i, HAYTD);
if(WhatLevel == 31)
{
GetPlayerName(i, PlayerN, sizeof(PlayerN));
format(string, sizeof(string),\"[MINIGAME] %s Sikeresen végig játszottad a minigame-t %02d perc %02d másodperc alatt\", PlayerN,tH,tM,tS);
SendClientMessageToAll(ORANGE,string);
TextDrawHideForPlayer(i, HAYTD);
SetPlayerPos(i,0,0,0);
SpawnPlayer(i);
}
}
if(JoinedHay != 1)
{
TextDrawHideForPlayer(i, HAYTD);
}
}
}
return 1;
}