Mute Command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Mute Command (
/showthread.php?tid=611115)
Mute Command -
alekschowee - 02.07.2016
Код:
if(strcmp(cmd, "/tmute", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "Използвай: /tmute [playerid/PartOfName] [time][Reason]");
return 1;
}
new playa;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
new time = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 2)
{
if(IsPlayerConnected(playa))
{
if(PlayerInfo[playa][pAdmin] > PlayerInfo[playerid][pAdmin])
{
SendClientMessage(playerid, COLOR_GREY, "Не можеш да заглушиш по висок админ левел!");
return 1;
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[256];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
}
if(playa != INVALID_PLAYER_ID)
{
PlayerInfo[playa][ptMuted] = time*60;
PlayerInfo[playa][pMuted] = 1;
}
if(playa != INVALID_PLAYER_ID)
{
PlayerInfo[playa][ptMuted] = time*60;
PlayerInfo[playa][pMuted] = 1;
format(string, sizeof(string), "ADMIN:%s беше заглушен от администратор %s за %d минути.[Причина: %s]",PlayerName(playa), PlayerName(playerid), time, (result));
SendClientMessageToAll(COLOR_RED,string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Нямаш права за да ползваш командата!");
}
}
return 1;
}
Errors:
Код:
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1320) : error 017: undefined symbol "cmd"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1324) : error 017: undefined symbol "tmp"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1324) : error 017: undefined symbol "strtok"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1325) : error 017: undefined symbol "tmp"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1327) : error 017: undefined symbol "COLOR_WHITE"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1331) : error 017: undefined symbol "ReturnUser"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1332) : error 017: undefined symbol "tmp"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1332) : error 017: undefined symbol "strtok"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1333) : error 017: undefined symbol "tmp"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1340) : error 017: undefined symbol "COLOR_GREY"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1344) : error 017: undefined symbol "idx"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1346) : error 017: undefined symbol "idx"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1346) : warning 215: expression has no effect
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1348) : error 017: undefined symbol "idx"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1350) : error 017: undefined symbol "idx"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1352) : error 017: undefined symbol "idx"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1353) : error 017: undefined symbol "idx"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1353) : warning 215: expression has no effect
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1355) : error 017: undefined symbol "idx"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1368) : error 017: undefined symbol "string"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1368) : error 017: undefined symbol "string"
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1368) : error 029: invalid expression, assumed zero
C:\Users\ASUS\Desktop\ВСИЧКО\minch\gamemodes\nfs2.pwn(1368) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
21 Errors.
Re: Mute Command -
Backup7723 - 02.07.2016
paste below OnPlayerCommandText
Код:
if(strcmp(cmdtext, "/tmute", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "Използвай: /tmute [playerid/PartOfName] [time][Reason]");
return 1;
}
new playa;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
new time = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 2)
{
if(IsPlayerConnected(playa))
{
if(PlayerInfo[playa][pAdmin] > PlayerInfo[playerid][pAdmin])
{
SendClientMessage(playerid, COLOR_GREY, "Не можеш да заглушиш по висок админ левел!");
return 1;
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[256];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
}
if(playa != INVALID_PLAYER_ID)
{
PlayerInfo[playa][ptMuted] = time*60;
PlayerInfo[playa][pMuted] = 1;
}
if(playa != INVALID_PLAYER_ID)
{
PlayerInfo[playa][ptMuted] = time*60;
PlayerInfo[playa][pMuted] = 1;
format(string, sizeof(string), "ADMIN:%s беше заглушен от администратор %s за %d минути.[Причина: %s]",PlayerName(playa), PlayerName(playerid), time, (result));
SendClientMessageToAll(COLOR_RED,string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Нямаш права за да ползваш командата!");
}
}
return 1;
}