Ich habe aus langeweile ein kleines Adminsystem gebastelt
Zudem enthält es ein Umfangreiches Log-System!
PASTEBIN: http://pastebin.com/yRa1pbd6
DIE BEFEHLE
/kick
/ban
/goto
/gethere
/slap
/freeze
/unfreeze
Wenn etwas nicht geht, hier ins Thema schreiben, das System ist UNGETESTET! Ich werde KEINEN Support per PN leiseten, nur HIER IM THEMA!
Es ist kein © drinne, bringt eh nix und is eh nur ne 5min Arbeit (für erfahrere Scripter!)
VIEL SPAß DAMIT!
#include <a_samp>
#include <ocmd>
#include <mysql>
enum playerdata
{
aName,
aadmin,
abanned
}
new aSpieler[MAX_PLAYERS][playerdata];
{
aName,
aadmin,
abanned
}
new aSpieler[MAX_PLAYERS][playerdata];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Kleines Adminsystem");
print("--------------------------------------\n");
return 1;
}
{
print("\n--------------------------------------");
print(" Kleines Adminsystem");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
SpielerLaden(playerid);
if(aSpieler[playerid][abanned] >= 0)
{
SendClientMessage(playerid,0xFF0000FF,"Du bist gebannt!");
playerkick(playerid);
}
return 1;
}
{
SpielerLaden(playerid);
if(aSpieler[playerid][abanned] >= 0)
{
SendClientMessage(playerid,0xFF0000FF,"Du bist gebannt!");
playerkick(playerid);
}
return 1;
}
ocmd:gethere(playerid, params[])
{
new id, str[128], Float:X, Float:Y, Float:Z;
if(aSpieler[playerid][aadmin] < 1)return SendClientMessage(playerid, 0xFF0000FF,"Du bist kein Admin!");
if(sscanf(params,"u",id))return SendClientMessage(playerid,0xFF0000FF,"/gethere <ID/Name>");
GetPlayerVirtualWorld(playerid);
SetPlayerVirtualWorld(id,GetPlayerVirtualWorld(playerid));
GetPlayerPos(playerid,X,Y,Z);
SetPlayerPos(id,X,Y,Z);
format(str,sizeof(str),"%s hat %s zu sich geportet",SpielerName(playerid),SpielerName(id));
return 1;
}
{
new id, str[128], Float:X, Float:Y, Float:Z;
if(aSpieler[playerid][aadmin] < 1)return SendClientMessage(playerid, 0xFF0000FF,"Du bist kein Admin!");
if(sscanf(params,"u",id))return SendClientMessage(playerid,0xFF0000FF,"/gethere <ID/Name>");
GetPlayerVirtualWorld(playerid);
SetPlayerVirtualWorld(id,GetPlayerVirtualWorld(playerid));
GetPlayerPos(playerid,X,Y,Z);
SetPlayerPos(id,X,Y,Z);
format(str,sizeof(str),"%s hat %s zu sich geportet",SpielerName(playerid),SpielerName(id));
return 1;
}
ocmd:goto(playerid, params[])
{
new id, str[128], Float:X, Float:Y, Float:Z;
if(aSpieler[playerid][aadmin] < 1)return SendClientMessage(playerid, 0xFF0000FF,"Du bist kein Admin!");
if(sscanf(params,"u",id))return SendClientMessage(playerid,0xFF0000FF,"/goto <ID/Name>");
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
GetPlayerPos(id,X,Y,Z);
SetPlayerPos(playerid,X,Y,Z);
format(str,sizeof(str),"%s hat %s zu sich geportet",SpielerName(playerid),SpielerName(id));
return 1;
}
{
new id, str[128], Float:X, Float:Y, Float:Z;
if(aSpieler[playerid][aadmin] < 1)return SendClientMessage(playerid, 0xFF0000FF,"Du bist kein Admin!");
if(sscanf(params,"u",id))return SendClientMessage(playerid,0xFF0000FF,"/goto <ID/Name>");
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
GetPlayerPos(id,X,Y,Z);
SetPlayerPos(playerid,X,Y,Z);
format(str,sizeof(str),"%s hat %s zu sich geportet",SpielerName(playerid),SpielerName(id));
return 1;
}
ocmd:ban(playerid,params[])
{
new str[128],ID;
if(aSpieler[playerid][aadmin] < 1)return SendClientMessage(playerid,0xFF0000FF,"Du bist kein Admin des Ranges");
if(sscanf(params, "uz",ID,str))return SendClientMessage(playerid,0xFF0000FF,"/ban [ID/Name] [Grund]");
if(!IsPlayerConnected(ID))return SendClientMessage(playerid,0xFF0000FF,"Dieser Spieler ist nicht online");
if(ID == playerid)return SendClientMessage(playerid,0xFF0000FF,"Du kannst dich nicht selber bannen");
if(IsPlayerNPC(ID))return SendClientMessage(playerid,0xFF0000FF,"Du kannst keinen NPC bannen");
{
new str2[128];
format(str2,sizeof(str2),"AdmCmd:%s wurde von %s gebannt! Grund: %s",SpielerName(ID),SpielerName(playerid),str);
SendClientMessageToAll(0xFF0000FF,str2);
aSpieler[ID][abanned] = 1;
SpielerSpeichern(ID);
BanEx(ID,str);
Log("Logs/ban.txt",str);
}
return 1;
}
{
new str[128],ID;
if(aSpieler[playerid][aadmin] < 1)return SendClientMessage(playerid,0xFF0000FF,"Du bist kein Admin des Ranges");
if(sscanf(params, "uz",ID,str))return SendClientMessage(playerid,0xFF0000FF,"/ban [ID/Name] [Grund]");
if(!IsPlayerConnected(ID))return SendClientMessage(playerid,0xFF0000FF,"Dieser Spieler ist nicht online");
if(ID == playerid)return SendClientMessage(playerid,0xFF0000FF,"Du kannst dich nicht selber bannen");
if(IsPlayerNPC(ID))return SendClientMessage(playerid,0xFF0000FF,"Du kannst keinen NPC bannen");
{
new str2[128];
format(str2,sizeof(str2),"AdmCmd:%s wurde von %s gebannt! Grund: %s",SpielerName(ID),SpielerName(playerid),str);
SendClientMessageToAll(0xFF0000FF,str2);
aSpieler[ID][abanned] = 1;
SpielerSpeichern(ID);
BanEx(ID,str);
Log("Logs/ban.txt",str);
}
return 1;
}
ocmd:freeze(playerid, params[])
{
new id, str[128];
if(aSpieler[playerid][aadmin] <= 1)return SendClientMessage(playerid, 0xFF0000FF,"Du bist kein Admin!");
if(sscanf(params,"uz",id,str))return SendClientMessage(playerid,0x0000FFFF,"Benutzung: /freeze <ID/Name> <Grund>");
TogglePlayerControllable(playerid,false);
format(str,sizeof(str),"%s wurde von %s eingefroren",SpielerName(id),SpielerName(playerid));
Log("Logs/freeze.txt",str);
return 1;
}
{
new id, str[128];
if(aSpieler[playerid][aadmin] <= 1)return SendClientMessage(playerid, 0xFF0000FF,"Du bist kein Admin!");
if(sscanf(params,"uz",id,str))return SendClientMessage(playerid,0x0000FFFF,"Benutzung: /freeze <ID/Name> <Grund>");
TogglePlayerControllable(playerid,false);
format(str,sizeof(str),"%s wurde von %s eingefroren",SpielerName(id),SpielerName(playerid));
Log("Logs/freeze.txt",str);
return 1;
}
ocmd:unfreeze(playerid, params[])
{
new id, str[128];
if(aSpieler[playerid][aadmin] <= 1)return SendClientMessage(playerid, 0xFF0000FF,"Du bist kein Admin!");
if(sscanf(params,"uz",id,str))return SendClientMessage(playerid,0x0000FFFF,"Benutzung: /unfreeze <ID/Name> <Grund>");
TogglePlayerControllable(playerid,true);
format(str,sizeof(str),"%s wurde von %s entfroren",SpielerName(id),SpielerName(playerid));
Log("Logs/unfreeze.txt",str);
return 1;
}
{
new id, str[128];
if(aSpieler[playerid][aadmin] <= 1)return SendClientMessage(playerid, 0xFF0000FF,"Du bist kein Admin!");
if(sscanf(params,"uz",id,str))return SendClientMessage(playerid,0x0000FFFF,"Benutzung: /unfreeze <ID/Name> <Grund>");
TogglePlayerControllable(playerid,true);
format(str,sizeof(str),"%s wurde von %s entfroren",SpielerName(id),SpielerName(playerid));
Log("Logs/unfreeze.txt",str);
return 1;
}
ocmd:slap(playerid, params[])
{
new id, str[128],Float:X, Float:Y, Float:Z;
if(aSpieler[playerid][aadmin] <= 1)return SendClientMessage(playerid, 0xFF0000FF,"Du bist kein Admin!");
if(sscanf(params,"u",id))return SendClientMessage(playerid,0x0000FFFF,"Benutzung: /slap <ID/Name>");
GetPlayerPos(id,X,Y,Z);
SetPlayerPos(id,X,Y,Z+7.5);
format(str,sizeof(str),"%s wurde von %s geslappt");
Log("Logs/slap.txt",str);
return 1;
}
{
new id, str[128],Float:X, Float:Y, Float:Z;
if(aSpieler[playerid][aadmin] <= 1)return SendClientMessage(playerid, 0xFF0000FF,"Du bist kein Admin!");
if(sscanf(params,"u",id))return SendClientMessage(playerid,0x0000FFFF,"Benutzung: /slap <ID/Name>");
GetPlayerPos(id,X,Y,Z);
SetPlayerPos(id,X,Y,Z+7.5);
format(str,sizeof(str),"%s wurde von %s geslappt");
Log("Logs/slap.txt",str);
return 1;
}
ocmd:kick(playerid,params[])
{
new str[128],ID;
if(aSpieler[playerid][aadmin] <= 1)return SendClientMessage(playerid, 0xFF0000FF,"Du bist kein Admin!");
if(sscanf(params, "uz",ID,str))return SendClientMessage(playerid,0xFF0000FF,"/kick [ID/Name] [Grund]");
if(!IsPlayerConnected(ID))return SendClientMessage(playerid,0xFF0000FF,"Dieser Spieler ist nicht online");
if (ID == playerid)return SendClientMessage(playerid,0xFF0000FF,"Du kannst dich nicht selber kciken");
if(IsPlayerNPC(ID))return SendClientMessage(playerid,0xFF0000FF,"Du kannst keinen NPC kicken");
if(aSpieler[playerid][aadmin] <= 1)return SendClientMessage(playerid,0xFF0000FF,"Du bist kein Admin");
{
new str2[128];
format(str2,sizeof(str2),"AdmCmd:%s wurde von %s gekickt! Grund: %s",SpielerName(ID),SpielerName(playerid),str[0]);
SendClientMessageToAll(0xFF0000FF,str2);
Log("Logs/kick.txt",str2);
}
return 1;
}
{
new str[128],ID;
if(aSpieler[playerid][aadmin] <= 1)return SendClientMessage(playerid, 0xFF0000FF,"Du bist kein Admin!");
if(sscanf(params, "uz",ID,str))return SendClientMessage(playerid,0xFF0000FF,"/kick [ID/Name] [Grund]");
if(!IsPlayerConnected(ID))return SendClientMessage(playerid,0xFF0000FF,"Dieser Spieler ist nicht online");
if (ID == playerid)return SendClientMessage(playerid,0xFF0000FF,"Du kannst dich nicht selber kciken");
if(IsPlayerNPC(ID))return SendClientMessage(playerid,0xFF0000FF,"Du kannst keinen NPC kicken");
if(aSpieler[playerid][aadmin] <= 1)return SendClientMessage(playerid,0xFF0000FF,"Du bist kein Admin");
{
new str2[128];
format(str2,sizeof(str2),"AdmCmd:%s wurde von %s gekickt! Grund: %s",SpielerName(ID),SpielerName(playerid),str[0]);
SendClientMessageToAll(0xFF0000FF,str2);
Log("Logs/kick.txt",str2);
}
return 1;
}
stock kickplayer(playerid)
{
SetTimerEx("playerkick",100,0,"d",playerid);
}
{
SetTimerEx("playerkick",100,0,"d",playerid);
}
forward playerkick(playerid);
public playerkick(playerid)
{
Kick(playerid);
}
public playerkick(playerid)
{
Kick(playerid);
}
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':
{
{
#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;
for(new playerid = 0; playerid < MAX_PLAYERS; 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;
}
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;
for(new playerid = 0; playerid < MAX_PLAYERS; 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;
}
stock SpielerName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
return name;
}
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
return name;
}
stock Log(filename[],write[])
{
new File:LogFile, str[256], mhour, mminute, msecond, myear, mmonth, mday;
if(fexist(filename))
{
LogFile = fopen(filename,io_append);
}
else
{
LogFile = fopen(filename,io_write);
}
gettime(mhour,mminute,msecond);
getdate(myear,mmonth,mday);
format(str,sizeof(str),"[d.d.%d] [d:d:d]: %s\n",mday,mmonth,myear,mhour,mminute,msecond,write);
fwrite(LogFile,str);
fclose(LogFile);
}
{
new File:LogFile, str[256], mhour, mminute, msecond, myear, mmonth, mday;
if(fexist(filename))
{
LogFile = fopen(filename,io_append);
}
else
{
LogFile = fopen(filename,io_write);
}
gettime(mhour,mminute,msecond);
getdate(myear,mmonth,mday);
format(str,sizeof(str),"[d.d.%d] [d:d:d]: %s\n",mday,mmonth,myear,mhour,mminute,msecond,write);
fwrite(LogFile,str);
fclose(LogFile);
}
stock mysql_GetString(Table[], Field[], Where[], Is[])
{
new query[128], Get[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Is, Is);
format(query, 128, "SELECT %s FROM %s WHERE %s = '%s'", Field, Table, Where, Is);
mysql_query(query);
mysql_store_result();
mysql_fetch_row(Get);
return Get;
}
{
new query[128], Get[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Is, Is);
format(query, 128, "SELECT %s FROM %s WHERE %s = '%s'", Field, Table, Where, Is);
mysql_query(query);
mysql_store_result();
mysql_fetch_row(Get);
return Get;
}
stock mysql_GetInt(Table[], Field[], Where[], Is[])
{
new query[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Is, Is);
format(query, 128, "SELECT %s FROM %s WHERE %s = '%s'", Field, Table, Where, Is);
mysql_query(query);
mysql_store_result();
new sqlint = mysql_fetch_int();
mysql_free_result();
return sqlint;
}
{
new query[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Is, Is);
format(query, 128, "SELECT %s FROM %s WHERE %s = '%s'", Field, Table, Where, Is);
mysql_query(query);
mysql_store_result();
new sqlint = mysql_fetch_int();
mysql_free_result();
return sqlint;
}
stock Float:mysql_GetFloat(Table[], Field[], Where[], Is[])
{
new query[128], Float:sqlfloat;
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Is, Is);
format(query, 128, "SELECT %s FROM %s WHERE %s = '%s'", Field, Table, Where, Is);
mysql_query(query);
mysql_store_result();
mysql_fetch_float(sqlfloat);
mysql_free_result();
return sqlfloat;
}
{
new query[128], Float:sqlfloat;
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Is, Is);
format(query, 128, "SELECT %s FROM %s WHERE %s = '%s'", Field, Table, Where, Is);
mysql_query(query);
mysql_store_result();
mysql_fetch_float(sqlfloat);
mysql_free_result();
return sqlfloat;
}
stock mysql_SetInt(Table[], Field[], To, Where[], Where2[])
{
new query[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Where2, Where2);
format(query, 128, "UPDATE %s SET %s = '%d' WHERE %s = '%s'", Table, Field, To, Where, Where2);
mysql_query(query);
return true;
}
{
new query[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Where2, Where2);
format(query, 128, "UPDATE %s SET %s = '%d' WHERE %s = '%s'", Table, Field, To, Where, Where2);
mysql_query(query);
return true;
}
stock mysql_SetString(Table[], Field[], To[], Where[], Where2[])
{
new query[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(To, To);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Where2, Where2);
format(query, 128, "UPDATE %s SET %s = '%s' WHERE %s = '%s'", Table, Field, To, Where, Where2);
mysql_query(query);
return true;
}
{
new query[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(To, To);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Where2, Where2);
format(query, 128, "UPDATE %s SET %s = '%s' WHERE %s = '%s'", Table, Field, To, Where, Where2);
mysql_query(query);
return true;
}
stock mysql_SetFloat(Table[], Field[], Float:To, Where[], Where2[])
{
new query[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Where2, Where2);
format(query, 128, "UPDATE `%s` SET `%s` = '%f' WHERE `%s` = '%s'", Table, Field, To, Where, Where2);
mysql_query(query);
return true;
}
{
new query[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Where2, Where2);
format(query, 128, "UPDATE `%s` SET `%s` = '%f' WHERE `%s` = '%s'", Table, Field, To, Where, Where2);
mysql_query(query);
return true;
}
stock SpielerLaden(playerid)
{
if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
{
GetPlayerName(playerid, aSpieler[playerid][aName], MAX_PLAYER_NAME);
aSpieler[playerid][aadmin] = mysql_GetInt("LittleAdmin", "Admin", "Name", aSpieler[playerid][aName]);
aSpieler[playerid][abanned] = mysql_GetInt("LittleAdmin", "Gebannt", "Name", aSpieler[playerid][aName]);
}
return 1;
}
{
if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
{
GetPlayerName(playerid, aSpieler[playerid][aName], MAX_PLAYER_NAME);
aSpieler[playerid][aadmin] = mysql_GetInt("LittleAdmin", "Admin", "Name", aSpieler[playerid][aName]);
aSpieler[playerid][abanned] = mysql_GetInt("LittleAdmin", "Gebannt", "Name", aSpieler[playerid][aName]);
}
return 1;
}
stock SpielerSpeichern(playerid)
{
if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
{
if(GetPVarInt(playerid,"Eingeloggt") == 1)
{
GetPlayerName(playerid, aSpieler[playerid][aName], MAX_PLAYER_NAME);
mysql_SetInt("LittleAdmin", "Admin", aSpieler[playerid][aadmin], "Name", aSpieler[playerid][aName]);
mysql_SetInt("LittleAdmin", "Gebannt", aSpieler[playerid][abanned], "Name", aSpieler[playerid][aName]);
}
}
return 1;
}
{
if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
{
if(GetPVarInt(playerid,"Eingeloggt") == 1)
{
GetPlayerName(playerid, aSpieler[playerid][aName], MAX_PLAYER_NAME);
mysql_SetInt("LittleAdmin", "Admin", aSpieler[playerid][aadmin], "Name", aSpieler[playerid][aName]);
mysql_SetInt("LittleAdmin", "Gebannt", aSpieler[playerid][abanned], "Name", aSpieler[playerid][aName]);
}
}
return 1;
}
Code
-- phpMyAdmin SQL Dump-- version 3.5.2.2-- http://www.phpmyadmin.net---- Host: 127.0.0.1-- Erstellungszeit: 27. Apr 2013 um 02:41-- Server Version: 5.5.27-- PHP-Version: 5.4.7SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";SET time_zone = "+00:00";-- ------------------------------------------------------------ Tabellenstruktur für Tabelle `accounts`--CREATE TABLE IF NOT EXISTS `LittleAdmin` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Name` varchar(24) NOT NULL, `Admin` int(11) NOT NULL DEFAULT '0', `Gebannt` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=225 ;
-
Edits Virtual Worlds werden bei /goto & /gethere beachtet und gesetzt