-
Van egy alap reakció tesztem ami nem működik. CMD-be akartam hogy berakjam a gamemodeba...de filterscriptbe próbáltam először de nem működik.
HIBÁJA: Amikor beírom a tesztnek a megoldását nem írja ki hogy én nyertem és még a pénzt sem kapom meg.
#include <a_samp>
new szoveg[20];
new bool:reakcio;
new Teleportok[][] =
{
\"/spawnhely\",\"/groove\",\"/ls\",\"/sf\",\"/lv\",\"/lsair\",\"/sfair\",\"/lvair\",\"/banya\",\"/beach\",\"/dillimore\",\"/farm\",\"/blueberry\",
\"/palomino\",\"/lasbarrancas\",\"/bayside\",\"/elquebrados\",\"/fortcarson\",\"/bazis\",\"/sivatag\",\"/montgomery\",\"/angelpine\"
};
public OnFilterScriptInit()
{
print(\"\\n--------------------------------------\");
print(\" Blank Filterscript by your name here\");
print(\"--------------------------------------\\n\");
SetTimer(\"Reakcio\",60000,true);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerText(playerid, text[])
{
if(reakcio == true)
{
if(!strcmp(text,szoveg, true))
{
new String[128];
new Name[24];
GetPlayerName(playerid,Name,24);
format(String,128,\"%s megnyerte a reakciótesztet, nyereménye: 5000$\",Name);
SendClientMessageToAll(0xFFFF00AA,String);
GivePlayerMoney(playerid,5000);
SendClientMessage(playerid,0xFFFF00AA,\"A következő reakció teszt 1 perc múlva kezdődik\");
SetTimer(\"Reakcio\",60000,true);
reakcio = false;
return 0;
}
}
else if(reakcio == false)
{
SendClientMessage(playerid,0xFFFF00AA,\"A reakció tesztet már megoldották!\");
}
return 1;
}
forward Reakcio();
public Reakcio()
{
new String[128];
new rand = random(sizeof(Teleportok));
format(szoveg, 100, Teleportok[rand]);
format(String, 128, \"Reakció teszt! Szöveg: %s\", szoveg);
SendClientMessageToAll(-1,String);
reakcio = true;
SetTimer(\"Reakcio2\",300000,true);
}
forward Reakcio2(playerid);
public Reakcio2(playerid)
{
SendClientMessageToAll(0xFFFF00AA,\"Senki nem oldotta meg a reakció tesztet.\");
SendClientMessageToAll(0xFFFF00AA,\"A következő teszt 1 percen belül kezdődik!\");
SetTimer(\"Reakcio\",60000,true);
}
:OO :OO
-
Próbáld így:
#include <a_samp>
new szoveg[20];
new bool:reakcio;
new Teleportok[][] =
{
\"/spawnhely\",\"/groove\",\"/ls\",\"/sf\",\"/lv\",\"/lsair\",\"/sfair\",\"/lvair\",\"/banya\",\"/beach\",\"/dillimore\",\"/farm\",\"/blueberry\",
\"/palomino\",\"/lasbarrancas\",\"/bayside\",\"/elquebrados\",\"/fortcarson\",\"/bazis\",\"/sivatag\",\"/montgomery\",\"/angelpine\"
};
public OnFilterScriptInit()
{
print(\"\\n--------------------------------------\");
print(\" Blank Filterscript by your name here\");
print(\"--------------------------------------\\n\");
SetTimer(\"Reakcio\",60000,true);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerText(playerid, text[])
{
if(reakcio == true)
{
if(!strcmp(text, szoveg, true))
{
new String[128];
new Name[24];
GetPlayerName(playerid,Name,24);
format(String,128,\"%s megnyerte a reakciótesztet, nyereménye: 5000$\",Name);
SendClientMessageToAll(0xFFFF00AA,String);
GivePlayerMoney(playerid,5000);
SendClientMessage(playerid,0xFFFF00AA,\"A következő reakció teszt 1 perc múlva kezdődik\");
KillTimer(Reakcio2()); // ha valaki megoldotta, nem kell kiírnia hogy senki sem oldotta meg
SetTimer(\"Reakcio\",60000,true);
reakcio = false;
return 0;
}
}
else if(reakcio == false)
{
SendClientMessage(playerid,0xFFFF00AA,\"A reakció tesztet már megoldották!\");
}
return 1;
}
forward Reakcio();
public Reakcio()
{
new String[128], String2[20];
new rand = random(sizeof(Teleportok));
format(szoveg, 100, Teleportok[rand]);
format(String, 128, \"Reakció teszt! Szöveg: %s\", szoveg);
format(String2, sizeof(String2), \"%s\", Teleportok[rand]); // ugyan olyan \"nagyságúra\" hozzuk őket
szoveg = String2; // elmentjük a szoveg változóba a feladványt
SendClientMessageToAll(-1,String);
reakcio = true;
SetTimer(\"Reakcio2\",300000,true);
}
forward Reakcio2();
public Reakcio2()
{
SendClientMessageToAll(0xFFFF00AA,\"Senki nem oldotta meg a reakció tesztet.\");
SendClientMessageToAll(0xFFFF00AA,\"A következő teszt 1 percen belül kezdődik!\");
SetTimer(\"Reakcio\",60000,true);
}
-
[gmod]Figyeljetek oda a pawn tagekre.
[ /code ][/gmod]
[/quote]
-
Nem megy így sem.
-
#include <a_samp>
stock
reakcio_szam = -1,
idozito = -1;
stock const teleportok[][] =
{
\"/spawnhely\",\"/groove\",\"/ls\",\"/sf\",\"/lv\",\"/lsair\",\"/sfair\",
\"/lvair\",\"/banya\",\"/beach\",\"/dillimore\",\"/farm\",\"/blueberry\",
\"/palomino\",\"/lasbarrancas\",\"/bayside\",\"/elquebrados\",\"/fortcarson\",
\"/bazis\",\"/sivatag\",\"/montgomery\",\"/angelpine\"
};
main() {}
public OnGameModeInit()
{
SetTimer(\"reakcio\",60000,false);
return;
}
forward reakcio();
public reakcio()
{
if (reakcio_szam == -1)
{
reakcio_szam = random(sizeof(teleportok));
new str[50];
format(str,sizeof(str),\"Reakció teszt! Szöveg: %s\",teleportok[reakcio_szam]);
SendClientMessageToAll(-1,str);
idozito = SetTimer(\"reakcio\",300000,false);
}
else
{
SendClientMessageToAll(0xFFFF00AA,\"Senki nem oldotta meg a reakció tesztet.\");
SendClientMessageToAll(0xFFFF00AA,\"A következő teszt 1 percen belül kezdődik!\");
SetTimer(\"reakcio\",60000,false);
reakcio_szam = -1;
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (reakcio_szam != -1)
{
if (!strcmp(cmdtext,teleportok[reakcio_szam],true))
{
new str[70];
GetPlayerName(playerid,str,sizeof(str));
format(str,sizeof(str),\"%s megnyerte a reakciótesztet, nyereménye: 5000$\",str);
SendClientMessageToAll(0xFFFF00AA,str);
GivePlayerMoney(playerid,5000);
SendClientMessageToAll(0xFFFF00AA,\"A következő reakció teszt 1 perc múlva kezdődik\");
KillTimer(idozito);
SetTimer(\"reakcio\",60000,false);
reakcio_szam = -1;
}
}
return 1;
}
-
Írta: Applejack
« Dátum: Ma - 14:03:07 » Idézet beszúrása
#include <a_samp>
stock
reakcio_szam = -1,
idozito = -1;
stock const teleportok[][] =
{
\"/spawnhely\",\"/groove\",\"/ls\",\"/sf\",\"/lv\",\"/lsair\",\"/sfair\",
\"/lvair\",\"/banya\",\"/beach\",\"/dillimore\",\"/farm\",\"/blueberry\",
\"/palomino\",\"/lasbarrancas\",\"/bayside\",\"/elquebrados\",\"/fortcarson\",
\"/bazis\",\"/sivatag\",\"/montgomery\",\"/angelpine\"
};
main() {}
public OnGameModeInit()
{
SetTimer(\"reakcio\",60000,false);
return;
}
forward reakcio();
public reakcio()
{
if (reakcio_szam == -1)
{
reakcio_szam = random(sizeof(teleportok));
new str[50];
format(str,sizeof(str),\"Reakció teszt! Szöveg: %s\",teleportok[reakcio_szam]);
SendClientMessageToAll(-1,str);
idozito = SetTimer(\"reakcio\",300000,false);
}
else
{
SendClientMessageToAll(0xFFFF00AA,\"Senki nem oldotta meg a reakció tesztet.\");
SendClientMessageToAll(0xFFFF00AA,\"A következő teszt 1 percen belül kezdődik!\");
SetTimer(\"reakcio\",60000,false);
reakcio_szam = -1;
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (reakcio_szam != -1)
{
if (!strcmp(cmdtext,teleportok[reakcio_szam],true))
{
new str[70];
GetPlayerName(playerid,str,sizeof(str));
format(str,sizeof(str),\"%s megnyerte a reakciótesztet, nyereménye: 5000$\",str);
SendClientMessageToAll(0xFFFF00AA,str);
GivePlayerMoney(playerid,5000);
SendClientMessageToAll(0xFFFF00AA,\"A következő reakció teszt 1 perc múlva kezdődik\");
KillTimer(idozito);
SetTimer(\"reakcio\",60000,false);
reakcio_szam = -1;
}
}
return 1;
}
[/quote]Beraktam a gamemodeba de nem működik. Lehetséges hogy ZCMD-t használok a parancsoknál?
-
Próbáld meg így..
#include <a_samp>
stock
reakcio_szam = -1,
idozito = -1;
stock const teleportok[22][16] =
{
\"/spawnhely\",\"/groove\",\"/ls\",\"/sf\",\"/lv\",\"/lsair\",\"/sfair\",
\"/lvair\",\"/banya\",\"/beach\",\"/dillimore\",\"/farm\",\"/blueberry\",
\"/palomino\",\"/lasbarrancas\",\"/bayside\",\"/elquebrados\",\"/fortcarson\",
\"/bazis\",\"/sivatag\",\"/montgomery\",\"/angelpine\"
};
main() {}
public OnGameModeInit()
{
SetTimer(\"reakcio\", 60000, false);
return 1;
}
forward reakcio();
public reakcio()
{
if (reakcio_szam == -1)
{
reakcio_szam = random(sizeof(teleportok));
new str[50];
format(str,sizeof(str),\"Reakció teszt! Szöveg: %s\",teleportok[reakcio_szam]);
SendClientMessageToAll(-1,str);
idozito = SetTimer(\"reakcio\",300000,false);
}
else
{
SendClientMessageToAll(0xFFFF00AA,\"Senki nem oldotta meg a reakció tesztet.\");
SendClientMessageToAll(0xFFFF00AA,\"A következő teszt 1 percen belül kezdődik!\");
SetTimer(\"reakcio\",60000,false);
reakcio_szam = -1;
}
return 1;
}
public OnPlayerText(playerid, text[])
{
if (reakcio_szam != -1)
{
if (!strcmp(text, teleportok[reakcio_szam], true))
{
new str[70];
GetPlayerName(playerid,str,sizeof(str));
format(str,sizeof(str),\"%s megnyerte a reakciótesztet, nyereménye: 5000$\",str);
SendClientMessageToAll(0xFFFF00AA,str);
GivePlayerMoney(playerid,5000);
SendClientMessageToAll(0xFFFF00AA,\"A következő reakció teszt 1 perc múlva kezdődik\");
KillTimer(idozito);
SetTimer(\"reakcio\",60000,false);
reakcio_szam = -1;
}
}
return 1;
}
-
Próbáld meg így..
#include <a_samp>
stock
reakcio_szam = -1,
idozito = -1;
stock const teleportok[22][16] =
{
\"/spawnhely\",\"/groove\",\"/ls\",\"/sf\",\"/lv\",\"/lsair\",\"/sfair\",
\"/lvair\",\"/banya\",\"/beach\",\"/dillimore\",\"/farm\",\"/blueberry\",
\"/palomino\",\"/lasbarrancas\",\"/bayside\",\"/elquebrados\",\"/fortcarson\",
\"/bazis\",\"/sivatag\",\"/montgomery\",\"/angelpine\"
};
main() {}
public OnGameModeInit()
{
SetTimer(\"reakcio\", 60000, false);
return 1;
}
forward reakcio();
public reakcio()
{
if (reakcio_szam == -1)
{
reakcio_szam = random(sizeof(teleportok));
new str[50];
format(str,sizeof(str),\"Reakció teszt! Szöveg: %s\",teleportok[reakcio_szam]);
SendClientMessageToAll(-1,str);
idozito = SetTimer(\"reakcio\",300000,false);
}
else
{
SendClientMessageToAll(0xFFFF00AA,\"Senki nem oldotta meg a reakció tesztet.\");
SendClientMessageToAll(0xFFFF00AA,\"A következő teszt 1 percen belül kezdődik!\");
SetTimer(\"reakcio\",60000,false);
reakcio_szam = -1;
}
return 1;
}
public OnPlayerText(playerid, text[])
{
if (reakcio_szam != -1)
{
if (!strcmp(text, teleportok[reakcio_szam], true))
{
new str[70];
GetPlayerName(playerid,str,sizeof(str));
format(str,sizeof(str),\"%s megnyerte a reakciótesztet, nyereménye: 5000$\",str);
SendClientMessageToAll(0xFFFF00AA,str);
GivePlayerMoney(playerid,5000);
SendClientMessageToAll(0xFFFF00AA,\"A következő reakció teszt 1 perc múlva kezdődik\");
KillTimer(idozito);
SetTimer(\"reakcio\",60000,false);
reakcio_szam = -1;
}
}
return 1;
}
Ezaz hogy megy a settimer de ha beírom a teleportot akkor elteleportál oda csak nem írja ki hogy nyerek vagy ilyesmi.
-
A probléma az hogy amik a teleport tömbben van megadva, azok mind parancs formátunban vannak, szóval azt az OnPlayerText-nél soha nem fog lehívódni, tehát maradnia kell OnPlayerCommandTextnél.
De mivel most olvasom hogy ZCMD-t használsz, ami talánmegmagyarázza miért is nem megy az CommandText. Írd át ezt a sort:
public OnPlayerCommandText(playerid, cmdtext[])
erre:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
Ezek után elvileg működnie kell.
-
A probléma az hogy amik a teleport tömbben van megadva, azok mind parancs formátunban vannak, szóval azt az OnPlayerText-nél soha nem fog lehívódni, tehát maradnia kell OnPlayerCommandTextnél.
De mivel most olvasom hogy ZCMD-t használsz, ami talánmegmagyarázza miért is nem megy az CommandText. Írd át ezt a sort:
public OnPlayerCommandText(playerid, cmdtext[])
erre:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
Ezek után elvileg működnie kell.
Sajna úgyis próbáltam de semmi. Ami működött(csak filterszkriptbe) az ez: http://sampforum.hu/index.php?topic=53349.0 csak én kicsit alakítottam rajta és be raktam már játék módba is de semmit nem lehet csinálni mivel a reakciót megadja de ha beírom a teleportot ami rajta szerepel akkor már nem írja ki hogy (én) nyertem vagy ilyesmi.
#include <a_samp>
#define RED 0xAA3333AA
#define PURPLE 0xBF60FFFF
#define BLUE 0x1AAD3FF
#define GREEN 0x94D317FF
#define LIGHTBLUE 0x33CCFFAA
#define LIGHTBLUE2 0xF6BB0AA
#define Time 180000
#define function%0(%1) forward%0(%1); public%0(%1)
#define Loop(%0,%1) for(new %0 = 0; %0 != %1; %0++)
new Teleportok[][] =
{
\"/spawnhely\",\"/groove\",\"/ls\",\"/sf\",\"/lv\",\"/lsair\",\"/sfair\",\"/lvair\",\"/banya\",\"/beach\",\"/dillimore\",\"/farm\",\"/blueberry\",
\"/palomino\",\"/lasbarrancas\",\"/bayside\",\"/elquebrados\",\"/fortcarson\",\"/bazis\",\"/sivatag\",\"/montgomery\",\"/angelpine\"
};
new teleport[67] = \"\", TeleportIdo, Penz, bool: reakcio;
public OnFilterScriptInit()
{
print(\"\\n----------------------------\");
print(\"Teleport Reaction Test loaded!\");
print(\"----------------------------\\n\");
TeleportIdo = SetTimer(\"CommandReactionTest\",Time,1);
return 1;
}
public OnFilterScriptExit()
{
print(\"\\n------------------------------\");
print(\"Teleport Reaction Test unloaded!\");
print(\"------------------------------\\n\");
KillTimer(TeleportIdo);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
switch(reakcio)
{
case true:
{
if(!strcmp(teleport, cmdtext, false))
{
new Szoveghossz[256];
new Nev[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nev, sizeof(Nev));
format(Szoveghossz, sizeof(Szoveghossz), \"{ffffff} {DCAB00}[Teleport Reakció]{FFFFFF}: %s megnyerte a teleport reakciót. \'{01DBCA}%s{FFFFFF}\', és nyert %d $-t!\", Nev, teleport, Penz);
SendClientMessageToAll(0xFFFFFFAA, Szoveghossz);
GivePlayerMoney(playerid, Penz);
TeleportIdo = SetTimer(\"CommandReactionTest\",Time,1);
reakcio = false;
format(Szoveghossz, sizeof(Szoveghossz), \"{ffffff} {DCAB00}[Teleport Reakció]{FFFFFF}: A következő teleport reakció {01DBCA}%d{FFFFFF} percen belül kezdődik!\",Time/60000);
SendClientMessageToAll(0xFFFFFFAA, Szoveghossz);
return 0;
}
}
}
return 0;
}
function CommandReactionProgress()
{
switch(reakcio)
{
case true:
{
new Szoveghossz[256];
format(Szoveghossz, sizeof(Szoveghossz),\"{ffffff} {DCAB00}[Teleport Reakció]{FFFFFF}: Teleport tesztnek vége.\");
SendClientMessageToAll(0xFFFFFFAA, Szoveghossz);
format(Szoveghossz, sizeof(Szoveghossz),\"{ffffff} {DCAB00}[Teleport Reakció]{FFFFFF}: Következő teleport teszt {01DBCA}%d{FFFFFF} percen belül kezdődik!\",Time/60000);
SendClientMessageToAll(0xFFFFFFAA, Szoveghossz);
TeleportIdo = SetTimer(\"CommandReactionTest\",Time,1);
}
}
return 1;
}
function CommandReactionTest()
{
new Szoveghossz[256];
new xLength = (random(8) + 2);
Penz = (random(10000) + 20000);
format(teleport, sizeof(teleport), \"\");
Loop(x, xLength) format(teleport, sizeof(teleport), \"%s\", Teleportok[random(sizeof(Teleportok))][0]);
format(Szoveghossz, sizeof(Szoveghossz), \"{ffffff} {DCAB00}[Teleport Reakció]{FFFFFF}: Aki a leghamarabb elteleportál ide: \'{01DBCA}%s {FFFFFF}\' az nyerhet: %d $-t.\", teleport, Penz);
SendClientMessageToAll(0xFFFFFFAA, Szoveghossz);
KillTimer(TeleportIdo);
reakcio = true;
SetTimer(\"CommandReactionProgress\",Time,0);
return 1;
}