mute, freeze help? -
mrsamp - 18.08.2011
can someone help me? if i type etc /mute 1(player is connected) it show's " Usage: /mute [id] " help?
My Code!
Код:
CMD:mute(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
new cmd[256],tmp[256],cmdtext[256],idx;
cmd = strtok(cmdtext, idx);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, " Usage: /mute [id] ");
new giveplayerid = strval(tmp);
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, " Player not connected ! ");
new name[24], name2[24], str[128];
GetPlayerName(playerid, name, 24);
GetPlayerName(giveplayerid, name2, 24);
format(str, sizeof str, "*Admin %s has muted %s ", name, name2);
SendClientMessageToAll(COLOR_PINK, str);
Muted[giveplayerid] = 1;
return 1;
}
else return SendClientMessage(playerid, COLOR_RED, "Admin command!");
}
same with freeze, unfreeze and unmute :P
Код:
CMD:freeze(playerid, params[])
{
if (IsPlayerAdmin(playerid))
{
new cmdtext[256];
if(!strlen(cmdtext[8]))
{
SendClientMessage(playerid, COLOR_RED, "Usage: /freeze [playerid]");
return 1;
}
new ID = strval(cmdtext[8]);
new strv[170];
new tmp[256];
new giveplayerid = strval(tmp);
new name2[24];
if(IsPlayerConnected(ID))
{
GetPlayerName(giveplayerid, name2, 24);
format(strv, 170, "*%s has been frozen by Admin.", name2);
SendClientMessageToAll(COLOR_PINK, strv);
TogglePlayerControllable( ID ,0);
}
}
return SendClientMessage(playerid, COLOR_RED, "Admin command!");
}
Re: mute, freeze help? -
iGetty - 18.08.2011
pawn Код:
command(freeze, playerid, params[])
{
new id, string[128];
if(sscanf(params, "u", id))
{
if(IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, WHITE, "Server: /freeze [playerid]");
}
}
else
{
if(IsPlayerAdmin(playerid))
{
if(IsPlayerConnected(id))
{
TogglePlayerControllable(id, false);
format(string, sizeof(string), "%s has been frozen by Admin.", Name2);
SendClientMessageToAll(WHITE, string);
}
else
{
SendClientMessage(playerid, WHITE, "That player is not connected or isn't logged in.");
}
}
}
return 1;
}
That is my freeze command, tweaked a little to your needs.
Change yours to that, same with the other commands.
Hope I helped.
Re: mute, freeze help? -
mrsamp - 18.08.2011
Well Thank you if it work's
Re: mute, freeze help? -
iGetty - 18.08.2011
No problem my friend, here to help. (Could ye' gimmie a rep please? :3, I wanna get my server advertisement up, but I can't
)
Re: mute, freeze help? -
mrsamp - 18.08.2011
C:\SAmp-server\Drift\gamemodes\grandlarc.pwn(577) : error 017: undefined symbol "sccanf"
C:\SAmp-server\Drift\gamemodes\grandlarc.pwn(591) : error 017: undefined symbol "Name2"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
Re: mute, freeze help? -
iGetty - 18.08.2011
Add this to the script at the bottom:
pawn Код:
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;
}
And change
to
Re: mute, freeze help? -
mrsamp - 18.08.2011
pawn compiler has stopped working....
Re: mute, freeze help? -
iGetty - 18.08.2011
You got TeamViewer?, PM me.
Re: mute, freeze help? -
ElieJabbour - 18.08.2011
pawn Код:
CMD:mute(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new string[128], giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /mute [player]");
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid == playerid)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You can not use this command on yourself!");
return 1;
}
if(PlayerInfo[giveplayerid][pMuted] == 0)
{
if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin])
{
format(string, sizeof(string), "%s just tried to /mute you.",GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_YELLOW, string);
SendClientMessageEx(playerid, COLOR_WHITE, "You can't perform this action on an equal or higher level administrator."); // Low and Equal Admins won't be able to freeze each other, Prevents Idiotic Actions between admins, so they won't have fun when you're not around
return 1;
}
PlayerInfo[giveplayerid][pMuted] = 1;
format(string, sizeof(string), "AdmCmd: %s was silenced by %s.",GetPlayerNameEx(giveplayerid),GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED,string,2);
}
else
{
PlayerInfo[giveplayerid][pMuted] = 0;
format(string, sizeof(string), "AdmCmd: %s was unsilenced by %s.",GetPlayerNameEx(giveplayerid),GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED,string,2);
}
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}
pawn Код:
CMD:freeze(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
new string[128], giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /freeze [player]");
if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You can't freeze a higher admin."); // Low Admins won't be able to freeze higher admins
return 1;
}
TogglePlayerControllable(giveplayerid, 0);
SetPVarInt(giveplayerid, "IsFrozen", 1);
format(string, sizeof(string), "AdmCmd: %s was frozen by %s",GetPlayerNameEx(giveplayerid),GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED,string,2);
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}
Try this
Re: mute, freeze help? -
iGetty - 18.08.2011
I have helped him over PM, no need.
Re: mute, freeze help? -
ElieJabbour - 18.08.2011
Quote:
Originally Posted by getty154
I have helped him over PM, no need.
|
Alright then, You got a Reputation from me ^^
Re: mute, freeze help? -
mrsamp - 18.08.2011
Yes no help needed but TY anyway...