Üdv!
Mi lehet a hiba?
Valami még mindig nem jó!
Egyszerûen hiába írom be a parancsot: Unkown Command
Mostmár nem tudom, mi lesz holnap estére 1000% hogy kellene a normális tüzijáték filterscripts!
Segítsetek!!
#include <a_samp>
#include <sscanf2>
#include <xFireworks>
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, \"\")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
new explosions[] = {0,2,4,5,6,7,8,9,10,13};
enum t_fwbattery {
inuse,
timer,
count,
Float:height,
hvar,
Float:windspeed,
Float:interval,
Float:pos[3],
machine
};
new batteries[50][t_fwbattery];
findempty()
{
for (new i=0;i<sizeof(batteries);i++) {
if (!batteries[inuse]) return i;
}
return -1;
}
GetSomeTime(id)
{
return floatround((400 + random(300)) * batteries[id][interval]);
}
forward machinetimer(id);
public machinetimer(id)
{
if (batteries[id][count]) {
CreateFirework(batteries[id][pos][0],batteries[id][pos][1],batteries[id][pos][2], //pozicíó
batteries[id][height] - batteries[id][hvar]/2 + random(batteries[id][hvar]), //magassága
random(360),batteries[id][windspeed], //szélessége
50.0, //sebesség
explosions[random(sizeof(explosions))],100.0); //robbanás
batteries[id][count]--;
batteries[id][timer] = SetTimerEx(\"machinetimer\",GetSomeTime(id),false,\"i\",id);
} else {
KillTimer(batteries[id][timer]);
batteries[id][timer] = -1;
batteries[id][inuse] = false;
DestroyObject(batteries[id][machine]);
}
}
public OnFilterScriptInit()
{
for (new i=0;i<sizeof(batteries);i++) {
batteries[inuse] = false;
}
print(\" Tuzijatek Script By Martok es Secur\");
}
public OnFilterScriptExit()
{
for (new i=0;i<sizeof(batteries);i++) {
DestroyObject(batteries[machine]);
}
}
dcmd_fwspawn(playerid, params[])
{
new c, id, Float:h, hv, Float:w, Float:in;
if (sscanf(params, \"ififf\",c,h,hv,w,in)) {
SendClientMessage(playerid, 0xFFFFFFFF, \"Használat: /fwspawn {tüzi száma} {magassága} {?hvar?} {szélessége} {tüzik közötti idõ}\");
SendClientMessage(playerid, 0xFFFFFFFF, \"Példa: /fwspawn 20 50.0 20 30.0 1.0\");
}
else {
id = findempty();
if (id<0) SendClientMessage(playerid, 0xFFFFFFFF, \"Kifogyott a tüzijáték!\");
else {
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,a);
GetXYInFrontOfPosition(x,y,a,1.0);
batteries[id][pos][0] = x;
batteries[id][pos][1] = y;
batteries[id][pos][2] = z;
batteries[id][count] = c;
batteries[id][height] = h;
batteries[id][hvar] = hv;
batteries[id][windspeed] = w;
batteries[id][interval] = in;
batteries[id][inuse] = true;
batteries[id][machine] = CreateObject(3267,x,y,z,0.0,0.0,0.0);
new tmp[256];
format(tmp,sizeof(tmp),\"A tüzijáték elhelyezve. Hely: %d\", id);
SendClientMessage(playerid, 0x55FF55FF, tmp);
}
}
return 1;
}
dcmd_fwfire(playerid, params[])
{
new id;
if (sscanf(params, \"i\",id) || id>sizeof(batteries) || id<0) SendClientMessage(playerid, 0xFFFFFFFF, \"Használat: /fwfire {ID}\");
else {
batteries[id][timer] = SetTimerEx(\"machinetimer\",GetSomeTime(id),false,\"i\",id);
SendClientMessage(playerid, 0xFFFFFFFF, \"Tüzijáték kilõve.\");
}
return 1;
}
dcmd_fwfireall(playerid, params[])
{
#pragma unused params
#pragma unused playerid
for (new i=0; i<sizeof(batteries); i++) {
if (batteries[inuse]) {
batteries[timer] = SetTimerEx(\"machinetimer\",GetSomeTime(i),false,\"i\",i);
}
}
SendClientMessage(playerid, 0xFFFFFFFF, \"Az összes tüzijáték kilõve.\");
return 1;
}
dcmd_fwkill(playerid, params[])
{
new id;
if (sscanf(params, \"i\",id) || id>sizeof(batteries) || id<0) SendClientMessage(playerid, 0xFFFFFFFF, \"Usage: /fwfire {ID}\");
else {
KillTimer(batteries[id][timer]);
batteries[id][inuse] = false;
DestroyObject(batteries[id][machine]);
SendClientMessage(playerid, 0xFFFFFFFF, \"A tüzijáték besûlt.\");
}
return 1;
}
dcmd_fwkillall(playerid, params[])
{
#pragma unused params
#pragma unused playerid
for (new i=0; i<sizeof(batteries); i++) {
if (batteries[inuse]) {
KillTimer(batteries[timer]);
batteries[inuse] = false;
DestroyObject(batteries[machine]);
}
}
SendClientMessage(playerid, 0xFFFFFFFF, \"Az összes tüzijáték besûlt.\");
return 1;
}
dcmd_fwsave(playerid, params[])
{
new filename[20],tmp[256];
if (sscanf(params, \"s\",filename)) SendClientMessage(playerid, 0xFFFFFFFF, \"Használat: /fwsave {NAME}\");
else {
format(tmp,sizeof(tmp),\"%s.firework\",filename);
new File:f = fopen(tmp,io_write);
for (new i=0; i<sizeof(batteries); i++) {
if (batteries[inuse]) {
format(tmp, sizeof(tmp), \"%f %f %f %d %f %d %f %f\\r\\n\",
batteries[pos][0],
batteries[pos][1],
batteries[pos][2],
batteries[count],
batteries[height],
batteries[hvar],
batteries[windspeed],
batteries[interval]);
fwrite(f, tmp);
}
}
fclose(f);
SendClientMessage(playerid, 0xFFFFFFFF, \"Tüzijáték elmentve.\");
}
return 1;
}
dcmd_fwload(playerid, params[])
{
new filename[20],tmp[256];
if (sscanf(params, \"s\",filename)) SendClientMessage(playerid, 0xFFFFFFFF, \"Használat: /fwload {NAME}\");
else {
format(tmp,sizeof(tmp),\"%s.firework\",filename);
if (!fexist(tmp)) SendClientMessage(playerid, 0xFFFFFFFF, \"A fálj nem található!\");
else {
new id;
new File:f = fopen(tmp,io_read);
while(fread(f, tmp)) {
id = findempty();
if (id<0) {
SendClientMessage(playerid, 0xFFFFFFFF, \"Elfogyott a hely...\");
return 1;
}
batteries[id][inuse] = true;
sscanf(tmp, \"fffififf\",
batteries[id][pos][0],
batteries[id][pos][1],
batteries[id][pos][2],
batteries[id][count],
batteries[id][height],
batteries[id][hvar],
batteries[id][windspeed],
batteries[id][interval]);
batteries[id][machine] = CreateObject(3267,batteries[id][pos][0],batteries[id][pos][1],batteries[id][pos][2],0.0,0.0,0.0);
}
fclose(f);
SendClientMessage(playerid, 0xFFFFFFFF, \"Tüzijáték betöltve.\");
}
}
return 1;
}
dcmd_fwnight(playerid, params[])
{
#pragma unused params
#pragma unused playerid
SetWorldTime(0);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
SetPlayerTime(playerid,0,0);
}
return SendClientMessageToAll(0xDDDD11FF,\"Az egész szerveren 0:00 van!\");
}
dcmd_fwhelp(playerid, params[])
{
#pragma unused params
SendClientMessage(playerid, 0xDDDD11FF, \"Tüzijáték parancsok:\");
SendClientMessage(playerid, 0xDDDD11FF, \"/fwspawn - tüzijáték készítése\");
SendClientMessage(playerid, 0xDDDD11FF, \"/fwfire - tüzijáték kilövése\");
SendClientMessage(playerid, 0xDDDD11FF, \"/fwkill - tüzijáték besütve\");
SendClientMessage(playerid, 0xDDDD11FF, \"/fwfireall - összes tüzijáték kilövése\");
SendClientMessage(playerid, 0xDDDD11FF, \"/fwkillall - összes tüzijáték besütve\");
SendClientMessage(playerid, 0xDDDD11FF, \"/fwsave - tüzijáték mentése/felûlírása\");
SendClientMessage(playerid, 0xDDDD11FF, \"/fwload - tüzijáték betöltése\");
SendClientMessage(playerid, 0xDDDD11FF, \"/fwnight - éjfél lesz\");
return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
if(IsPlayerAdmin(playerid) || CallRemoteFunction(\"GetPlayerLevel\",\"i\",playerid)>2)
{
dcmd(fwhelp,6,cmdtext);
dcmd(fwspawn,7,cmdtext);
dcmd(fwfire,6,cmdtext);
dcmd(fwkill,6,cmdtext);
dcmd(fwfireall,9,cmdtext);
dcmd(fwkillall,9,cmdtext);
dcmd(fwsave,6,cmdtext);
dcmd(fwload,6,cmdtext);
dcmd(fwnight,7,cmdtext);
}
return 0;
}
public OnObjectMoved(objectid)
{
xFireworks_OnObjectMoved(objectid);
}