12.09.2014, 15:25
Hey, so i am working on a mute system. I have a Saving/Loading system on it. Here are my codes:
Saving:
Saving and Loading OnPlayerConnect
Loading:
I have a mute spam kick system and mute and unmute commands.
And i get these error:
Need Help ASAP.
Saving:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Muted",PlayerInfo[playerid][Muted]);
INI_WriteString(File,"MutedReason",PlayerInfo[playerid][MutedReason]);
INI_WriteInt(File,"MuteWarnings",PlayerInfo[playerid][MuteWarnings]);
INI_WriteInt(File,"SpamMute",PlayerInfo[playerid][SpamMute]);
INI_WriteInt(File,"TotalMute",PlayerInfo[playerid][TotalMute]);
INI_Close(File);
return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
}
else
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Muted",0);
INI_WriteString(File,"MutedReason", "0");
INI_WriteInt(File,"MuteWarnings",0);
INI_WriteInt(File,"SpamMute", 0);
INI_WriteInt(File,"TotalMute",0);
INI_Close(File);
}
return 1;
}
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Muted",PlayerInfo[playerid][Muted]);
INI_String("MutedReason",PlayerInfo[playerid][MutedReason], 70);
INI_Int("MuteWarnings",PlayerInfo[playerid][MuteWarnings]);
INI_Int("SpamMute",PlayerInfo[playerid][SpamMute]);
INI_Int("TotalMute",PlayerInfo[playerid][TotalMute]);
return 1;
}
pawn Код:
public OnPlayerText(playerid, text[])
{
if (PlayerInfo[playerid][Muted] == 1){
PlayerInfo[playerid][MuteWarnings]++;
new msg1[128];
format(msg1, sizeof(msg1), "* You're Muted, You can't talk. (Warnings: %d/%d)", PlayerInfo[playerid][MuteWarnings], MAX_WARNINGS);
SendClientMessage(playerid, COLOR_YELLOW, msg1);
if (PlayerInfo[playerid][MuteWarnings] >= MAX_WARNINGS) {
new msg2[128], name[MAX_PLAYER_NAME];
SendClientMessage(playerid, COLOR_RED, "* You've been kicked due to Mute spamming!");
PlayerInfo[playerid][Muted] = 0;
PlayerInfo[playerid][MuteWarnings] = 0;
PlayerInfo[playerid][MutedReason] = "0"; // Line 110
SetTimerEx("KickDelay", 1000, false, "d", playerid);
GetPlayerName(playerid,name, sizeof(name));
format(msg2, sizeof(msg2), "[KICK]: %s has been kicked [Reason: Mute Spamming].", name);
SendClientMessageToAll(COLOR_YELLOW, msg2);
}
return 0;
}
return 1;
}
CMD:unmute(playerid, params[]) {
if (IsPlayerAdmin(playerid)) {
new targetid, aname[MAX_PLAYER_NAME], tname[MAX_PLAYER_NAME], msg1[128];
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"[USAGE]: /unmute [playerid]" );
if(targetid == INVALID_PLAYER_ID) return SendClientMessage( playerid, COLOR_RED,"[ERROR]: Player Is Not Connected!" );
if (!IsPlayerMuted(playerid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: That player is not muted.");
GetPlayerName(playerid, aname, sizeof(aname));
GetPlayerName(targetid, tname, sizeof(tname));
format(msg1, sizeof(msg1), "* Administrator %s has unmuted %s.", aname, tname);
SendClientMessageToAll(COLOR_LIGHTBLUE, msg1);
PlayerInfo[targetid][Muted] = 0;
PlayerInfo[targetid][MutedReason] = "-1"; // Line 205
PlayerInfo[targetid][MuteWarnings] = 0;
PlayerInfo[targetid][SpamMute] = 0;
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
PlayerPlaySound(targetid,1057,0.0,0.0,0.0);
} else {
SendClientMessage(playerid, COLOR_RED, "* Only admins can use that command.");
}
return 1;
}
pawn Код:
C:\Users\ReBzz\Desktop\DarkSkull TDM\filterscripts\AMS.pwn(110) : error 047: array sizes do not match, or destination array is too small
C:\Users\ReBzz\Desktop\DarkSkull TDM\filterscripts\AMS.pwn(205) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
2 Errors.