Sziasztok Nos van nekem ZyZu minigameja
Én ezt úgy szeretném hogy mikkor beírják hogy /minigame akkor dialogból keljen indítani
Így képzelem el
/minigame
-ekkor elõ jön a dialog ebenn az InfernusGame
És ha rákattint akkor csatlakozzon a minigame-ba
Ha egy 2. személy írja be hogy /minigame akkor azt már dobja be simán
Minigame Scipt amibe a dialogus kellene :
#include <a_samp>
#include <foreach>
#include <zcmd>
#include <fixchars>
#pragma tabsize 0
new SUMO[MAX_PLAYERS];
new SUMOCAR2[MAX_PLAYERS];
new SumoStarted;
new SumoSpawn;
new Roman[MAX_PLAYERS];
new SumoCar[MAX_PLAYERS];
new SumoTimer;
new SumoSec;
new SumoPlayers;
new InSumo[MAX_PLAYERS];
new Float:SumoSpawn2 [][4] =
{
{1522.0123,-3025.6169,5.2285},
{1523.2094,-3038.2798,5.1285},
{1524.9541,-3056.7307,5.1285},
{1494.0792,-3060.0000,5.0285},
{1499.3036,-3027.4492,5.0285},
{1496.6000,-3040.4119,5.1285}
};
#define CashWin 10000
#define COLOR_PIROS 0xFF0000AA
#define SZIN_NYERT 0xeb12d9AA //LILA
#define SZIN_CSATLAKOZOTT 0xffae00AA //NARANCS
/*
KIESETT {00fff7}
Játékos {ff0000}
MINIGAME {fff700}
*/
public OnPlayerConnect(playerid)
{
InSumo[playerid] =0;
SUMO[playerid]=0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
SUMO[playerid]=0;
if(InSumo[playerid] == 1)
{
DestroyVehicle(SumoCar[playerid]);
SumoPlayers--;
InSumo[playerid] = 0;
new string[1900];
if(Roman[playerid] == 0)
{
format(string, sizeof(string), \"%s {00fff7}kiesett a minigameból!\", Name(playerid));
SetPlayerPos(playerid,-1372.7501,-263.4500,14.1484);
}
SendClientMessageToAll(COLOR_PIROS,string);
if(SumoPlayers == 1)
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(InSumo == 1)
{
if(Roman[playerid] == 0)
{
format(string, sizeof(string), \"{ff0000}%s {cccccc}megnyerte a minigame játékot! Nyereménye: {3399ff}+%d{cccccc}$\", Name(i),CashWin);
}
SendClientMessageToAll(COLOR_PIROS,string);
GivePlayerMoney(i,CashWin);
SumoPlayers--;
InSumo[playerid] = 0;
SUMO[playerid]=0;
SumoPlayers = 0;
SumoStarted = 0;
DestroyVehicle(SumoCar);
SetTimerEx(\"SpawnPP\",1000,0,\"i\",i);
InSumo = 0;
}
}
}
}
return 1;
}
forward SumoRandomCar(playerid);
public SumoRandomCar(playerid)
{
new pRandom = random(sizeof(SumoSpawn2));
new vRandom = random(5);
switch (vRandom)
{
case 0:
{
DestroyVehicle(SUMOCAR2[playerid]);
SUMOCAR2[playerid] = CreateVehicle(415,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999);}
case 1:
{
DestroyVehicle(SUMOCAR2[playerid]);
SUMOCAR2[playerid] = CreateVehicle(415,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999);}
case 2:
{
DestroyVehicle(SUMOCAR2[playerid]);
SUMOCAR2[playerid] = CreateVehicle(415,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999);}
case 3:
{
DestroyVehicle(SUMOCAR2[playerid]);
SUMOCAR2[playerid] = CreateVehicle(415,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999);}
case 4:
{
DestroyVehicle(SUMOCAR2[playerid]);
SUMOCAR2[playerid] = CreateVehicle(415,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999);}
}
return SUMOCAR2[playerid];
}
public OnPlayerUpdate(playerid)
{
if(InSumo[playerid]==1)
{
new Float:x,Float:y,Float:z;
if(GetPlayerPos(playerid,x,y,z) && z < -1.0)
{
RemovePlayerFromVehicle(playerid);
SUMO[playerid]=0;
if(InSumo[playerid] == 1)
{
DestroyVehicle(SumoCar[playerid]);
SumoPlayers--;
InSumo[playerid] = 0;
new string[128];
if(Roman[playerid] == 0)
{
format(string, sizeof(string), \"%s {cccccc}kiesett a minigameból!\", Name(playerid));
}
SendClientMessageToAll(COLOR_PIROS,string);
if(SumoPlayers == 1)
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(InSumo == 1)
{
if(Roman[playerid] == 0)
{
format(string, sizeof(string), \"{ff0000}%s {cccccc}megnyerte a minigame játékot! Nyereménye: +%d{cccccc}$\", Name(i),CashWin);
}
SendClientMessageToAll(COLOR_PIROS,string);
GivePlayerMoney(i,CashWin);
SumoPlayers = 0;
SumoStarted = 0;
DestroyVehicle(SumoCar);
SetTimerEx(\"SpawnPP\",1000,0,\"i\",i);
InSumo = 0;
}
}
}
}
return 1;
}
}
return true;
}
//PARANCS=========================================================
CMD:minigame(playerid,params[])
{
if(InSumo[playerid] == 0)
{
if(SumoStarted == 0)
{
if(Roman[playerid] == 0)
{
SendClientMessageToAll(0x6495EDAA,\"{3399ff}Minigame elindúlt{ff0000}(/minigame) {cccccc}funckiót!\");
}
SumoStarted=1;
InSumo[playerid] = 1;
SumoSpawn=2;
SumoTimer = SetTimer(\"StartSumo\",600,1);
SumoSec = 20;
TogglePlayerControllable(playerid,0);
PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
SumoPlayers = 1;
}else
if(SumoStarted == 1)
{
SumoPlayers++;
if(SumoSpawn == 2)
{
SumoSpawn=3;
PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
InSumo[playerid] = 1;
TogglePlayerControllable(playerid,0);
}else
if(SumoSpawn == 3)
{
SumoSpawn=4;
PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
InSumo[playerid] = 1;
TogglePlayerControllable(playerid,0);
}else
if(SumoSpawn == 4)
{
SumoSpawn=5;
PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
InSumo[playerid] = 1;
TogglePlayerControllable(playerid,0);
}else
if(SumoSpawn == 5)
{
SumoSpawn=6;
PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
InSumo[playerid] = 1;
TogglePlayerControllable(playerid,0);
}else
if(SumoSpawn == 6)
{
SumoSpawn=7;
PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
InSumo[playerid] = 1;
TogglePlayerControllable(playerid,0);
}else
if(SumoSpawn == 7)
{
SumoSpawn=8;
PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
InSumo[playerid] = 1;
TogglePlayerControllable(playerid,0);
}else
if(SumoSpawn ==
{
SumoSpawn=9;
PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
InSumo[playerid] = 1;
TogglePlayerControllable(playerid,0);
}else
if(SumoSpawn == 9)
{
SumoSpawn=10;
KillTimer(SumoTimer);
PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
InSumo[playerid] = 1;
SumoStarted = 2;
SendClientMessageToAll(0xAA3333AA,\"{cccccc}Kiestél a játéból! {3399ff}Infernus Dreby {cccccc}elíndult! Csatlakozáshoz {11ff00}(/minigame)\");
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(InSumo == 1)
{
TogglePlayerControllable(i,1);
GameTextForPlayer(i,\"~r~~h~Kiestél!\",3000,3);
SetTimerEx(\"Eliminat\",500,0,\"i\",i);
return 1;
}
return 1;
}
}
}else SendClientMessage(playerid,0xAA3333AA,\"{3399ff}A Minigame {cccccc}már elindult!\");
}else SendClientMessage(playerid,0xAA3333AA,\"{cccccc}Te már a {3399ff}Minigameban vagy!\");
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(InSumo[playerid] == 1)
{
DestroyVehicle(SumoCar[playerid]);
SumoPlayers--;
InSumo[playerid] = 0;
new string [1900];
if(Roman[playerid] == 0)
{
//format(string, sizeof(string), \"%s {cccccc}felrobbant a kocsija a minigameban ezért kiesett!\", Name(playerid));
}
SendClientMessageToAll(COLOR_PIROS,string);
if(SumoPlayers == 1)
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(InSumo == 1)
{
if(Roman[playerid] == 0)
{
format(string, sizeof(string), \"{cccccc}Ezt a játékot {ff0000}\'%s\' {cccccc}nyerte meg! Nyereménye: {3399ff}+%d{cccccc}$\", Name(i),CashWin);
SetPlayerPos(playerid,-1372.7501,-263.4500,14.1484);
}
SendClientMessageToAll(COLOR_PIROS,string);
GivePlayerMoney(i,CashWin);
SumoPlayers = 0;
InSumo[playerid] = 0;
SumoStarted = 0;
new Float:x,Float:y,Float:z;
GetPlayerPos(i,x,y,z);
SetPlayerPos(i,x,y,z+1);
DestroyVehicle(SumoCar);
SetTimerEx(\"SpawnPP\",1000,0,\"i\",i);
TogglePlayerControllable(i,1);
InSumo = 0;
}
}
}
}
return 1;
}
public OnPlayerSpawn(playerid)
{
InSumo[playerid] =0;
if(SUMO[playerid]==1)
{
PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(InSumo[playerid] == 1)
{
PutPlayerInVehicle(playerid,SumoCar[playerid],0);
}
return 1;
}
forward StartSumo(playerid);
public StartSumo(playerid)
{
if(SumoSec > 1)
{
new time;
new strec[128];
SumoSec--;
time = (SumoSec);
format(strec, sizeof(strec), \"~h~~r~Minigame Kezdés %d\", time);
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(InSumo == 1)
{
GameTextForPlayer(i, strec, 3000, 3);
}
}
}
if(SumoSec == 1)
{
SumoSec = 0;
if(SumoPlayers >= 2)
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(InSumo == 1)
{
GameTextForPlayer(i, \"~h~~w~- START -\", 3000, 3);
KillTimer(SumoTimer);
TogglePlayerControllable(i,1);
SumoStarted=2;
SetTimerEx(\"Eliminat\",500,0,\"i\",i);
}
}
}else
if(SumoPlayers < 2)
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(InSumo == 1)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(i,x,y,z);
SetPlayerPos(i,x,y,z+1);
DestroyVehicle(SumoCar);
SetTimerEx(\"SpawnPP\",1000,0,\"i\",i);
KillTimer(SumoTimer);
InSumo =0;
TogglePlayerControllable(i,1);
}
}
SumoStarted=0;
if(Roman[playerid] == 0)
{
SendClientMessageToAll(0x6495EDAA,\"{fff700}MINIGAME: {ff0000}Legalább 2 játékos szûkséges!\");
SetPlayerPos(playerid,-1372.7501,-263.4500,14.1484);
}
}
}
return 1;
}
stock Name(playerid)
{
new name[24];
GetPlayerName(playerid,name,24);
return name;
}