rendben és LuxAdminnak van 10-es szintje?
Dupla hozzászólás automatikusan összefûzve. ( 2012. április 20. - 17:34:58 )
#include <a_samp>
#include <dudb>
#include <dini>
#include <ladmin>
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == \'\\0\') && (dcmd_%1(playerid, \"\"))) || (((%3)[(%2) + 1] == \' \') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#pragma unused strtok
#pragma unused ret_memcpy
#define FILTERSCRIPT
#if defined FILTERSCRIPT
#define ReGiStEr 8
#define LoGiN 9
#define COLOR_GREEN 0x00FF00FF
#define COLOR_RED 0xFF0000FF
enum pInfo
{
Deaths,
Kills,
Stat
}
enum VIPLevel
{
level
}
forward OnPlayerHealth(playerid);
new PlayerInfo[MAX_PLAYERS][pInfo];
new IsLogged[MAX_PLAYERS];
new PlayerInfo2[MAX_PLAYERS][VIPLevel];
new giveplayerid; //ez lesz a másik játékos
new god[MAX_PLAYERS];
public OnFilterScriptInit()
{
print(\"\\n--------------------------------------\");
print(\" Gs]VIP System by GangSteR] \");
print(\" betöltve \");
print(\"----------------------------------------\");
print(\" tRegistration System by Torran \");
print(\"--------------------------------------\\n\");
return 1;
}
public OnFilterScriptExit()
{
print(\"\\n--------------------------------------\");
print(\" Gs]VIP System by GangSteR] \");
print(\" kiszedve \");
print(\"----------------------------------------\");
print(\" tRegistration System by Torran \");
print(\"--------------------------------------\\n\");
return 1;
}
#endif
public OnPlayerConnect(playerid)
{
IsLogged[playerid] = 0;
PlayerInfo[playerid][Deaths]=0;
PlayerInfo[playerid][stat]=0;
PlayerInfo2[playerid][level]=0;
new file[128], string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),\"/Gs]VIP/szi/%s.ini\",name);
if(!fexist(file))
{
format(string, sizeof string, \"Üdv %s! \\nTe még nem vagy regisztrálva! \\n\\nKérjük regisztrálj.\", name);
ShowPlayerDialog(playerid, ReGiStEr, DIALOG_STYLE_INPUT, \"Regisztráció\", string, \"Regisztráció\", \"Mégse\");
}
if(fexist(file))
{
format(string, sizeof string, \"Üdv %s! \\nKérjük jelentkezz be! \\n\\nIrd be a jelszódat.\", name);
ShowPlayerDialog(playerid, LoGiN, DIALOG_STYLE_INPUT, \"Bejelentkezés\", string, \"Bejelentkezés\", \"Mégse\");
}
SendClientMessage(playerid,0x33AA33AA,\"Gs] VIP System by GangSteR] betöltve!\");
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new file[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),\"/Gs]VIP/szi/%s.ini\",name);
if(fexist(file))
{
dini_IntSet(file,\"Score\", GetPlayerScore(playerid));
dini_IntSet(file,\"Money\", GetPlayerMoney(playerid));
dini_IntSet(file,\"Deaths\", PlayerInfo[playerid][Deaths]);
dini_IntSet(file,\"Kills\", PlayerInfo[playerid][Kills]);
dini_IntSet(file,\"Stat\", PlayerInfo[playerid][stat]);
dini_IntSet(file,\"level\", PlayerInfo2[playerid][level]);
}
IsLogged[playerid] = 0;
return 1;
}
public OnPlayerDeath(playerid, killerid)
{
PlayerInfo[playerid][Deaths] ++;
PlayerInfo[killerid][Kills] ++;
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == ReGiStEr)
{
if(response)
{
new file[128];
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(strlen(inputtext) == 0)
{
format(string, sizeof string, \"Regisztráció \\n\\nÜdv %s! \\nTe még nem vagy regisztrálva! \\n\\nKérjük regisztrálj.\", name);
ShowPlayerDialog(playerid, ReGiStEr, DIALOG_STYLE_INPUT, \"Regisztráció\", string, \"Regisztráció\", \"Mégse\");
return 0;
}
format(file,sizeof(file),\"/Gs]VIP/szi/%s.ini\",name);
if(!fexist(file))
{
dini_Create(file);
dini_IntSet(file,\"Password\", udb_hash(inputtext));
dini_IntSet(file,\"Score\", GetPlayerScore(playerid));
dini_IntSet(file,\"Money\", GetPlayerMoney(playerid));
dini_IntSet(file,\"Deaths\", PlayerInfo[playerid][Deaths]);
dini_IntSet(file,\"Kills\", PlayerInfo[playerid][Kills]);
dini_IntSet(file,\"Stat\", PlayerInfo[playerid][stat]);
dini_IntSet(file,\"level\", PlayerInfo2[playerid][level]);
format(string, sizeof string, \"Bejelentkezés \\n\\nÜdv %s! \\nTe regisztrálva vagy! \\n\\nKérjük jelentkezz be.\", name);
ShowPlayerDialog(playerid, LoGiN, DIALOG_STYLE_INPUT, \"Bejelentkezés\", string, \"Bejelentkezés\", \"Mégse\");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
GetPlayerName(playerid, name, sizeof(name));
printf(\"%s sikeresen regisztrált!\", name);
}
}else{new string[200], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof name); format(string, sizeof string, \"Üdv %s! \\nTe még nem vagy regisztrálva! \\n\\nKérjük regisztrálj.\", name); ShowPlayerDialog(playerid, ReGiStEr, DIALOG_STYLE_INPUT, \"Regisztráció\", string, \"Register\", \"Cancel.\");}
}
if(dialogid == LoGiN)
{
if(response)
{
new file[128];
new string[128];
new PlayerName[24];
if(strlen(inputtext) == 0)
{
GetPlayerName(playerid, PlayerName, sizeof PlayerName);
format(string, sizeof string, \"Bejelentkezés \\n\\nÜdv %s! \\nTe regisztrálva vagy! \\n\\nKérjük jelentkezz be.\", PlayerName);
ShowPlayerDialog(playerid, LoGiN, DIALOG_STYLE_INPUT, \"Bejelentkezés\", string, \"Bejelentkezés\", \"Mégse\");
return 0;
}
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),\"/Gs]VIP/szi/%s.ini\",name);
if(fexist(file))
{
new password = dini_Int(file, \"Password\");
if(udb_hash(inputtext) != password)
{
SendClientMessage(playerid, COLOR_RED, \"Hiba: Nem jó jelszó!\");
Kick(playerid);
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
printf(\"%s Nem tudott bejelentkezni!\", name);
}
else
{
IsLogged[playerid] = 1;
ResetPlayerMoney(playerid);
SetPlayerScore(playerid, dini_Int(file,\"Score\"));
GivePlayerMoney(playerid, dini_Int(file,\"Money\"));
PlayerInfo[playerid][Deaths] = dini_Int(file,\"Deaths\");
PlayerInfo[playerid][Kills] = dini_Int(file,\"Kills\");
PlayerInfo[playerid][stat] = dini_Int(file,\"Stat\");
PlayerInfo2[playerid][level] = dini_Int(file,\"level\");
SendClientMessage(playerid, COLOR_GREEN, \"***Sikeresen be jelentkeztél!\");
TogglePlayerSpectating(playerid, 0);
}
}
}else{new string[200], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof name); format(string, sizeof string, \"Üdv %s! \\nKérjük jelentkezz be! \\n\\nIrd be a jelszódat.\", name);ShowPlayerDialog(playerid, LoGiN, DIALOG_STYLE_INPUT, \"Bejelentkezés\", string, \"Login\", \"Cancel.\");}
}
return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(sethealth, 9, cmdtext);
dcmd(setarmour, 9, cmdtext);
dcmd(freeze, 6, cmdtext);
dcmd(unfreeze, 8, cmdtext);
dcmd(giveweapon, 10, cmdtext);
dcmd(kick, 4, cmdtext);
dcmd(ban, 3, cmdtext);
dcmd(setviplevel, 11, cmdtext);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if(!strcmp(\"/GOD-ON\", cmdtext, true))
{
if(PlayerInfo2[playerid][level] == 2)
{
god[playerid] = SetTimerEx(\"OnPlayerHealth\", 1, true, \"i\", playerid);
SendClientMessage(playerid,0x33AA33AA,\"Mostantól halhatatlan vagy!\");
return 1;
}
}
if(!strcmp(\"/GOD-OFF\", cmdtext, true))
{
if(PlayerInfo2[playerid][level] == 2)
{
KillTimer(god[playerid]);
SendClientMessage(playerid,0x33AA33AA,\"Kikapcsoltad a halhatatlanságodat!\");
return 1;
}
}
if(!strcmp(\"/health\", cmdtext, true))
{
if(PlayerInfo2[playerid][level] == 1)
{
SetPlayerHealth(playerid,100);
SendClientMessage(playerid,0x33AA33AA,\"Sikeresen feltöltötted az életedet!\");
SetPlayerHealth(playerid,100);
return 1;
}
}
if(!strcmp(\"/armour\", cmdtext, true))
{
if(PlayerInfo2[playerid][level] == 1)
{
SetPlayerArmour(playerid,100);
SendClientMessage(playerid,0x33AA33AA,\"Sikeresen feltöltötted a páncélodat!\");
return 1;
}
}
if (!strcmp(\"/Gs]Commands\", cmdtext, true))
{
SendClientMessage(playerid,0x33AA33AA,\"Parancsok:\");
SendClientMessage(playerid,0x33AA33AA,\"VIP szint 1: /health, /armour, /sethealth, /setarmour, /setwanted, /kick\");
SendClientMessage(playerid,0x33AA33AA,\"VIP szint 2: /GOD-ON, /GOD-OFF, /ban, /kick, /setwanted, /setarmour, /sethealth, /armour, /health\");
return 1;
}
return 0;
}
dcmd_sethealth(playerid, params[])
{
if(PlayerInfo2[playerid][level] >= 0)
{
if (sscanf(params, \"u\", giveplayerid)) SendClientMessage(playerid, 0xFF0000AA, \"Használat: /sethealth [playerid]\");
else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, \"HIBA: Nincs ilyen játékos!\");
else{
SetPlayerHealth(playerid, 100);
new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[200];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(playerid, name2, sizeof(name2));
format(string, sizeof string, \"%s [VIP] feltöltötte %s életét!\", name, name2);
SendClientMessageToAll(0xFF0000AA,string);
}
}else{SendClientMessage(playerid, 0xFF0000AA, \"HIBA: Nem vagy VIP tag!\");}
return 1;
}
dcmd_setarmour(playerid, params[])
{
if(PlayerInfo2[playerid][level] >= 0)
{
if (sscanf(params, \"u\", giveplayerid)) SendClientMessage(playerid, 0xFF0000AA, \"Használat: /setarmour [playerid]\");
else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, \"HIBA: Nincs ilyen játékos!\");
else{
SetPlayerArmour(playerid, 100);
new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[200];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(playerid, name2, sizeof(name2));
format(string, sizeof string, \"%s [VIP] feltöltötte %s páncélzatát!\", name, name2);
SendClientMessageToAll(0xFF0000AA,string);
}
}else{SendClientMessage(playerid, 0xFF0000AA, \"HIBA: Nem vagy VIP tag!\");}
return 1;
}
dcmd_freeze(playerid, params[])
{
if(PlayerInfo2[playerid][level] >= 0)
{
if (sscanf(params, \"u\", giveplayerid)) SendClientMessage(playerid, 0xFF0000AA, \"Használat: /freeze [játékosID]\");
else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, \"HIBA: Nincs ilyen játékos!\");
else{
TogglePlayerControllable(playerid, 0);
new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[200];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(playerid, name2, sizeof(name2));
format(string, sizeof string, \"%s [VIP] lefagyasztotta %s -t!\", name, name2);
SendClientMessageToAll(0xFF0000AA,string);
}
}else{SendClientMessage(playerid, 0xFF0000AA, \"HIBA: Nem vagy VIP tag!\");}
return 1;
}
dcmd_unfreeze(playerid, params[])
{
if(PlayerInfo2[playerid][level] >= 0)
{
if (sscanf(params, \"u\", giveplayerid)) SendClientMessage(playerid, 0xFF0000AA, \"Használat: /unfreeze [játékosID]\");
else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, \"HIBA: Nincs ilyen játékos!\");
else{
TogglePlayerControllable(playerid, 1);
new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[200];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(playerid, name2, sizeof(name2));
format(string, sizeof string, \"%s [VIP] feloldotta %s -t a fagyasztás alól!\", name, name2);
SendClientMessageToAll(0xFF0000AA,string);
}
}else{SendClientMessage(playerid, 0xFF0000AA, \"HIBA: Nem vagy VIP tag!\");}
return 1;
}
dcmd_giveweapon(playerid, params[])
{
if(PlayerInfo2[playerid][level] >= 0)
{
new weaponid;
new ammo;
if (sscanf(params, \"udd\", giveplayerid, weaponid, ammo)) SendClientMessage(playerid, 0xFF0000AA, \"Használat: /giveweapon [játékosID] [fegyverID] [töltényszám]\");
else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, \"HIBA: Nincs ilyen játékos!\");
else{
GivePlayerWeapon(playerid, weaponid, ammo);
new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[200];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(playerid, name2, sizeof(name2));
format(string, sizeof string, \"%s [VIP] adott %s -nek fegyvert ID:%d, %d töltényel !\", name, name2, weaponid, ammo);
SendClientMessageToAll(0xFF0000AA,string);
}
}else{SendClientMessage(playerid, 0xFF0000AA, \"HIBA: Nem vagy VIP tag!\");}
return 1;
}
dcmd_kick(playerid, params[])
{
if(PlayerInfo2[playerid][level] >= 0)
{
if (sscanf(params, \"d\", giveplayerid)) SendClientMessage(playerid, 0xFF0000AA, \"Használat: /kick [játékosID]\");
else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, \"HIBA: Nincs ilyen játékos!\");
else{
new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[200];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(playerid, name2, sizeof(name2));
format(string, sizeof string, \"%s [VIP] [KICK] kirúgta %s -t a szerverrõl\", name, name2);
SendClientMessageToAll(0xFF0000AA,string);
Kick(playerid);
}
}else{SendClientMessage(playerid, 0xFF0000AA, \"HIBA: Nem vagy VIP tag!\");}
return 1;
}
dcmd_ban(playerid, params[])
{
if(PlayerInfo2[playerid][level] == 2)
{
if (sscanf(params, \"d\", giveplayerid)) SendClientMessage(playerid, 0xFF0000AA, \"Használat: /ban [játékosID]\");
else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, \"HIBA: Nincs ilyen játékos!\");
else{
new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[200];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(playerid, name2, sizeof(name2));
format(string, sizeof string, \"%s [VIP] [bAN] kitiltotta %s -t a szerverrõl,\", name, name2);
SendClientMessageToAll(0xFF0000AA,string);
Ban(playerid);
}
}else{SendClientMessage(playerid, 0xFF0000AA, \"HIBA: Nem vagy VIP tag, vagy túl kevés a szinted ehez a parancshoz!\");}
return 1;
}
dcmd_setviplevel(playerid, params[])
{
if(IsPlayerLuxAdmin(playerid) < 10) return SendClientMessage(playerid, 0xFF0000AA, \"HIBA: Nem vagy Rcon admin!\");
new viplevel;
if (sscanf(params, \"ud\", giveplayerid, viplevel)) SendClientMessage(playerid, 0xFF0000AA, \"Használat: /setviplevel [játékosID] [szint]\");
else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, \"HIBA: Nincs ilyen játékos!\");
else if (viplevel < 0 || viplevel > 2) SendClientMessage(playerid, 0xFF0000AA, \"HIBA: Rossz szint! (Csak 2 szint lehetséges)\");
else{
new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[200];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(giveplayerid, name2, sizeof(name2));
format(string, sizeof string, \"%s [ADMIN] felemelte %s VIP szintjét %d -re!\", name, name2, viplevel);
SendClientMessageToAll(0xFF0000AA,string);
PlayerInfo2[giveplayerid][level] = viplevel;
}
return 1;
}
stock sscanf(string[], format[], {Float,_}:...)
{
#if defined isnull
if (isnull(string))
#else
if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
#endif
{
return format[0];
}
#pragma tabsize 4
new
formatPos = 0,
stringPos = 0,
paramPos = 2,
paramCount = numargs(),
delim = \' \';
while (string[stringPos] && string[stringPos] <= \' \')
{
stringPos++;
}
while (paramPos < paramCount && string[stringPos])
{
switch (format[formatPos++])
{
case \'\\0\':
{
return 0;
}
case \'i\', \'d\':
{
new
neg = 1,
num = 0,
ch = string[stringPos];
if (ch == \'-\')
{
neg = -1;
ch = string[++stringPos];
}
do
{
stringPos++;
if (\'0\' <= ch <= \'9\')
{
num = (num * 10) + (ch - \'0\');
}
else
{
return -1;
}
}
while ((ch = string[stringPos]) > \' \' && ch != delim);
setarg(paramPos, 0, num * neg);
}
case \'h\', \'x\':
{
new
num = 0,
ch = string[stringPos];
do
{
stringPos++;
switch (ch)
{
case \'x\', \'X\':
{
num = 0;
continue;
}
case \'0\' .. \'9\':
{
num = (num << 4) | (ch - \'0\');
}
case \'a\' .. \'f\':
{
num = (num << 4) | (ch - (\'a\' - 10));
}
case \'A\' .. \'F\':
{
num = (num << 4) | (ch - (\'A\' - 10));
}
default:
{
return -1;
}
}
}
while ((ch = string[stringPos]) > \' \' && ch != delim);
setarg(paramPos, 0, num);
}
case \'c\':
{
setarg(paramPos, 0, string[stringPos++]);
}
case \'f\':
{
new changestr[16], changepos = 0, strpos = stringPos;
while(changepos < 16 && string[strpos] && string[strpos] != delim)
{
changestr[changepos++] = string[strpos++];
}
changestr[changepos] = \'\\0\';
setarg(paramPos,0,_:floatstr(changestr));
}
case \'p\':
{
delim = format[formatPos++];
continue;
}
case \'\\\'\':
{
new
end = formatPos - 1,
ch;
while ((ch = format[++end]) && ch != \'\\\'\') {}
if (!ch)
{
return -1;
}
format[end] = \'\\0\';
if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
{
if (format[end + 1])
{
return -1;
}
return 0;
}
format[end] = \'\\\'\';
stringPos = ch + (end - formatPos);
formatPos = end + 1;
}
case \'u\':
{
new
end = stringPos - 1,
id = 0,
bool:num = true,
ch;
while ((ch = string[++end]) && ch != delim)
{
if (num)
{
if (\'0\' <= ch <= \'9\')
{
id = (id * 10) + (ch - \'0\');
}
else
{
num = false;
}
}
}
if (num && IsPlayerConnected(id))
{
setarg(paramPos, 0, id);
}
else
{
#if !defined foreach
#define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
#define __SSCANF_FOREACH__
#endif
string[end] = \'\\0\';
num = false;
new
name[MAX_PLAYER_NAME];
id = end - stringPos;
foreach (Player, playerid)
{
GetPlayerName(playerid, name, sizeof (name));
if (!strcmp(name, string[stringPos], true, id))
{
setarg(paramPos, 0, playerid);
num = true;
break;
}
}
if (!num)
{
setarg(paramPos, 0, INVALID_PLAYER_ID);
}
string[end] = ch;
#if defined __SSCANF_FOREACH__
#undef foreach
#undef __SSCANF_FOREACH__
#endif
}
stringPos = end;
}
case \'s\', \'z\':
{
new
i = 0,
ch;
if (format[formatPos])
{
while ((ch = string[stringPos++]) && ch != delim)
{
setarg(paramPos, i++, ch);
}
if (!i)
{
return -1;
}
}
else
{
while ((ch = string[stringPos++]))
{
setarg(paramPos, i++, ch);
}
}
stringPos--;
setarg(paramPos, i, \'\\0\');
}
default:
{
continue;
}
}
while (string[stringPos] && string[stringPos] != delim && string[stringPos] > \' \')
{
stringPos++;
}
while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= \' \'))
{
stringPos++;
}
paramPos++;
}
do
{
if ((delim = format[formatPos++]) > \' \')
{
if (delim == \'\\\'\')
{
while ((delim = format[formatPos++]) && delim != \'\\\'\') {}
}
else if (delim != \'z\')
{
return delim;
}
}
}
while (delim > \' \');
return 0;
}
public OnPlayerHealth(playerid) // GOD
{
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
return 1;
}
Nem teszteltem...