Helló! Eljött a nagy pillanat a kezdõk és mások számára
Még nyáron találtam egy témát egy román fórumon, hogy kéne neki egy jó minigame rendszer hát valaki írt neki egy példát így elkezdtem fejleszteni és megcsináltam a kiesést is már nem tudom melyik link az ha jól tudom a román fórum nem nagyon mûködik már ezért gondoltam publikálom és elkezdtem fejleszteni tovább. Vannak benne kisebb buggok például a timer a minigame csatlakozáskor valamikor be tud buggolni nem jöttem rá miért de én fejlesztettem de azt nem adom ki ám nem akarom senkinek sem a szerver színtét lerontani
(PDSS) és más szerver minigame rendszerét. Én tovább fejlesztettem és jobban megcsináltam kevesebb változó szerintem felesleges ennyi változó bele..
Az eredeti készítõ nevét nem tudom elmondani mert ez a szkript nekem nagyon réggen meg volt csak most találtam még kábé 2 hónapja így gondoltam publikálom, hogy legyen a fórumon egy kis öröm
Ez a szkript teli volt error -al és warning -al max 26 error volt benne és mindent javítottam. Sok Síkert a fejlesztésben!
° Eredeti Készítõ: Nem tudom.
° Fejlesztõ: ZyZu(én)
° Publikálás: 2012.11.27
° Idõ: 18:50
° Nap: Kedd!
° A mappot sajnos nem tudom kiírni mert már nincs meg
#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] =
{
{2986.4258,-274.3965,15.5085,178.9624},
{3004.4431,-274.2476,15.5085,180.5291},
{3021.7251,-274.9648,15.5185,178.9623},
{3022.0237,-349.7896,15.5185,359.1073},
{2986.5098,-349.7921,15.5185,359.4206},
{3004.5754,-314.8936,15.5085,357.8540},
{2998.1504,-345.6925,4.0185,90.8915},
{2958.0540,-345.6012,4.0185,268.2398},
{2957.8362,-354.5930,4.0185,267.2998},
{3031.9712,-355.1846,4.0185,89.3482},
{3038.5823,-310.8631,4.0185,89.3481},
{3041.1807,-272.9205,4.0185,175.8289},
{3021.3147,-272.9825,4.0185,179.2757},
{3000.3828,-272.5216,4.0185,181.1557},
{3021.8894,-307.8719,4.0185,0.0706},
{2957.9072,-310.5871,4.0185,270.4798},
{2957.8540,-328.2629,4.0185,268.9131}
};
#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), \"{ff0000}%s {cccccc}megnyerte a minigame játékot! Nyereménye: {3399ff}+%d {cccccc}Pont {3399ff}+100 {cccccc}és {3399ff}+%d{cccccc}$\", 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(466,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999);}
case 1:
{
DestroyVehicle(SUMOCAR2[playerid]);
SUMOCAR2[playerid] = CreateVehicle(466,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999);}
case 2:
{
DestroyVehicle(SUMOCAR2[playerid]);
SUMOCAR2[playerid] = CreateVehicle(466,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999);}
case 3:
{
DestroyVehicle(SUMOCAR2[playerid]);
SUMOCAR2[playerid] = CreateVehicle(466,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999);}
case 4:
{
DestroyVehicle(SUMOCAR2[playerid]);
SUMOCAR2[playerid] = CreateVehicle(466,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), \"{ff0000}%s {cccccc}megnyerte a minigame játékot! Nyereménye: {3399ff}+%d {cccccc}Pont {3399ff}+100 {cccccc}és {3399ff}+%d{cccccc}$\", 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 {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}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!\");
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), \"{cccccc}Ezt a játékot {ff0000}\'%s\' {cccccc}nyerte meg! Nyereménye: {3399ff}+%d {cccccc}pontot {3399ff}+50 {cccccc}és {3399ff}+%d{cccccc}$ pénzt!\", 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;
}