Snickers230
Wiek: 30 Na forum: 5069 dni Posty: 5
Nick w MP: Snickers
Piwa : 541
Cze??. Przedstawiam Wam skrypt m?odego czyli now? zabaw?, OneShoot - czyli "Jeden strza?".
Zabawa polega na zabiciu wszystkich uczestnik?w, kt?rzy s? na zabawie.
Aby OneShoot wystartowa?o, musz? by? zapisane minimalnie 4 osoby.
Mo?na bardzo ?atwo to zmieni?, w linicje
Kod:
#define MIN_OS 4". (4 zmieni? na inn? liczb?)
Po wystartowaniu zabawy usuwa nam armor, ustawia nam ?ycie na 25 HP oraz dostajemy Desert Eagle.
Jest jedna arena, ale bez problemu mo?na doda? inne. Nie robi?em ?adnych stref poniewa? zabawa jest w interiorze policji LV.
W dolnym, prawym (jak si? patrzy na monitor) rogu ekranu mamy TextDraw z ilo?ci? graczy zapisanych na OneShoot oraz czas kt?ry pozosta? do ko?ca zabawy.
Komendy s? napisane w zcmd by ZeeX, a do p?tli u?y?em foreach.
Prosz? si? nie czepia? o u?o?enie kodu, poniewa? ka?dy uk?ada kod jak chce.
Komendy:
/oneshoot - Zapisujemy si? na OneShoot.
/osexit - Wypisujemy si? z powy?szej zabawy.
Skrypt nie by? testowany, ale wszystko powinno dzia?a?.
Je?eli kto? ma jakie? pytania, to prosz? pyta?.
Kod Skryptu:
Kod:
#include <a_samp>
#include <zcmd>
#include <foreach>
#define MIN_OS 4 //Minimalna liczba graczy
#define START_OS 20 //Czas po jakim ma wystartowa? oneshoot
#define X 2140.1648 //LV - Pozycja X
#define Y 993.7104 //LV - Pozycja Y
#define Z 10.8203 //LV - Pozycja Z
new ZapisEvent[MAX_PLAYERS];
new BlockEvent[MAX_PLAYERS];
new ZapisanyOneshoot[MAX_PLAYERS];
new GraczyOneshoot;
new StartOneshoot;
new TimeOneshoot;
new TimerOneshoot;
new Text:Oneshoot;
new Float:RandomOnedeSpawn[][] =
{
{288.7459, 169.3509, 1007.1718},
{273.3204, 188.1061, 1007.1719},
{263.6746, 170.5629, 1003.0234},
{236.7647, 195.1310, 1008.1719},
{257.2431, 185.3781, 1008.1719},
{213.7057, 147.3681, 1003.0234},
{212.9781, 166.3744, 1003.0234},
{197.2282, 158.1888, 1003.0234},
{210.9119, 184.9424, 1003.0313}
};
public OnPlayerConnect(playerid)
{
ZapisanyOneshoot[playerid] = 0;
BlockEvent[playerid] = 0;
ZapisEvent[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid)
{
if(ZapisanyOneshoot[playerid] == 1) GraczyOneshoot--;
return 1;
}
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if(BlockEvent[playerid] == 1 && strcmp(cmdtext, "/osexit", true)) return SendClientMessage(playerid, -1, "Wpisz /osexit aby wyj?? z OneShoot."), 0;
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(StartOneshoot == 1)
{
if(ZapisanyOneshoot[playerid] == 1)
{
ZapisanyOneshoot[playerid] = 0;
ZapisEvent[playerid] = 0;
BlockEvent[playerid] = 0;
TextDrawHideForPlayer(playerid, Oneshoot);
}
GraczyOneshoot--;
}
return 1;
}
public OnFilterScriptInit()
{
StartOneshoot = 0;
Oneshoot = TextDrawCreate(519.000000, 344.000000, "Zabawa: Osob: Czas:");
TextDrawBackgroundColor(Oneshoot, 255);
TextDrawFont(Oneshoot, 1);
TextDrawLetterSize(Oneshoot, 0.519999, 1.099999);
TextDrawColor(Oneshoot, -1);
TextDrawSetOutline(Oneshoot, 0);
TextDrawSetProportional(Oneshoot, 1);
TextDrawSetShadow(Oneshoot, 1);
TextDrawUseBox(Oneshoot, 1);
TextDrawBoxColor(Oneshoot, 0x00000060);
TextDrawTextSize(Oneshoot, 607.000000, 0.000000);
return 1;
}
public OnFilterScriptExit()
{
for(new i = 0; i < GetMaxPlayers(); i++) TextDrawDestroy(Oneshoot);
return 1;
}
cmd(oneshoot, playerid, params[])
{
if(StartOneshoot == 1) return SendClientMessage(playerid, -1, "Zabawa OneShoot ju? wystartowa?a. ");
if(ZapisanyOneshoot[playerid] == 1) return SendClientMessage(playerid, -1, "Jeste? ju? zapisany na OneShoot. ");
if(ZapisEvent[playerid] == 1) return SendClientMessage(playerid, -1, "Jeste? zapisany na inn? zabawe. ");
SendClientMessage(playerid, -1, "Zapisa?e? si? na OneShoot. Aby si? wypisa? wpisz /osexit");
GraczyOneshoot++;
ZapisanyOneshoot[playerid] = 1;
ZapisEvent[playerid] = 1;
if(GraczyOneshoot == MIN_OS)
{
SendClientMessageToAll(-1, "Za 20 sekund wystartuje /OneShoot.");
SetTimer("StartujOneShoot", START_OS*1000, 0);
}
return 1;
}
cmd(osexit, playerid, params[])
{
if(ZapisanyOneshoot[playerid] == 0) return SendClientMessage(playerid, -1, "Nie jeste? zapisany na oneshoot. ");
if(StartOneshoot == 1)
{
if(ZapisanyOneshoot[playerid] == 1)
{
GraczyOneshoot--;
SetPlayerPos(playerid, X, Y, Z);
ZapisanyOneshoot[playerid] = 0;
BlockEvent[playerid] = 0;
ZapisEvent[playerid] = 0;
TextDrawHideForPlayer(playerid, Oneshoot);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
}
}
ZapisanyOneshoot[playerid] = 0;
BlockEvent[playerid] = 0;
ZapisEvent[playerid] = 0;
SendClientMessage(playerid, -1, "Wypisa?e? si? z /Oneshoot ");
return 1;
}
forward StartujOneShoot();
public StartujOneShoot()
{
StartOneshoot = 1;
SendClientMessageToAll(-1, "OneShoot wystartowa?o. ");
new LosujArene[1];
foreach(Player, i)
{
if(ZapisanyOneshoot[i] == 1)
{
TextDrawShowForPlayer(i, Oneshoot);
BlockEvent[i] = 1;
SetPlayerHealth(i, 25);
SetPlayerArmour(i, 0);
ResetPlayerWeapons(i);
GivePlayerWeapon(i, 24, 500);
switch(LosujArene[0])
{
case 0:
{
SetPlayerInterior(i, 3);
SetPlayerVirtualWorld(i, 15);
new rand = random(sizeof(RandomOnedeSpawn));
SetPlayerPos(i, RandomOnedeSpawn[rand][0], RandomOnedeSpawn[rand][1], RandomOnedeSpawn[rand][2]);
}
//case 1... itd.
}
}
}
TimeOneshoot = 0;
TimeOneshoot = 180;
KillTimer(TimerOneshoot);
TimerOneshoot = SetTimer("KonczOneshoot", 1000, 1);
return 1;
}
forward KonczOneshoot();
public KonczOneshoot()
{
TimeOneshoot--;
new string[128];
format(string, sizeof string, "~y~Zabawa: ~n~~g~Czas: ~b~%d~n~~g~Osob: ~b~%d", TimeOneshoot, GraczyOneshoot);
TextDrawSetString(Oneshoot, string);
if(TimeOneshoot == 0)
{
SendClientMessageToAll(-1, "Nikt nie wygra? oneshoot. Zapisy wznowione. ");
KillTimer(TimerOneshoot);
GraczyOneshoot = 0;
StartOneshoot = 0;
foreach(Player, i)
{
if(ZapisanyOneshoot[i] == 1)
{
ZapisanyOneshoot[i] = 0;
BlockEvent[i] = 0;
ZapisEvent[i] = 0;
TextDrawHideForPlayer(i, Oneshoot);
SetPlayerPos(i, X, Y, Z);
}
}
}
if(GraczyOneshoot == 1)
{
KillTimer(TimerOneshoot);
GraczyOneshoot = 0;
StartOneshoot = 0;
new string2[120];
foreach(Player, i)
{
if(ZapisanyOneshoot[i] == 1)
{
format(string2, sizeof string2, "Gracz %s [ID: %d] wygrywa OneShoot. Nagroda to 50000 $ oraz 50 respa. ", PlayerName(i), i);
SendClientMessageToAll(-1, string2);
SetPlayerScore(i, GetPlayerScore(i) +50);
GameTextForPlayer(i, "respekt~n~~g~+50", 1000, 1);
GivePlayerMoney(i, 50000);
ZapisanyOneshoot[i] = 0;
ZapisEvent[i] = 0;
BlockEvent[i] = 0;
TextDrawHideForPlayer(i, Oneshoot);
SetPlayerVirtualWorld(i, 0);
SetPlayerInterior(i, 0);
SetPlayerPos(i, X, Y, Z);
}
}
}
if(GraczyOneshoot == 0)
{
KillTimer(TimerOneshoot);
GraczyOneshoot = 0;
StartOneshoot = 0;
}
return 1;
}
stock PlayerName(playerid)
{
new name[24];
GetPlayerName(playerid, name, sizeof name);
return name;
}
Ostatnio zmieniony przez Iggy 2015-04-29, 16:20, w całości zmieniany 3 razy