Pawn crashes. -
Glossy42O - 04.02.2015
I think it's because of that? O.o
PHP код:
public OnPlayerText(playerid, text[])
{
new noinsult;
for(new i = 0; i < sizeof ForbiddenWords; i++)
{
noinsult = strfind(text, ForbiddenWords[i], true);
if(noinsult != -1)
{
for(new x = noinsult; x < noinsult + strlen(ForbiddenWords[i]); x ++)
{
text[x] = '*';
}
}
}
new ad[15],Index;while(Index < strlen(text))
{
ad = strtok(text,Index);
if(CheckAdv(ad)==1)
{
new i=strfind(text,ad),j-i+strlen(word)-1; text[i++]='[';
while(j<j) {text[i]='•';i++}
text[j]=']';
SetPlayerPos(playerid, 238.0698,1858.0798,17.8835);
{
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name,sizeof(name));
CreateObject(971, 217.26276, 1875.07043, 12.13465, 0.00000, 0.00000, 0.00000);
CreateObject(971, 208.44275, 1875.12671, 12.13465, 0.00000, 0.00000, 0.00000);
CreateObject(971, 226.99435, 1858.85217, 12.13260, 0.00000, 0.00000, -91.00000);
CreateObject(971, 242.75571, 1861.25879, 15.96940, 0.00000, 0.00000, -55.00000);
CreateObject(3524, 230.57623, 1857.48279, 13.68170, 0.00000, 0.00000, -286.00000);
CreateObject(3524, 230.75998, 1858.85315, 13.68170, 0.00000, 0.00000, -286.00000);
CreateObject(3092, 230.97746, 1858.25171, 14.77976, 0.00000, 0.00000, -120.00000);
CreateObject(2908, 230.98877, 1857.39636, 15.71300, -69.44000, 11.00000, 156.00000);
CreateObject(2908, 231.16185, 1858.70996, 15.71300, -69.44000, 11.00000, 156.00000);
CreateObject(3092, 243.30440, 1861.32581, 17.52950, 0.00000, 0.00000, -258.00000);
SendClientMessage(playerid, -1, "{FF0000}You have been jailed by the anti cheat - Reason: Adv");
format(str,sizeof(str), "{FF0000}[ANTI-CHEAT]: %s Has been jailed by the anti cheat - Reason: Adv.");
SendClientMessageToAll(-1,str);
SetTimerEx("JailTimer", 440000, false);
//------------------------------------That's ^^^ not below.
SpamTimer[playerid] = SetTimerEx("DecreaseSpam",MAX_DECREASECOUNT*1000,1,"",playerid);
if(PlayerSpam[playerid] < MAX_SPAM)
{
PlayerSpam[playerid] ++;
}
else if(PlayerSpam[playerid] >= MAX_SPAM)
{
new TalkS[120],string[120], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name,sizeof(name));
format(string,sizeof(string), "{FF0000}[ANTI-CHEAT]: %s(ID: %d) has been kicked from the server - Reason: Spam",name, playerid);
SendClientMessageToAll(-1,string);
format(TalkS,sizeof(TalkS), "{FF0000}You have been kicked for spamming.");
ShowPlayerDialog(playerid, DIALOG_ANTI, DIALOG_STYLE_MSGBOX,"{FF0000}ANTI CHEAT",TalkS,"OK","");
PlayerSpam[playerid] = 0;
KillTimer(SpamTimer[playerid]);
SetTimerEx("SpamTimerKick", 1000, false, "i", playerid);
}
return 1;
}
And this
PHP код:
stock strtok(const string[], &index,seperator=' ')
{
new length = strlen(string);
new offset = index;
new result[128];
while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
if ((index < length) && (string[index] == seperator))
{
index++;
}
return result;
}
IsNumeric(const string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}
}
And that
Код:
forward JailTimer(playerid);
public JailTimer(playerid)
{
GetPlayerPos(playerid, gPos[0],gPos[1],gPos[2],gPos[3]);
SetPlayerPos(playerid, gPos[0],gPos[1],gPos[2],gPos[3]);
SetPlayerHealth(playerid, 2);
SendClientMessage(playerid, -1, "{FF0000}[ANTI-CHEAT]: Nope, Your punishment is still not over - The anti cheat has setted your HP to %2 - Survive with that and next time don't do it");
return 1;
}
Re: Pawn crashes. -
Glossy42O - 06.02.2015
bump
Re: Pawn crashes. -
Admigo - 06.02.2015
You have one bracket to much in your script.
Change:
pawn Код:
IsNumeric(const string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}
}
To:
pawn Код:
IsNumeric(const string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}
Re: Pawn crashes. -
Glossy42O - 06.02.2015
Same, Still crashes.
Re: Pawn crashes. -
Admigo - 06.02.2015
Quote:
Originally Posted by Stuun23
Same, Still crashes.
|
Change the OnPlayerText to:
Код:
public OnPlayerText(playerid, text[])
{
new noinsult;
for(new i = 0; i < sizeof ForbiddenWords; i++)
{
noinsult = strfind(text, ForbiddenWords[i], true);
if(noinsult != -1)
{
for(new x = noinsult; x < noinsult + strlen(ForbiddenWords[i]); x ++)
{
text[x] = '*';
}
}
}
new ad[15],Index;
while(Index < strlen(text))
{
ad = strtok(text,Index);
if(CheckAdv(ad)==1)
{
new i=strfind(text,ad),j-i+strlen(word)-1; text[i++]='[';
while(j<j) {text[i]='•';i++}
text[j]=']';
SetPlayerPos(playerid, 238.0698,1858.0798,17.8835);
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name,sizeof(name));
CreateObject(971, 217.26276, 1875.07043, 12.13465, 0.00000, 0.00000, 0.00000);
CreateObject(971, 208.44275, 1875.12671, 12.13465, 0.00000, 0.00000, 0.00000);
CreateObject(971, 226.99435, 1858.85217, 12.13260, 0.00000, 0.00000, -91.00000);
CreateObject(971, 242.75571, 1861.25879, 15.96940, 0.00000, 0.00000, -55.00000);
CreateObject(3524, 230.57623, 1857.48279, 13.68170, 0.00000, 0.00000, -286.00000);
CreateObject(3524, 230.75998, 1858.85315, 13.68170, 0.00000, 0.00000, -286.00000);
CreateObject(3092, 230.97746, 1858.25171, 14.77976, 0.00000, 0.00000, -120.00000);
CreateObject(2908, 230.98877, 1857.39636, 15.71300, -69.44000, 11.00000, 156.00000);
CreateObject(2908, 231.16185, 1858.70996, 15.71300, -69.44000, 11.00000, 156.00000);
CreateObject(3092, 243.30440, 1861.32581, 17.52950, 0.00000, 0.00000, -258.00000);
SendClientMessage(playerid, -1, "{FF0000}You have been jailed by the anti cheat - Reason: Adv");
format(str,sizeof(str), "{FF0000}[ANTI-CHEAT]: %s Has been jailed by the anti cheat - Reason: Adv.");
SendClientMessageToAll(-1,str);
SetTimerEx("JailTimer", 440000, false);
}
//------------------------------------That's ^^^ not below.
}
SpamTimer[playerid] = SetTimerEx("DecreaseSpam",MAX_DECREASECOUNT*1000,1,"",playerid);
if(PlayerSpam[playerid] < MAX_SPAM)
{
PlayerSpam[playerid] ++;
}
else if(PlayerSpam[playerid] >= MAX_SPAM)
{
new TalkS[120],string[120], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name,sizeof(name));
format(string,sizeof(string), "{FF0000}[ANTI-CHEAT]: %s(ID: %d) has been kicked from the server - Reason: Spam",name, playerid);
SendClientMessageToAll(-1,string);
format(TalkS,sizeof(TalkS), "{FF0000}You have been kicked for spamming.");
ShowPlayerDialog(playerid, DIALOG_ANTI, DIALOG_STYLE_MSGBOX,"{FF0000}ANTI CHEAT",TalkS,"OK","");
PlayerSpam[playerid] = 0;
KillTimer(SpamTimer[playerid]);
SetTimerEx("SpamTimerKick", 1000, false, "i", playerid);
}
return 1;
}
If errors showing up tell me.
Re: Pawn crashes. -
Glossy42O - 06.02.2015
Ah i found why it crashed. lol i had that
PHP код:
new word[150],Index;while(Index < strlen(text)) {
word = strtok(text,Index);
if(CheckAdv(word)==1){//If there is a word of the words in the CheckAdv stock!
//If the player text contained . and numbers!
new i=strfind(text,word),j=i+strlen(word)-1; text[i++]='[';
while(i<j) {text[i]='•';i++;}
text[j]=']';
Kick(playerid);//This one will kick the player for sure!
new string2[128];//WE MAKE A string called string2
//First we format it!
format(string2, sizeof(string2), "[ANTI-CHEAT] %s has been jailed by the anti cheat - Reason: Adv",GetName(playerid),playerid);
SendClientMessageToAll(-1, string2);
return 1;
}
Twice.
eDIT: btw
PHP код:
C:\Users\yan\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(264) : error 017: undefined symbol "strtok"
C:\Users\yan\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(264) : error 033: array must be indexed (variable "ad")
C:\Users\yan\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(265) : error 017: undefined symbol "CheckAdv"
C:\Users\yan\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(267) : error 001: expected token: ";", but found "-"
C:\Users\yan\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(267) : error 017: undefined symbol "word"
C:\Users\yan\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(267) : warning 215: expression has no effect
C:\Users\yan\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(268) : error 001: expected token: ";", but found "}"
C:\Users\yan\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(287) : warning 202: number of arguments does not match definition
C:\Users\yan\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(289) : warning 217: loose indentation
C:\Users\yan\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(307) : warning 217: loose indentation
C:\Users\yan\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(307) : error 079: inconsistent return types (array & non-array)
C:\Users\yan\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(309) : warning 217: loose indentation
C:\Users\yan\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(309) : error 029: invalid expression, assumed zero
C:\Users\yan\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(309) : error 017: undefined symbol "strtok"
C:\Users\yan\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(309) : error 029: invalid expression, assumed zero
C:\Users\yan\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(309) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
11 Errors.
Re: Pawn crashes. -
Admigo - 06.02.2015
Are you sure you are not missing more missing brackets that cause this problem?
Re: Pawn crashes. -
Glossy42O - 06.02.2015
Nope, No brackets missing.