19.03.2015, 09:59
Once I put the code to OnPlayerText my pawno stops working.
Код:
public OnPlayerText(playerid, text[])
{
new v = GetPlayerVehicleID(playerid);
if(v && !IsABike(v)) //So only if he is in a vehicle and its not a bike
{
format(string, sizeof(string), "%s says %s: %s", sendername, (!window{v})?("[Windows Shut]"):("[Windows Down]"),text);
ProxDetector(20.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
return 0;
}
return 1;
}
if(gPlayerLogged{playerid} != 1)
{
SendClientMessageEx(playerid, COLOR_RED, "You are not logged in.");
return 0;
}
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new string[128];
playerLastTyped[playerid] = 0;
if(TextSpamUnmute[playerid] != 0)
{
if(PlayerInfo[playerid][pAdmin] < 2)
{
//SendClientMessage(playerid, COLOR_WHITE, "You are muted from submitting text right now.");
format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has been automatically kicked for command spamming.", GetPlayerNameEx(playerid), playerid);
ABroadCast(COLOR_YELLOW, string, 2);
ShowPlayerDialog(playerid, DIALOG_SHOW_INFO, DIALOG_STYLE_MSGBOX, "{FFFFFF}Kicked from server", "You have been kicked from the server for command spam.", "Ok", "Cancel");
SetTimerEx("SendToKick", 300, 0, "i", playerid);
return 0;
}
}
if(PlayerInfo[playerid][pAdmin] < 2)
{
TextSpamTimes[playerid]++;
if(TextSpamTimes[playerid] == 5)
{
TextSpamTimes[playerid] = 0;
TextSpamUnmute[playerid] = 10;
SendClientMessageEx(playerid, COLOR_YELLOW, "You have been muted automatically for spamming. Please wait 10 seconds and try again.");
SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_FLOODPROTECTION);
return 0;
}
}
/*Compares last string with current, if the same, alert the staff only on the 3rd command. (Expires after 5 secs)
if(PlayerInfo[playerid][pAdmin] < 2) {
new laststring[128];
if(GetPVarString(playerid, "LastText", laststring, 128)) {
if(!strcmp(laststring, text, true)) {
TextSpamTimes[playerid]++;
if(TextSpamTimes[playerid] == 2) {
TextSpamTimer[playerid] = 30;
TextSpamTimes[playerid] = 0;
format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) is spamming with: %s", GetPlayerNameEx(playerid), playerid, text);
ABroadCast(COLOR_YELLOW, string, 2);
}
}
}
SetPVarString(playerid, "LastText", text);
}*/
if(strfind(text, "|", true) != -1) {
SendClientMessageEx(playerid, COLOR_RED, "You cannot use the '|' character in text.");
return 0;
}
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessageEx(playerid, COLOR_GREY, "You cannot speak, you have been silenced!");
return 0;
}

