ziasztok átirtam magamnak egy admin módot a szerveremhez,de a benne található Jail csak a playerid-t és az indokot kér.
Én meg úgy szeretném,hogy playerid indok perc , megoldható?
Itt az FS:
http://pastebin.com/RZ1Q9jmC-------
//--------------------------------------------------------------------------------|
#include <a_samp>
#pragma unused ret_memcpy
#define FILTERSCRIPT
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xFB0000FF
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000FFAA
#define COLOR_BROWN 0x993300AA
#define COLOR_ORANGE 0xFF9933AA
//--------------------------------------------------------------------------------|
#define MAX_PING 700 // Change \"700\" to whatever you want.
//--------------------------------------------------------------------------------|
#include <dutils>
#include <float>
#include <dudb>
#include <Dini>
#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
new Jailed[MAX_PLAYERS];
//--------------------------------------------------------------------------------|
public OnFilterScriptInit()
{
return 1;
}
//--------------------------------------------------------------------------------|
public OnPlayerConnect(playerid)
{
Jailed[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
//--------------------------------------------------------------------------------|
public OnPlayerUpdate(playerid)
{
new string[128];
new PlayerName[32];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(GetPlayerPing(playerid) >= MAX_PING)
{
format(string, sizeof(string), \"|| %s autómatikusan kirúgva a szerverrõl: (Magas Ping). Max: %d ||\", PlayerName, MAX_PING);
SendClientMessageToAll(COLOR_RED, string);
Kick(playerid);
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(Jailed[playerid] == 1)
{
return 1;
}
dcmd(kick, 4, cmdtext);
dcmd(ban, 3, cmdtext);
dcmd(freeze, 6, cmdtext);
dcmd(unfreeze, 8, cmdtext);
dcmd(say, 3, cmdtext);
dcmd(slap, 4, cmdtext);
dcmd(heal, 4, cmdtext);
dcmd(akill, 5, cmdtext);
dcmd(jail, 4, cmdtext);
dcmd(unjail, 6, cmdtext);
dcmd(minigun, 7, cmdtext);
dcmd(god, 3, cmdtext);
return 0;
}
dcmd_kick(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new tmp[256], idx;
tmp = strtok(params,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: /kick [playerid] [indok]\");
return true;
}
new pid = strval(tmp);
if(!IsPlayerConnected(pid))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: Helytelen Játékos ID.\");
return true;
}
tmp = strrest(params,idx);
new pname[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME], string[256];
GetPlayerName(pid, pname, sizeof(pname));
GetPlayerName(playerid, pname2, sizeof(pname2));
format(string, sizeof(string), \"|| Adminisztrátor %s kirúgta %s-t. Indok: %s ||\", pname2, pname, tmp);
SendClientMessageToAll(COLOR_ORANGE, string);
Kick(pid);
return true;
}
else return SendClientMessage(playerid, COLOR_RED, \"HIBA: Te nem vagy admin.\");
}
dcmd_ban(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new tmp[256], idx;
tmp = strtok(params,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: /ban [playerid] [indok]\");
return true;
}
new pid = strval(tmp);
if(!IsPlayerConnected(pid))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: Helytelen Játékos ID.\");
return true;
}
tmp = strrest(params,idx);
new pname[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME], string[256];
GetPlayerName(pid, pname, sizeof(pname));
GetPlayerName(playerid, pname2, sizeof(pname2));
format(string, sizeof(string), \"|| Adminisztrátor %s bannolta %s-t. Indok: %s ||\", pname2, pname, tmp);
SendClientMessageToAll(COLOR_ORANGE, string);
Ban(pid);
return true;
}
else return SendClientMessage(playerid, COLOR_RED, \"HIBA: Te nem vagy admin.\");
}
dcmd_freeze(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new tmp[256], idx;
tmp = strtok(params,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: /freeze [playerid] [indok]\");
return true;
}
new pid = strval(tmp);
if(!IsPlayerConnected(pid))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: Helytelen Játékos ID.\");
return true;
}
tmp = strrest(params,idx);
new pname[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME], string[256];
GetPlayerName(pid, pname, sizeof(pname));
GetPlayerName(playerid, pname2, sizeof(pname2));
format(string, sizeof(string), \"|| Adminisztrátor %s lefagyasztotta %s-t. Indok: %s ||\", pname2, pname, tmp);
SendClientMessageToAll(COLOR_ORANGE, string);
TogglePlayerControllable(pid, false);
return true;
}
else return SendClientMessage(playerid, COLOR_RED, \"HIBA: Te nem vagy admin.\");
}
dcmd_unfreeze(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new tmp[256], idx;
tmp = strtok(params,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: /unfreeze [playerid] [indok]\");
return true;
}
new pid = strval(tmp);
if(!IsPlayerConnected(pid))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: Helytelen Játékos ID.\");
return true;
}
tmp = strrest(params,idx);
new pname[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME], string[256];
GetPlayerName(pid, pname, sizeof(pname));
GetPlayerName(playerid, pname2, sizeof(pname2));
format(string, sizeof(string), \"|| Adminisztrátor %s kifagyasztotta %s-t. Indok: %s ||\", pname2, pname, tmp);
SendClientMessageToAll(COLOR_ORANGE, string);
TogglePlayerControllable(pid, true);
return true;
}
else return SendClientMessage(playerid, COLOR_RED, \"HIBA: Te nem vagy admin.\");
}
dcmd_say(playerid, params[])
{
new message[128], string[128], name[MAX_PLAYER_NAME];
if (sscanf(params, \"s\", message)) SendClientMessage(playerid,COLOR_RED,\"HIBA: /say [üzenet]\");
else
{
if(IsPlayerAdmin(playerid))
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), \"|| Adminisztrátor %s: %s ||\", name, message); // You will probably want to re-format this.
SendClientMessageToAll(COLOR_ORANGE, string);
}
else
{
SendClientMessage(playerid, COLOR_RED, \"HIBA: Te nem vagy admin.\");
}
}
return 1;
}
dcmd_slap(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new tmp[256], idx;
tmp = strtok(params,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: /slap [playerid] [indok]\");
return true;
}
new pid = strval(tmp);
if(!IsPlayerConnected(pid))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: Helytelen Játékos ID.\");
return true;
}
new Float:pX,Float:pY,Float:pZ;
tmp = strrest(params,idx);
new pname[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME], string[256];
GetPlayerName(pid, pname, sizeof(pname));
GetPlayerName(playerid, pname2, sizeof(pname2));
format(string, sizeof(string), \"|| Adminisztrátor %s megsebesítette %s-t. Indok: %s ||\", pname2, pname, tmp);
SendClientMessageToAll(COLOR_ORANGE, string);
GetPlayerPos(pid,pX,pY,pZ);
SetPlayerPos(pid,pX,pY,pZ+5);
return true;
}
else return SendClientMessage(playerid, COLOR_RED, \"HIBA: Te nem vagy admin.\");
}
dcmd_heal(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new tmp[256], idx;
tmp = strtok(params,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: /heal [playerid]\");
return true;
}
new pid = strval(tmp);
if(!IsPlayerConnected(pid))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: Helytelen Játékos ID.\");
return true;
}
tmp = strrest(params,idx);
new pname[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME], string[256];
GetPlayerName(pid, pname, sizeof(pname));
GetPlayerName(playerid, pname2, sizeof(pname2));
format(string, sizeof(string), \"|| Adminisztrátor %s feltöltötte az életét %s-nek. ||\", pname2, pname);
SendClientMessageToAll(COLOR_ORANGE, string);
SetPlayerHealth(pid, 100);
return true;
}
else return SendClientMessage(playerid, COLOR_RED, \"HIBA: Te nem vagy admin.\");
}
dcmd_akill(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new tmp[256], idx;
tmp = strtok(params,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: /akill [playerid]\");
return true;
}
new pid = strval(tmp);
if(!IsPlayerConnected(pid))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: Helytelen Játékos ID.\");
return true;
}
tmp = strrest(params,idx);
new pname[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME], string[256];
GetPlayerName(pid, pname, sizeof(pname));
GetPlayerName(playerid, pname2, sizeof(pname2));
format(string, sizeof(string), \"|| Adminisztrátor %s megölte %s-t. ||\", pname2, pname);
SendClientMessageToAll(COLOR_ORANGE, string);
SetPlayerHealth(pid, 0);
return true;
}
else return SendClientMessage(playerid, COLOR_RED, \"HIBA: Te nem vagy admin.\");
}
dcmd_jail(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new tmp[256], idx;
tmp = strtok(params,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: /jail [playerid] [indok]\");
return true;
}
new pid = strval(tmp);
if(!IsPlayerConnected(pid))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: Helytelen Játékos ID.\");
return true;
}
tmp = strrest(params,idx);
new pname[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME], string[256];
GetPlayerName(pid, pname, sizeof(pname));
GetPlayerName(playerid, pname2, sizeof(pname2));
format(string, sizeof(string), \"|| Adminisztrátor %s bebörtönözte %s-t. Indok: %s ||\", pname2, pname, tmp);
SendClientMessageToAll(COLOR_ORANGE, string);
SetPlayerInterior(pid, 6);
SetPlayerVirtualWorld(playerid, 1);
SetPlayerPos(pid,947.3790,2501.9927,14.8659);
ResetPlayerWeapons(pid);
Jailed[playerid] = 1;
return true;
}
else return SendClientMessage(playerid, COLOR_RED, \"HIBA: Te nem vagy admin.\");
}
dcmd_unjail(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new tmp[256], idx;
tmp = strtok(params,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: /unjail [playerid]\");
return true;
}
new pid = strval(tmp);
if(!IsPlayerConnected(pid))
{
SendClientMessage(playerid,COLOR_RED,\"HIBA: Helytelen Játékos ID.\");
return true;
}
tmp = strrest(params,idx);
new pname[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME], string[256];
GetPlayerName(pid, pname, sizeof(pname));
GetPlayerName(playerid, pname2, sizeof(pname2));
format(string, sizeof(string), \"|| Adminisztrátor %s elengedte %s-t. ||\", pname2, pname);
SendClientMessageToAll(COLOR_RED, string);
Jailed[playerid] = 0;
SetPlayerHealth(pid,0);
SetPlayerPos(pid,1934.8292,1329.2439,9.2501);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
return true;
}
else return SendClientMessage(playerid, COLOR_RED, \"HIBA: Te nem vagy admin.\");
}
dcmd_minigun(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new tmp[256], idx;
tmp = strtok(params,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_GREY,\"|| Usage: /minigun (playerid) ||\");
SendClientMessage(playerid,COLOR_GREY,\"|| Function: Gives the player a minigun ||\");
return true;
}
new pid = strval(tmp);
if(!IsPlayerConnected(pid))
{
SendClientMessage(playerid,COLOR_GREY,\"[!] Incorrect ID.\");
return true;
}
tmp = strrest(params,idx);
new pname[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME], string[256];
GetPlayerName(pid, pname, sizeof(pname));
GetPlayerName(playerid, pname2, sizeof(pname2));
format(string, sizeof(string), \"|| Administrator %s gave %s a minigun. ||\", pname2, pname);
SendClientMessageToAll(COLOR_GREY, string);
GivePlayerWeapon(pid, 38, 10000000);
return true;
}
else return SendClientMessage(playerid, COLOR_RED, \"[!] You are not logged into RCON.\");
}
dcmd_god(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new tmp[256], idx;
tmp = strtok(params,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_GREY,\"|| Usage: /god (playerid) ||\");
SendClientMessage(playerid,COLOR_GREY,\"|| Function: Makes the given player god ||\");
return true;
}
new pid = strval(tmp);
if(!IsPlayerConnected(pid))
{
SendClientMessage(playerid,COLOR_GREY,\"[!] Incorrect ID.\");
return true;
}
tmp = strrest(params,idx);
new pname[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME], string[256];
GetPlayerName(pid, pname, sizeof(pname));
GetPlayerName(playerid, pname2, sizeof(pname2));
format(string, sizeof(string), \"|| %s is now GODLIKE thanks to Adminstrator %s ||\", pname, pname2);
SendClientMessageToAll(COLOR_GREEN, string);
GivePlayerWeapon(pid, 38, 10000000);
GivePlayerWeapon(pid, 18, 10000000);
GivePlayerWeapon(pid, 16, 10000000);
SetPlayerHealth(pid,9999999999);
SetPlayerSkin(pid,294);
return true;
}
else return SendClientMessage(playerid, COLOR_RED, \"[!] You are not logged into RCON.\");
}
stock strrest(const string[], index)
{
new length = strlen(string),offset = index,result[256];
while ((index < length) && ((index - offset) < (sizeof(result) - 1)) && (string[index] > \'\\r\'))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
/*----------------------------------------------------------------------------*-
Function:
sscanf
Params:
string[] - String to extract parameters from.
format[] - Parameter types to get.
{Float,_}:... - Data return variables.
Return:
0 - Successful, not 0 - fail.
Notes:
A fail is either insufficient variables to store the data or insufficient
data for the format string - excess data is disgarded.
A string in the middle of the input data is extracted as a single word, a
string at the end of the data collects all remaining text.
The format codes are:
c - A character.
d, i - An integer.
h, x - A hex number (e.g. a colour).
f - A float.
s - A string.
z - An optional string.
pX - An additional delimiter where X is another character.
\'\' - Encloses a litteral string to locate.
u - User, takes a name, part of a name or an id and returns the id if they\'re connected.
Now has IsNumeric integrated into the code.
Added additional delimiters in the form of all whitespace and an
optioanlly specified one in the format string.
-*----------------------------------------------------------------------------*/
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\':
{
setarg(paramPos, 0, _:floatstr(string[stringPos]));
}
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;
}
[mod]Egyszerûbb, ha itt a kód, tehát ide tettem.[/mod]