Tessék!
Rcon admin ként elinditod , és mer megy is magátol
/*------------------------*\\
| Maths script by Zezombia |
\\*------------------------*/
#include <a_samp>
#define yellow 0xFFFF00AA
#define red 0xFF0000AA
#define green 0x33FF33AA
forward Maths();
new answer;
new answered;
new score;
new timer;
new timerset;
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
if (strcmp(\"/megoldas\", cmd, true) == 0)
{
new tmp[256], cmdid, string[256], pname[MAX_PLAYER_NAME];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, red, \"USAGE: /megoldas [összeg]\");
cmdid = strval(tmp);
if(cmdid < answer || cmdid > answer)
{
SendClientMessage(playerid, red, \"Hibás Válasz!\");
}
if(cmdid == answer && answered == 0)
{
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), \"%s Nyert %d Pontot a helyes válaszért \'%d\'!\", pname, score, cmdid);
SendClientMessageToAll(green, string);
GivePlayerMoney(playerid, 10000);
answered = 1;
SetPlayerScore(playerid, GetPlayerScore(playerid) + score);
score = 0;
return 1;
}
else if(cmdid == answer && answered == 1)
{
SendClientMessage(playerid, red, \"To late!\");
}
return 1;
}
if (strcmp(\"/matek\", cmd, true) == 0)
{
if(IsPlayerAdmin(playerid) == 0) return SendClientMessage(playerid, red, \"Te nem vagy Rcon Admin!\");
new tmp[256], cmdid, string[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, red, \"USAGE: /matek [timer (mp)]\");
cmdid = strval(tmp);
KillTimer(timer);
timerset = cmdid * 1000;
timer = SetTimer(\"Maths\", timerset, 1);
format(string, sizeof(string), \"Matematikai Feladvány Kezdödik %d Másodperc mulva!\", cmdid);
SendClientMessage(playerid, yellow, string);
return 1;
}
if (strcmp(\"/stopmatek\", cmd, true) == 0)
{
if(IsPlayerAdmin(playerid) == 0) return SendClientMessage(playerid, red, \"Te nem vagy Rcon Admin!\");
KillTimer(timer);
SendClientMessage(playerid, yellow, \"A matematikai Feladványoknak vége!\");
return 1;
}
return 0;
}
public Maths()
{
new string[256], addsubtext1[10], addsubtext2[10];
new temp1;
new number1 = random(100);
new number2 = random(100);
new number3 = random(100);
new addsubnumb1 = random(2);
new addsubnumb2 = random(2);
if(addsubnumb1 == 0)
{
score = score + 10;
format(addsubtext1, sizeof(addsubtext1), \"-\");
temp1 = number1 - number2;
}
else if(addsubnumb1 == 1)
{
score = score + 5;
format(addsubtext1, sizeof(addsubtext1), \"+\");
temp1 = number1 + number2;
}
if(addsubnumb2 == 0)
{
score = score + 10;
format(addsubtext2, sizeof(addsubtext2), \"-\");
answer = temp1 - number3;
}
else if(addsubnumb2 == 1)
{
score = score + 5;
format(addsubtext2, sizeof(addsubtext2), \"+\");
answer = temp1 + number3;
}
format(string, sizeof(string), \"Matematika: %d%s%d%s%d - /megoldas Adj helyes választ, hogy %d pontot Szerezz!\", number1, addsubtext1, number2, addsubtext2, number3, score);
SendClientMessageToAll(yellow, string);
answered = 0;
return 1;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= \' \'))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > \' \') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
Ez bizonyos idöközönként kiirja feladatot....
/************************
* @credits *
* @title - Easy Math *
* @created by - dnS\' *
* @date - 2k10.jun.13 *
************************/
#include <a_samp>
#if !defined YELLOW
#define YELLOW \\
0xFFFF00AA
#endif
#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 feladat,stopped,bool:feladv;
forward feladvany(playerid);
forward fvege();
public OnFilterScriptInit()
{
feladv = false; SetTimer(\"feladvany\",150000,1);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public feladvany(playerid)
{
if(feladv == false) {
KillTimer(stopped);
feladv = true;new kocka[4],switching;
kocka[0] = random(150);
kocka[1] = random(150);
kocka[2] = random(150);
switching = random(3);
if(switching == 0) {
feladat = kocka[0] + kocka[1] + kocka[2];
new string[128];
format(string,128,\"« Feladvány: %d + %d + %d = Jutalom: $1000 +5 Pont! Válasz adás: /va [válasz] »\",kocka[0],kocka[1],kocka[2]);
SendClientMessageToAll(YELLOW,\"Rossz Válasz Esetén: -5 Pont\");SendClientMessageToAll(YELLOW,string);
}
else if(switching == 1) {
feladat = kocka[0] + kocka[1] - kocka[2];
new string[128];
format(string,128,\"« Feladvány: %d + %d - %d = Jutalom: $1000 +5 Pont! Válasz adás: /va [válasz] »\",kocka[0],kocka[1],kocka[2]);
SendClientMessageToAll(YELLOW,string);SendClientMessageToAll(YELLOW,\"Rossz Válasz Esetén: -5 Pont\");
}
else if(switching == 2) {
feladat = kocka[0] - kocka[1] - kocka[2];
new string[128];
format(string,128,\"« Feladvány: %d - %d - %d = Jutalom: $1000 +5 Pont! Válasz adás: /va [válasz] »\",kocka[0],kocka[1],kocka[2]);
SendClientMessageToAll(YELLOW,string);SendClientMessageToAll(YELLOW,\"Rossz Válasz Esetén: -5 Pont\");
}
stopped = SetTimer(\"fvege\",60000,0);
}
return 1;
}
public fvege()
{
feladv = false;
new string[128];
format(string,128,\"« Feladat: A Válasz: %d! »\",feladat);
SendClientMessageToAll(YELLOW,string);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(felad,5,cmdtext);dcmd(va,2,cmdtext);
return 0;
}
dcmd_felad(playerid,params[])
{
#pragma unused params
if(IsPlayerAdmin(playerid))
{
feladv = false;
feladvany(playerid);
}
else
{
SendClientMessage(playerid,YELLOW,\"« Sajnálom, de nem vagy RCON Adminisztrátor! »\");
return 0;
}
return 1;
}
dcmd_va(playerid,params[])
{
if(feladv == true)
{
if(!strlen(params)) return SendClientMessage(playerid,YELLOW,\"Használat: /va [A Te válaszod]\");
new para;
para = strval(params);
if(para == feladat)
{
feladv = false;
new pName[24],
string[128];
KillTimer(stopped);
GetPlayerName(playerid,pName,24);
format(string,128,\"« Feladat: %s nyert! A Válasz: %d! »\",pName,feladat);
SendClientMessageToAll(YELLOW,string);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 5 );
GivePlayerMoney(playerid,1000);
} else {
SendClientMessage(playerid,YELLOW,\"« Helytelen Válasz »\");
SetPlayerScore(playerid, GetPlayerScore(playerid) - 5 );
}
}
else
{
return SendClientMessage(playerid,YELLOW,\"« A Feladatok Opció Nem aktív! »\");
}
return 1;
}