Nos van ez a minigame amit ZyZu fejlesztet nost nekem az kéne még belle, hogy ha valaki belép minigámebe akor tegye át más VW(Virtua lWorld) be nekem most az 5 be kéne és kocsikot is hoza le a VW 5 be. De csak a kocsikat akor hoza le amikor még csak 10 másodperc van a minigame kezdetéig.
It a minigame kod is
#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] =
{
{-2743.7407,2966.1292,96.4285},
{-2709.0752,2964.6453,96.4285},
{-2743.9507,2974.5449,79.4285},
{-2732.2539,3010.8418,79.4285},
{-2657.9302,2973.9077,84.5285},
{-2658.3806,3010.7927,84.4285},
{-2708.4668,3050.3093,92.7285},
{-2786.5059,2969.9612,110.0285},
{-2749.8640,3002.0945,110.1285},
{-2848.7261,3014.0283,117.7285}
};
#define ScoreWin 25
#define CashWin 1500
#define red 0xFF0000AA
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 {cccccc}kiesett a minigameból!\", Name(playerid));
SetPlayerPos(playerid,-1372.7501,-263.4500,14.1484);
}
SendClientMessageToAll(red,string);
if(SumoPlayers == 1)
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(InSumo == 1)
{
if(Roman[playerid] == 0)
{
format(string, sizeof(string), \"%s Megnyerte a minigame /minigame egy ujjabhoz\", Name(i),ScoreWin,CashWin);
}
SendClientMessageToAll(red,string);
SetPlayerScore(i,GetPlayerScore(i)+ScoreWin);
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(504,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999);}
case 1:
{
DestroyVehicle(SUMOCAR2[playerid]);
SUMOCAR2[playerid] = CreateVehicle(504,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999);}
case 2:
{
DestroyVehicle(SUMOCAR2[playerid]);
SUMOCAR2[playerid] = CreateVehicle(504,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999);}
case 3:
{
DestroyVehicle(SUMOCAR2[playerid]);
SUMOCAR2[playerid] = CreateVehicle(504,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999);}
case 4:
{
DestroyVehicle(SUMOCAR2[playerid]);
SUMOCAR2[playerid] = (504,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(red,string);
if(SumoPlayers == 1)
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(InSumo == 1)
{
if(Roman[playerid] == 0)
{
format(string, sizeof(string), \"%s Megnyerte a minigame /minigame egy ujjab inditásához\", Name(i),ScoreWin,CashWin);
}
SendClientMessageToAll(red,string);
SetPlayerScore(i,GetPlayerScore(i)+ScoreWin);
GivePlayerMoney(i,CashWin);
SumoPlayers = 0;
SumoStarted = 0;
DestroyVehicle(SumoCar);
SetTimerEx(\"SpawnPP\",1000,0,\"i\",i);
InSumo = 0;
}
}
}
}
return 1;
}
}
return true;
}
CMD:minigame(playerid,params[])
{
if(InSumo[playerid] == 0)
{
if(SumoStarted == 0)
{
if(Roman[playerid] == 0)
{
SendClientMessageToAll(0x6495EDAA,\"{3399ff}Minigame játék elindult! Csatlakozásért használad {ff0000}/minigame!\");
}
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}Car Sumo Minigame {cccccc}elíndult!\");
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}Már benne vagy a {3399ff}Minigameban kilépésheyz /exitminigame!\");
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(red,string);
if(SumoPlayers == 1)
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(InSumo == 1)
{
if(Roman[playerid] == 0)
{
format(string, sizeof(string), \"%s Megnyerte a minigame /minigame\", Name(i),ScoreWin,CashWin);
SetPlayerPos(playerid,-1372.7501,-263.4500,14.1484);
}
SendClientMessageToAll(red,string);
SetPlayerScore(i,GetPlayerScore(i)+ScoreWin);
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,\"{3399ff}A Derby Minigame {cccccc}befejezdõdõtt! {3399ff}Indok: {cccccc}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;
}