Sziasztok nekem evel a minigameval van gondom: - Nem birom belõle kivenni a DontFall minigamet
- Nem tudom miert errorozik mikor compilezem a scriptet
#include <a_samp>
#include <zcmd>
#include <streamer>
#include <fixchars.h>
#undef MAX_PLAYERS
#define MAX_PLAYERS 20
#define DontFall 0
#define Derby 1
#define Format(%0,%1,%2) format(%0,sizeof(%0),%1,%2)
#define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
new bool:InMini,
bool:InCount,
bool:InVote,
bool:MinigameStarted,
bool:PlayerInMini[MAX_PLAYERS],
bool:PlayerInMap[MAX_PLAYERS],
bool:SpecSpawn[MAX_PLAYERS],
bool:MiniSpec[MAX_PLAYERS],
bool:MiniSpawn[MAX_PLAYERS],
CS[MAX_PLAYERS],
DerbyCars[8],
DontFallObjects[113],
DontFallObjects2[24],
DerbyObjects[28],
CurrentMini,
PlayersInMini,
MiniCountdown,
globalstr[300],
VotesDF,
VotesDerby,
PlayersInMap,
CountTimer;
new Float: DontFallCoords[][] =
{
{1741.80004883,-1179.90002441,684.70001221},
{1741.80004883,-1131.51013184,684.70001221},
{1745.80004883,-1163.69372559,684.70001221},
{1749.79980469,-1131.51013184,684.70001221},
{1725.79980469,-1136.91015625,684.70001221},
{1717.79980469,-1163.69372559,684.70001221},
{1713.79980469,-1179.89941406,684.70001221},
{1713.79980469,-1131.51013184,684.70001221}
};
new Float: DerbyCoords[][] =
{
{3303.39990234,-225.69999695,5.79999995,269.99963379},//1
{3377.39941406,-225.00000000,5.79999995,0.00000000},//2
{3376.59960938,-150.59960938,5.79999995,90.00000000},//3
{3302.00000000,-151.50000000,5.79999995,179.99450684},//4
{3322.69995117,-202.80000305,16.30000019,269.99450684},//5
{3356.10009766,-173.89999390,16.30000019,89.99414062},//6
{3325.19921875,-171.69921875,16.30000019,179.99450684},//7
{3354.10009766,-204.69999695,16.30000019,359.99414062}//8
};
forward CountDowning();
public CountDowning()
{
if(InCount == true)
{
for(new i; i < MAX_PLAYERS; i++)
{
if(InMini == true && InCount == true && PlayerInMini == true)
{
if(MiniCountdown >= 1)
{
new str[100];
Format(str,\"Kezdés: %d\",MiniCountdown);
GameTextForPlayer(i,str,1000,3);
}
else if(MiniCountdown == 0)
{
new str[100];
Format(str,\"GO!\",MiniCountdown);
GameTextForPlayer(i,str,3000,3);
TogglePlayerControllable(i,1);
if(CurrentMini == Derby)
{
for(new z; z < 9; z++)
{
SetVehiclePos(DerbyCars[z],DerbyCoords[z][0],DerbyCoords[z][1],DerbyCoords[z][2]); //Slamvan
SetVehicleZAngle(DerbyCars[z],DerbyCoords[z][3]);
}
}
}
}
}
if(MiniCountdown >= 1)
{
MiniCountdown--;
}
else if(MiniCountdown == 0)
{
KillTimer(CountTimer);
InCount = false;
MinigameStarted = true;
MiniStream();
}
}
return 1;
}
CMD:mini(playerid, params[])
{
if(PlayerInMini[playerid] == true) return SendClientMessage(playerid,-1,\"Minigame: Te már bent vagy a minijátékban!\");
if(InMini == true && MinigameStarted == true) return SendClientMessage(playerid,-1,\"Minigame: A minijáték már elkezdõdött!\");
if(PlayersInMini == 8)return SendClientMessage(playerid,-1,\"Minigame: A minijátékban nincs több hely!\");
AddPlayerToMinigame(playerid);
return 1;
}
forward CoordCheck();
public CoordCheck()
{
if(MinigameStarted == true && CurrentMini == DontFall)
{
Kezdes:
new rand = random(113);
new Float:xyzf[3];
GetDynamicObjectPos(DontFallObjects[rand],xyzf[0],xyzf[1],xyzf[2]);
if(xyzf[2] == 683.70001221)
{
new Float:pos[3];
GetDynamicObjectRot(DontFallObjects[rand],pos[0],pos[1],pos[2]);
SetDynamicObjectRot(DontFallObjects[rand],pos[0]+2,pos[1],pos[2]);
SetDynamicObjectRot(DontFallObjects[rand],pos[0]-2,pos[1]+2,pos[2]);
SetDynamicObjectRot(DontFallObjects[rand],pos[0],pos[1]-2,pos[2]);
SetTimerEx(\"CoordCheckEx\",2000,0,\"d\",rand);
}
else goto Kezdes;
}
}
forward CoordCheckEx(objindex);
public CoordCheckEx(objindex)
{
if(MinigameStarted == true && CurrentMini == DontFall)
{
new Float:xyzf[3];
GetDynamicObjectPos(DontFallObjects[objindex],xyzf[0],xyzf[1],xyzf[2]);
MoveDynamicObject(DontFallObjects[objindex],xyzf[0],xyzf[1],xyzf[2]-30,7.0);
}
}
stock SetPlayerMiniSpec(playerid)
{
PlayerInMap[playerid] = false;
SpecSpawn[playerid] = false;
TogglePlayerControllable(playerid,0);
SetPlayerPos(playerid,0.0,0.0,0.0);
MiniSpec[playerid] = true;
TogglePlayerSpectating(playerid,1);
switch(CurrentMini)
{
case DontFall:
{
for(new i; i < MAX_PLAYERS; i++)
if(IsPlayerConnected(i) && PlayerInMini == true && PlayerInMap == true)
{
PlayerSpectatePlayer(playerid,i);
CS[playerid] = i;
break;
}
}
case Derby:
{
for(new i; i < MAX_PLAYERS; i++)
if(IsPlayerConnected(i) && PlayerInMini == true && PlayerInMap == true && IsPlayerInAnyVehicle(i) == 1)
{
PlayerSpectateVehicle(playerid,GetPlayerVehicleID(i));
CS[playerid] = i;
break;
}
}
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_FIRE))
{
if(PlayerInMini[playerid] == true && MiniSpec[playerid] == true)
{
switch(CurrentMini)
{
case DontFall:
{
CS[playerid]--;
for(new i=CS[playerid]; i>-1; i--)
{
if(!IsPlayerConnected(i) || PlayerInMap == false) continue;
PlayerSpectatePlayer(playerid, i);
CS[playerid] = i;
break;
}
}
case Derby:
{
CS[playerid]--;
for(new i=CS[playerid]; i>-1; i--)
{
if(!IsPlayerConnected(i) || PlayerInMap == false || !IsPlayerInAnyVehicle(i)) continue;
PlayerSpectateVehicle(playerid, GetPlayerVehicleID(i));
CS[playerid] = i;
break;
}
}
}
}
}
if(PRESSED(KEY_HANDBRAKE))
{
if(PlayerInMini[playerid] == true && MiniSpec[playerid] == true)
{
switch(CurrentMini)
{
case DontFall:
{
CS[playerid]++;
for(new i=CS[playerid]; i<MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i) || PlayerInMap == false) continue;
PlayerSpectatePlayer(playerid, i);
CS[playerid] = i;
break;
}
}
case Derby:
{
CS[playerid]++;
for(new i=CS[playerid]; i<MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i) || PlayerInMap == false || !IsPlayerInAnyVehicle(i)) continue;
PlayerSpectateVehicle(playerid, i);
CS[playerid] = i;
break;
}
}
}
}
}
return 1;
}
public OnPlayerDeath(playerid)
{
if(PlayerInMini[playerid] == true)
{
if(IsPlayerInAnyVehicle(playerid))DestroyVehicle(GetPlayerVehicleID(playerid));
Format(globalstr,\"%s kiesett a játékból!\",pName(playerid));
for(new z; z < MAX_PLAYERS; z++)
{
if(PlayerInMini[z] == true)
{
SendClientMessage(z,-1,globalstr);
}
}
SpecSpawn[playerid] = true;
PlayersInMap--;
}
}
public OnPlayerDisconnect(playerid,reason)
{
if(PlayerInMini[playerid] == true)
{
if(IsPlayerInAnyVehicle(playerid))DestroyVehicle(GetPlayerVehicleID(playerid));
Format(globalstr,\"%s kiesett a játékból!\",pName(playerid));
for(new z; z < MAX_PLAYERS; z++)
{
if(PlayerInMini[z] == true)
{
SendClientMessage(z,-1,globalstr);
}
}
SpecSpawn[playerid] = true;
PlayersInMap--;
PlayersInMini--;
}
}
public OnPlayerSpawn(playerid)
{
if(PlayerInMini[playerid] == true && SpecSpawn[playerid] == true)
{
SetPlayerMiniSpec(playerid);
}
if(MiniSpawn[playerid] == true)
{
MiniSpawn[playerid] = false;
AddPlayerToMinigame(playerid);
}
}
forward ReSpawnPlayers();
public ReSpawnPlayers()
{
for(new i; i < MAX_PLAYERS; i++)
{
if(PlayerInMini == true)
{
TogglePlayerSpectating(i,0);
MiniSpawn = true;
SetCameraBehindPlayer(i);
MiniSpec = false;
SpecSpawn = false;
SpawnPlayer(i);
}
}
}
forward StartVoting();
public StartVoting()
{
InMini = true;
InCount = true;
InVote = false;
MinigameStarted = false;
PlayersInMap = 0;
new str[200];
new mininame[100];
new rand = random(2);
CurrentMini = rand;
StartMinigame(rand);
ReSpawnPlayers();
switch(rand)
{
case 0:strcat(mininame,\"Dont Fall\");
case 1:strcat(mininame,\"Derby\");
}
Format(str,\"A következõ játékot választotta ki a szerver következõnek: %s\");
for(new i; i < MAX_PLAYERS; i++)SendClientMessage(i,-1,str);
return 1;
}
forward MiniStream();
public MiniStream()
{
if(InMini == true && InCount == false && InVote == false && MinigameStarted == true)
{
switch(CurrentMini)
{
case DontFall:
{
CoordCheck();
if(PlayersInMap == 1 && PlayersInMini != 1)
{
InMini = true;
InCount = false;
InVote = false;
MinigameStarted = false;
for(new i; i < MAX_PLAYERS; i++)
{
if(PlayerInMap == true)
{
Format(globalstr,\"%s megnyerte a minijátékot ezért kapott 1 score-t!\",pName(i));
for(new z; z < MAX_PLAYERS; z++)
{
if(PlayerInMini[z] == true)
{
SendClientMessage(z,-1,globalstr);
}
}
SetPlayerMiniSpec(i);
SetPlayerScore(i,GetPlayerScore(i)+1);
}
}
StartVoting();
}
else if(PlayersInMap != 1 && PlayersInMini != 1)
{
new Float:positions[3];
for(new i; i < MAX_PLAYERS; i++)
{
if(PlayerInMini == true && PlayerInMap == true)
{
GetPlayerPos(i,positions[0],positions[1],positions[2]);
if(positions[2] < 680)
{
Format(globalstr,\"%s kiesett a játékból!\",pName(i));
for(new z; z < MAX_PLAYERS; z++)
{
if(PlayerInMini[z] == true)
{
SendClientMessage(z,-1,globalstr);
}
}
SetPlayerMiniSpec(i);
PlayersInMap--;
PlayerInMap = false;
}
}
}
}
else if(PlayersInMap <= 1 && PlayersInMini <= 1)
{
InMini = false;
InCount = false;
InVote = false;
MinigameStarted = false;
DeleteDontFallObjects();
for(new i; i < MAX_PLAYERS; i++)
{
if(PlayerInMini == true)
{
TogglePlayerControllable(i,1);
SetPlayerVirtualWorld(i,0);
PlayerInMini = false;
PlayersInMini--;
PlayersInMap--;
SpawnPlayer(i);
}
}
SendClientMessageToAll(-1,\"A minijáték nem kezdõdhetett el túl kevés játékos miatt\");
}
}
case Derby:
{
if(PlayersInMap == 1 && PlayersInMini != 1)
{
InMini = true;
InCount = false;
InVote = false;
MinigameStarted = false;
for(new i; i < MAX_PLAYERS; i++)
{
if(PlayerInMap == true)
{
Format(globalstr,\"%s megnyerte a minijátékot ezért kapott 1 score-t!\",pName(i));
for(new z; z < MAX_PLAYERS; z++)
{
if(PlayerInMini[z] == true)
{
SendClientMessage(z,-1,globalstr);
}
}
SetPlayerMiniSpec(i);
SetPlayerScore(i,GetPlayerScore(i)+1);
}
}
StartVoting();
}
if(PlayersInMap != 1 && PlayersInMini != 1)
{
new Float:positions[3];
for(new i; i < MAX_PLAYERS; i++)
{
if(PlayerInMini == true && PlayerInMap == true)
{
GetPlayerPos(i,positions[0],positions[1],positions[2]);
if(positions[2] < 1.2 || !IsPlayerInAnyVehicle(i))
{
Format(globalstr,\"%s kiesett a játékból!\",pName(i));
for(new z; z < MAX_PLAYERS; z++)
{
if(PlayerInMini[z] == true)
{
SendClientMessage(z,-1,globalstr);
}
}
DestroyVehicle(GetPlayerVehicleID(i));
SetPlayerMiniSpec(i);
PlayersInMap--;
PlayerInMap = false;
}
}
}
}
else if(PlayersInMap <= 1 && PlayersInMini <= 1)
{
InMini = false;
InCount = false;
InVote = false;
MinigameStarted = false;
DeleteDerbyObjects();
for(new i; i < MAX_PLAYERS; i++)
{
if(PlayerInMini == true)
{
TogglePlayerControllable(i,1);
SetPlayerVirtualWorld(i,0);
PlayerInMini = false;
PlayersInMini--;
PlayersInMap--;
SpawnPlayer(i);
}
}
SendClientMessageToAll(-1,\"Minigame: A minijáték nem kezdõdhetett el túl kevés játékos miatt\");
}
}
}
SetTimer(\"MiniStream\",900,false);
}
return 1;
}
forward StartMinigame(minigame);
public StartMinigame(minigame)
{
switch(minigame)
{
case DontFall:
{
SendClientMessageToAll(-1,\"Elindult a DontFall minijáték, csatlakozni a /mini paranccsal lehet!\");
InMini = true;
InCount = true;
MiniCountdown = 15;
PlayersInMini = 0;
PlayersInMap = 0;
CurrentMini = DontFall;
CountTimer = SetTimer(\"CountDowning\", 1000, 1);
LoadDontFallObjects();
}
case Derby:
{
SendClientMessageToAll(-1,\"Elindult a Derby minijáték, csatlakozni a /mini paranccsal lehet!\");
InMini = true;
InCount = true;
MiniCountdown = 15;
PlayersInMini = 0;
PlayersInMap = 0;
CurrentMini = Derby;
CountTimer = SetTimer(\"CountDowning\", 1000, 1);
LoadDerbyObjects();
}
}
return 1;
}
forward AddPlayerToMinigame(playerid);
public AddPlayerToMinigame(playerid)
{
if(InMini == true && InCount == true && InVote == false && MinigameStarted == false)
{
CS[playerid] = 0;
TogglePlayerControllable(playerid,0);
SetPlayerVirtualWorld(playerid,999);
PlayerInMini[playerid] = true;
PlayerInMap[playerid] = true;
PlayersInMini++;
printf(\"%s %d\",pName(playerid), playerid);
PlayersInMap++;
switch(CurrentMini)
{
case DontFall:
{
SetPlayerPos(playerid,DontFallCoords[PlayersInMini-1][0],DontFallCoords[PlayersInMini-1][1],DontFallCoords[PlayersInMini-1][2]);
SetPlayerTime(playerid,0,0);
}
case Derby:
{
DerbyCars[PlayersInMini-1] = CreateVehicle(535,DerbyCoords[PlayersInMini-1][0],DerbyCoords[PlayersInMini-1][1],DerbyCoords[PlayersInMini-1][2],DerbyCoords[PlayersInMini-1][3],-1,-1,15); //Slamvan
PutPlayerInVehicle(playerid,DerbyCars[PlayersInMini-1],0);
}
}
}
else if(InMini == false && InCount == false && InVote == false && MinigameStarted == false)
{
new allgames[]=\"Dont Fall Down\\nDerby\";
ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, \"Játék indítása\", allgames, \"Kiválaszt\", \"Kilép\");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 999)
{
if(response)
{
if(InMini == true)return SendClientMessage(playerid,-1,\"Most nem indíthatsz játékot!\");
switch(listitem)
{
case 0:
{
StartMinigame(DontFall);
}
case 1:
{
StartMinigame(Derby);
}
}
cmd_mini(playerid,\"\");
}
}
return 1;
}
CMD:exitmini(playerid)
{
if(PlayerInMini[playerid] == true)
{
PlayerInMini[playerid] = false;
PlayerInMap[playerid] = false;
SpecSpawn[playerid] = false;
MiniSpec[playerid] = false;
MiniSpawn[playerid] = false;
PlayersInMini--;
PlayersInMap--;
SetPlayerVirtualWorld(playerid,0);
TogglePlayerSpectating(playerid,0);
TogglePlayerControllable(playerid,0);
SpawnPlayer(playerid);
if(IsPlayerInAnyVehicle(playerid))DestroyVehicle(GetPlayerVehicleID(playerid));
return SendClientMessage(playerid,-1,\"Kiléptél a minijátékból!\");
}
else return SendClientMessage(playerid,-1,\"Nem vagy minijátékban!\");
}
CMD:varlist(playerid)
{
new str[200];
Format(str,\"InMini: %d\\nInCount: %d\\nInVote: %d\\nMinigameStarted: %d\\nPlayerInMini: %d\\nPlayersInMini: %d\\nCurrentMini:%d\",InMini,InCount,InVote,MinigameStarted,PlayerInMini[playerid],PlayersInMini,CurrentMini);
SendClientMessage(playerid,-1,str);
return 1;
}
Hiba:
C:\\DOCUME~1\\XPPRESP3\\LOCALS~1\\Temp\\Rar$DI00.375\\minigame3.pwn(4) : fatal error 100: cannot read from file: \"fixchars.h\"
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.