luxadmin login
#1

lux admin login is when the player spawns i wanna make it after the player succesfully connected but its under OnPlayerConnect so its like i want but it shows after the player spawns O.o here is the code :

Код:
public OnPlayerConnect(playerid)
{
    #if EnableCamHack == true
    KeyState[playerid] = 0;
    FollowOn[playerid] = 0;
    AccInfo[playerid][InCamMod] 	= 0;
    AccInfo[playerid][LockedCam] 	= 0;
    #endif
	AccInfo[playerid][Deaths] 		= 0;
	AccInfo[playerid][Kills] 		= 0;
	AccInfo[playerid][Jailed]		= 0;
	AccInfo[playerid][Frozen]		= 0;
	AccInfo[playerid][Level] 		= 0;
	AccInfo[playerid][pVip]         = 0;
	AccInfo[playerid][LoggedIn] 	= 0;
	AccInfo[playerid][Registered] 	= 0;
	AccInfo[playerid][God] 			= 0;
	AccInfo[playerid][GodCar]		= 0;
	AccInfo[playerid][TimesSpawned]	= 0;
	AccInfo[playerid][Muted] 		= 0;
	AccInfo[playerid][MuteWarnings]	= 0;
	AccInfo[playerid][Warnings] 	= 0;
	AccInfo[playerid][Caps]			= 0;
	AccInfo[playerid][DoorsLocked] 	= 0;
	AccInfo[playerid][pCar]			= -1;
	AccInfo[playerid][SpamCount] 	= 0;
	AccInfo[playerid][MaxAdv] 		= 0;
	AccInfo[playerid][SpamTime] 	= 0;
	AccInfo[playerid][PingCount] 	= 0;
	AccInfo[playerid][PingTime]		= 0;
	AccInfo[playerid][FailLogin] 	= 0;
	AccInfo[playerid][Hide] 		= 0;
	AccInfo[playerid][pInvis]   	= 0;
	AccInfo[playerid][OnDuty]   	= 0;
	AccInfo[playerid][pGps] 		= -1;
	
	#if EnableTwoRcon == true
	AccInfo[playerid][MaxRcon] = 0;
	#endif

	AccInfo[playerid][ConnectTime] = gettime();
    for(new i; i<PING_MAX_EXCEEDS; i++)
	AccInfo[playerid][pPing][i] = 0;
	//------------------------------------------------------
	new string[128];
    new str[128];
	new file[256];
	new PlayerName[MAX_PLAYER_NAME];
	GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
	new tmp3[50]; GetPlayerIp(playerid,tmp3,50);
	
	ResetForbiddenWeaponsForPlayer(playerid);
	TempBanCheck(playerid);
//==============================================================================
// Connect Messages
//==============================================================================
	if(ServerInfo[ConnectMessages] == 1)
	{
	    new pAKA[256];
		pAKA = dini_Get("LuxAdmin/Config/aka.txt",tmp3);
		if (strlen(pAKA) < 3)
		format(str,sizeof(str),"Player %s (Id:%d) has joined the server", PlayerName,playerid);
		else if (!strcmp(pAKA,PlayerName,true))
		format(str,sizeof(str),"Player %s (Id:%d) has joined the server", PlayerName,playerid);
		else format(str,sizeof(str),"Player %s (Id:%d) has joined the server (Aka: %s)",PlayerName,playerid,pAKA);

		for(new i = 0; i < MAX_PLAYERS; i++)
		if(IsPlayerConnected(i) && playerid != i)
		{
		if(AccInfo[i][Level] > 2)
		SendClientMessage(i,grey,str);
		else
		{
		format(string,sizeof(string),"* Player %s (Id:%d) has joined the server", PlayerName, playerid);
 	    SendClientMessage(i,grey,string);
		}
		}
	}
//==============================================================================
// If PlayerName is Banned
//==============================================================================
    if (dUserINT(PlayerName2(playerid)).("Banned") == 1)
    {
        SendClientMessage(playerid, red, "ATTENTION: This name is banned from this server!");
		format(string,sizeof(string),"Player %s (Id:%d) has beenAutomatically  Kicked. (Reason: Name Banned!)",PlayerName,playerid);
		SendClientMessageToAll(red, string);  print(string);
		SaveIn("KickLog",string);  Kick(playerid);
    }
//==============================================================================
// Kick Forbidden Name
//==============================================================================
	if(ServerInfo[NameKick] == 1)
	{
		for(new s = 0; s < BlockedNamesCount; s++)
		{
  			if(!strcmp(BlockedNames[s],PlayerName,true))
			{
			SendClientMessage(playerid,red, "ATTENTION: Your name is on our Black List, you have been Kicked.");
			format(string,sizeof(string),"Player %s (Id:%d) has been Automatically Kicked. (Reason: Forbidden Name)",PlayerName,playerid);
			SendClientMessageToAll(red, string);
			print(string);
			SaveIn("KickLog",string);
			Kick(playerid);
			return 1;
			}
		}
	}
//==============================================================================
// Kick Forbidden Part of Name
//==============================================================================
	if(ServerInfo[PartNameKick] == 1)
	{
		for(new s = 0; s < BlockedPartNameCount; s++)
		{
			new pos;
			while((pos = strfind(PlayerName,BlockedPartName[s],true)) != -1)
			for(new i = pos, j = pos + strlen(BlockedPartName[s]); i < j; i++)
			{
			SendClientMessage(playerid,red, "ATTENTION: Your name is not Allowed on this server, you have been Kicked!.");
			format(string,sizeof(string),"Player %s (Id:%d) has been Automatically Kicked. (Reason: Forbidden Name)",PlayerName,playerid);
			SendClientMessageToAll(red, string);  print(string);
			SaveIn("KickLog",string);  Kick(playerid);
			return 1;
			}
		}
	}
//==============================================================================
// Server Locked
//==============================================================================
	if(ServerInfo[Locked] == 1)
	{
		AccInfo[playerid][AllowedIn] = false;
		SendClientMessage(playerid,red,"Server is Locked!");
		SendClientMessage(playerid,red,"You have 40 seconds to enter the server Password!");
		LockKickTimer[playerid] = SetTimerEx("AutoKick", 40000, 0, "i", playerid);
	}
 	if (ServerInfo[Locked] == 1 && AccInfo[playerid][AllowedIn] == false)
    {
        ShowPlayerDialog(playerid, DIALOG_TYPE_SERVPASS, DIALOG_STYLE_INPUT,
		"Server Locked!.", "Enter the password to Access it:", "Access", "Exit");
	}
//==============================================================================
// Register & Login
//==============================================================================
	if(strlen(dini_Get("LuxAdmin/Config/aka.txt", tmp3)) == 0)
	dini_Set("LuxAdmin/Config/aka.txt", tmp3, PlayerName);
 	else
	{
	    if( strfind( dini_Get("LuxAdmin/Config/aka.txt", tmp3), PlayerName, true) == -1 )
		{
  		format(string,sizeof(string),"%s,%s", dini_Get("LuxAdmin/Config/aka.txt",tmp3), PlayerName);
	   	dini_Set("LuxAdmin/Config/aka.txt", tmp3, string);
		}
 	}
	if(!udb_Exists(PlayerName2(playerid)))
	SendClientMessage(playerid,orange, "SERVER: Your account isn't registered. Please register (/"#RegisterCommand")");
	else
	{
 	AccInfo[playerid][Registered] = 1;
	format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(PlayerName));
	new tmp2[256]; tmp2 = dini_Get(file,"Ip");

	if( (!strcmp(tmp3,tmp2,true)) && (ServerInfo[AutoLogin] == 1))
	{
		LoginPlayer(playerid);
		if(AccInfo[playerid][Level] > 0)
		{
			switch(AccInfo[playerid][Level])
			{
				case 1: AdmRank = "Basic Moderator";
				case 2: AdmRank = "Moderator";
				case 3: AdmRank = "Master Moderator";
				case 4: AdmRank = "Administrator";
				case 5: AdmRank = "Master Administrator";
			}
			if(AccInfo[playerid][Level] > 5)
			{
				AdmRank = "Professional Admin";
			}

//==============================================================================
// VIP System
//==============================================================================
			if(AccInfo[playerid][pVip] > 0)
			{
				switch(AccInfo[playerid][pVip])
				{
					case 1: AccType = "Silver";
					case 2: AccType = "Gold";
					case 3: AccType = "Premium";
				}
				format(string,sizeof(string),"You have been Automatically Logged in | Account: %s | Level %d - %s", AccType, AccInfo[playerid][Level],AdmRank);
				SendClientMessage(playerid,0x00C378AA,string);
			}
			else
			{
				format(string,sizeof(string),"You have been Automatically Logged in | Level %d - %s", AccInfo[playerid][Level],AdmRank);
				SendClientMessage(playerid,green,string);
			}
//==============================================================================
		}
		else
		{
			if(AccInfo[playerid][pVip] > 0)
			{
				switch(AccInfo[playerid][pVip])
				{
					case 1: AccType = "Silver";
					case 2: AccType = "Gold";
					case 3: AccType = "Premium";
				}
				format(string,sizeof(string),"You have been Automatically Logged in - Account Type: %s", AccType);
				SendClientMessage(playerid,0x00C896AA,string);
			}
			else
			{
				format(string,sizeof(string),"You have been Automatically Logged in");
				SendClientMessage(playerid,green,string);
			}
		}
  	}
 	else SendClientMessage(playerid, white, "That account is registered!") &&
	SendClientMessage(playerid, orange, "Please login to access your Account (/"#LoginCommand")");
	}
 	return 1;
}
//==============================================================================
// Automatic Kick
//==============================================================================
public AutoKick(playerid)
{
	if( IsPlayerConnected(playerid) && ServerInfo[Locked] == 1 && AccInfo[playerid][AllowedIn] == false)
	{
	new string[128];
	SendClientMessage(playerid,grey,"You have been Automatically Kicked. (Reason: Server Locked)");
	format(string,sizeof(string),"Player %s (Id:%d) has been Automatically Kicked. (Reason: Server Locked)",PlayerName2(playerid),playerid);
	SaveIn("KickLog",string);
	Kick(playerid);
	SendClientMessageToAll(red, string);
	print(string);
	}
	return 1;
}
//==============================================================================
//-------------------------------------------------
// Player Disconnect
//-------------------------------------------------
//==============================================================================
public OnPlayerDisconnect(playerid, reason)
{
	new PlayerName[MAX_PLAYER_NAME], str[128];
	GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
	
	if(AccInfo[playerid][LoggedIn] == 1)
	SavePlayerStats(playerid);

	if(udb_Exists(PlayerName2(playerid))) dUserSetINT(PlayerName2(playerid)).("Loggedin",0);
  	AccInfo[playerid][LoggedIn] = 0;
	AccInfo[playerid][Level] 	= 0;
	AccInfo[playerid][pVip] 	= 0;
	AccInfo[playerid][Jailed] 	= 0;
	AccInfo[playerid][pCaged]   = 0;
	AccInfo[playerid][MaxAdv]   = 0;
	AccInfo[playerid][Frozen] 	= 0;
	AccInfo[playerid][Hide]   	= 0;
	AccInfo[playerid][OnDuty]  	= 0;
	AccInfo[playerid][pInvis]  	= 0;
	AccInfo[playerid][pGps]		= -1;
	
	#if EnableTwoRcon == true
	AccInfo[playerid][MaxRcon] 	= 0;
	#endif

	if(AccInfo[playerid][Jailed] == 1)
	KillTimer( JailTimer[playerid] );
	
	if(AccInfo[playerid][Frozen] == 1)
	KillTimer( FreezeTimer[playerid] );
	
	if(ServerInfo[Locked] == 1)
	KillTimer( LockKickTimer[playerid] );

	if(AccInfo[playerid][pCar] != -1) EraseVeh(AccInfo[playerid][pCar]);
//------------------------------------------------------------------------------
// Spectating
//------------------------------------------------------------------------------
	for(new x=0; x<MAX_PLAYERS; x++)
    if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && AccInfo[x][SpecID] == playerid)
	AdvanceSpectate(x);
//------------------------------------------------------------------------------
	if(ServerInfo[ConnectMessages] == 1)
	{
	switch (reason)
	{
	case 0:
	format(str, sizeof(str), "* Player %s (Id:%d) has left the Server (Timeout)", PlayerName, playerid);
	case 1:
	format(str, sizeof(str), "* Player %s (Id:%d) has left the Server (Leaving)", PlayerName, playerid);
	case 2:
	format(str, sizeof(str), "* Player %s (Id:%d) has left the Server (Kicked/Banned)", PlayerName, playerid);
	}
	SendClientMessageToAll(grey, str);
    }
    #if EnableCamHack == true
   	if(AccInfo[playerid][InCamMod] == 1)
	{
	    KillTimer(KeyTimer[playerid]);
		AccInfo[playerid][InCamMod] = 0;
	}
	#endif
 	return 1;
}
public DelayKillPlayer(playerid)
{
	SetPlayerHealth(playerid,0.0);
	ForceClassSelection(playerid);
}

stock GetServerHostName()
{
new gString[256];
GetServerVarAsString("hostname", gString, sizeof(gString));
return gString;
}


public OnPlayerRequestSpawn(playerid)
{
	// Request Register
	#if USE_DIALOGS == false
	if(AccInfo[playerid][Registered] == 0 && ServerInfo[MustRegister] == 1 && (!IsPlayerNPC(playerid))){
	SendClientMessage(playerid,lightred,"SERVER: Your account isn't registered. Please Register! | /"#RegisterCommand" [Password]");
	return 0;
	}
	// Request Login
	if(ServerInfo[MustLogin] == 1 && AccInfo[playerid][Registered] == 1 && AccInfo[playerid][LoggedIn] == 0 && (!IsPlayerNPC(playerid))){
 	SendClientMessage(playerid,lightred,"SERVER: Your account is registered. Please Login! | /"#LoginCommand" [Password]");
	return 0;
	}
	#endif
	return 1;
	}
Reply
#2

anyone ?
Reply
#3

Just remove the login and register function completely from OnPlayerSpawn callback.
Reply
#4

im not sure what do u mean
Reply
#5

here is the OnPlayerSpawn what should i do ?
Код:
 public OnPlayerSpawn(playerid)
{
//==============================================================================
// Request Register
//==============================================================================
	if(AccInfo[playerid][Registered] == 0 && ServerInfo[MustRegister] == 1)
	{
		#if USE_DIALOGS == true
		new rstring[256];
		format(rstring,256,"Welcome to the '%s'\n\nAccount '%s' is not registred!\n\nEnter the password to Register your Account:",GetServerHostName(),pName(playerid));
		ShowPlayerDialog(playerid,DIALOGID+66,DIALOG_STYLE_INPUT,"Register Account",rstring,"Register","Quit");
		#endif
		return 1;
	}
//==============================================================================
// Request Login
//==============================================================================
	if(ServerInfo[MustLogin] == 1 && AccInfo[playerid][Registered] == 1 && AccInfo[playerid][LoggedIn] == 0)
	{
		#if USE_DIALOGS == true
		new lstring[256];
		format(lstring,256,"That account '%s 'is Registered!\n\n Login to access your Account:",pName(playerid));
		ShowPlayerDialog(playerid,DIALOGID+67,DIALOG_STYLE_INPUT,"Login Account",lstring,"Login","Quit");
		#endif
		return 1;
	}
//==============================================================================
// Player Frozen (Prevent scape)
//==============================================================================
	AccInfo[playerid][Spawned] = 1;

	if(AccInfo[playerid][Frozen] == 1) {
		TogglePlayerControllable(playerid,false);
		return SendClientMessage(playerid,red,"You cant escape your punishment. You Are Still Frozen");
	}
//==============================================================================
// Player Jail (Prevent scape)
//==============================================================================
	if(AccInfo[playerid][Jailed] == 1) {
	    SetTimerEx("JailPlayer",3000,0,"d",playerid);
		return SendClientMessage(playerid,red,"You cant escape your punishment. You Are Still In Jail");
	}
//==============================================================================
// Administrators Skins/Prevent players to use
//==============================================================================
	if(ServerInfo[AdminOnlySkins] == 1)
	{
		if( (GetPlayerSkin(playerid) == ServerInfo[AdminSkin]) || (GetPlayerSkin(playerid) == ServerInfo[AdminSkin2]))
		{
			if(AccInfo[playerid][Level] >= 1)
			GameTextForPlayer(playerid,"~b~Welcome~n~~w~Admin",3000,1);
			else
			{
			GameTextForPlayer(playerid,"~r~This Skin Is For~n~Administrators~n~Only",4000,1);
			SetTimerEx("DelayKillPlayer", 2500,0,"d",playerid);
			return 1;
			}
		}
	}
	if((dUserINT(PlayerName2(playerid)).("UseSkin")) == 1)
		if((AccInfo[playerid][Level] >= 1) && (AccInfo[playerid][LoggedIn] == 1))
		SetPlayerSkin(playerid,(dUserINT(PlayerName2(playerid)).("FavSkin")) );

//==============================================================================
// Verify player in CAGE
//==============================================================================
	if(AccInfo[playerid][pCaged] == 1)
	{
 	SetTimerEx("CagePrevent", 300, 0, "i", playerid);
 	}
	if(ServerInfo[Announce] == 1)
 	TextDrawShowForPlayer(playerid, Announcements);
//==============================================================================
// Weapons
//==============================================================================
	if(ServerInfo[GiveWeap] == 1)
	{
		if(AccInfo[playerid][LoggedIn] == 1)
		{
			AccInfo[playerid][TimesSpawned]++;
			if(AccInfo[playerid][TimesSpawned] == 1)
			{
			GivePlayerWeapon(playerid,dUserINT(PlayerName2(playerid)).("Weapon1"),dUserINT(PlayerName2(playerid)).("Weapon1Ammo"));
			GivePlayerWeapon(playerid,dUserINT(PlayerName2(playerid)).("Weapon2"),dUserINT(PlayerName2(playerid)).("Weapon2Ammo"));
			GivePlayerWeapon(playerid,dUserINT(PlayerName2(playerid)).("Weapon3"),dUserINT(PlayerName2(playerid)).("Weapon3Ammo"));
			GivePlayerWeapon(playerid,dUserINT(PlayerName2(playerid)).("Weapon4"),dUserINT(PlayerName2(playerid)).("Weapon4Ammo"));
			GivePlayerWeapon(playerid,dUserINT(PlayerName2(playerid)).("Weapon5"),dUserINT(PlayerName2(playerid)).("Weapon5Ammo"));
			GivePlayerWeapon(playerid,dUserINT(PlayerName2(playerid)).("Weapon6"),dUserINT(PlayerName2(playerid)).("Weapon6Ammo"));
			}
		}
	}
	return 1;
}

//==============================================================================
//-------------------------------------------------
// Player Death
//-------------------------------------------------
//==============================================================================
public OnPlayerDeath(playerid, killerid, reason)
{
	#if USE_STATS == true
    AccInfo[playerid][Deaths]++;
	#endif
    InDuel[playerid] = 0;
    
    if(AccInfo[playerid][pCaged] == 1)
    {
   	cage[playerid] 	= DestroyObject(cage[playerid]);
	cage2[playerid] = DestroyObject(cage2[playerid]);
	cage3[playerid] = DestroyObject(cage3[playerid]);
	cage4[playerid] = DestroyObject(cage4[playerid]);
	}
	
	if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
	{
		#if USE_STATS == true
		AccInfo[killerid][Kills]++;
	    #endif
//==============================================================================
// In Duel
//==============================================================================
		if(InDuel[playerid] == 1 && InDuel[killerid] == 1)
		{
		GameTextForPlayer(playerid,"Loser!",3000,3);
		GameTextForPlayer(killerid,"Winner!",3000,3);
		InDuel[killerid] = 0;
		SetPlayerPos(killerid, 0.0, 0.0, 0.0);
		SpawnPlayer(killerid);
		}
		else if(InDuel[playerid] == 1 && InDuel[killerid] == 0)
		{
		GameTextForPlayer(playerid,"Loser !",3000,3);
		}
	}
//==============================================================================
// Spectate
//==============================================================================
	for(new x=0; x<MAX_PLAYERS; x++)
	    if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && AccInfo[x][SpecID] == playerid)
     	AdvanceSpectate(x);
	return 1;
}
//==============================================================================
//-------------------------------------------------
// Player Text
//-------------------------------------------------
//==============================================================================
public OnPlayerText(playerid, text[])
{
//==============================================================================
// Vip Chat
//==============================================================================
	if(text[0] == '*' && AccInfo[playerid][pVip] >= 1)
	{
	    new string[128]; GetPlayerName(playerid,string,sizeof(string));
		format(string,sizeof(string),"|ChatVip| %s: %s",string,text[1]);
		MessageToPlayerVIP(0xDC686BAA,string);
		SaveIn("ChatVipLog",string);
	    return 0;
	}
//==============================================================================
// Administration Chat
//==============================================================================
	if(text[0] == '#' && AccInfo[playerid][Level] >= 1)
	{
	    new string[128]; GetPlayerName(playerid,string,sizeof(string));
		format(string,sizeof(string),"Admin Chat: %s: %s",string,text[1]);
		MessageToAdmins(green,string);
		#if ADM_CHAT_LOG == true
		SaveIn("AdmChatLog",string);
		#endif
	    return 0;
	}
//==============================================================================
// Chat Disabled
//==============================================================================
	if(ServerInfo[DisableChat] == 1)
	{
		SendClientMessage(playerid,red,"Chat has been Disabled!");
	 	return 0;
	}
//==============================================================================
// Player Muted
//==============================================================================
 	if(AccInfo[playerid][Muted] == 1)
	{
 		AccInfo[playerid][MuteWarnings]++;
 		new string[128];
		if(AccInfo[playerid][MuteWarnings] < ServerInfo[MaxMuteWarnings])
		{
		format(string, sizeof(string),"ATTENTION: You are Muted! Cannot talk (Warnings: %d/%d)",AccInfo[playerid][MuteWarnings],ServerInfo[MaxMuteWarnings]);
		SendClientMessage(playerid,red,string);
		}
		else
		{
		SendClientMessage(playerid,red,"You have been Automatically Kicked. (Reason: Exceeding Mute Warnings)");
		format(string, sizeof(string),"Player %s (Id:%d) has been Automatically Kicked. (Reason: Exceeding Mute Warnings)",PlayerName2(playerid),playerid);
		SendClientMessageToAll(grey,string);
		SaveIn("KickLog",string); Kick(playerid);
		} return 0;
	}
//==============================================================================
// Flood/Spam Protection
//==============================================================================
	if(ServerInfo[AntiSpam] == 1 && (AccInfo[playerid][Level] == 0 && !IsPlayerAdmin(playerid)))
	{
		if(AccInfo[playerid][SpamCount] == 0) AccInfo[playerid][SpamTime] = TimeStamp();

	    AccInfo[playerid][SpamCount]++;
		if(TimeStamp() - AccInfo[playerid][SpamTime] > SPAM_TIMELIMIT) { // Its OK your messages were far enough apart
			AccInfo[playerid][SpamCount] = 0;
			AccInfo[playerid][SpamTime] = TimeStamp();
		}
		else if(AccInfo[playerid][SpamCount] == SPAM_MAX_MSGS) {
			new string[64]; format(string,sizeof(string),"Player %s (Id:%d) has been Automatically Kicked. (Reason: Flood/Spam Protection)", PlayerName2(playerid),playerid);
			SendClientMessageToAll(grey,string); print(string);
			SaveIn("KickLog",string);
			Kick(playerid);
		}
		else if(AccInfo[playerid][SpamCount] == SPAM_MAX_MSGS-1) {
			SendClientMessage(playerid,red,"ATTENTION: Anti Spam Warning! Next is a Kick!");
			return 0;
		}
	}
//==============================================================================
// Send Admin in front of name
//==============================================================================
	#if ADM_InMSG == true
	if (AccInfo[playerid][Hide] == 0)
	{
	if(AccInfo[playerid][Level] > 0)
	{
	new str3[256];
	format(str3, 256, "(Admin): %s", text);
	for(new gz=0;gz<200;gz++)
	if(IsPlayerConnected(gz))
	SendPlayerMessageToPlayer(gz, playerid, str3);
	else SendPlayerMessageToPlayer(gz, playerid, text);
	}
	return 0;
	}
	#endif
//==============================================================================
// Forbidden Words
//==============================================================================
	if(ServerInfo[AntiSwear] == 1 && AccInfo[playerid][Level] < ServerInfo[MaxAdminLevel])
	for(new s = 0; s < BadWordsCount; s++)
	{
	new pos;
	while((pos = strfind(text,BadWords[s],true)) != -1)
	for(new i = pos, j = pos + strlen(BadWords[s]); i < j; i++) text[i] = '*';
	}
//==============================================================================
// Anti Advertisements
//==============================================================================
	if(ServerInfo[AntiAds] == 1)
	{
		if(AdvertisementCheck(text) && AccInfo[playerid][Level] < 3)
		{
			AccInfo[playerid][MaxAdv]++;
			new string[128];
			format(string,sizeof(string),"Warning! Suspected ads in your message! (Warnings: %d/%d)",AccInfo[playerid][MaxAdv], MAX_ADV_WARNINGS);
			SendClientMessage(playerid, grey,string);
				
			if(AccInfo[playerid][MaxAdv] == MAX_ADV_WARNINGS)
			{
				format(string,sizeof(string),"You is Automatically Kicked. (Reason: Many ads in your Messages) (%d/%d)",AccInfo[playerid][MaxAdv], MAX_ADV_WARNINGS);
 				SendClientMessage(playerid, lightred,string);
 	
 				format(string,sizeof(string),"Player %s (Id:%d) has beenAutomatically  Kicked. (Reason: Many Advertisements!) (%d)",PlayerName2(playerid),playerid, MAX_ADV_WARNINGS);
 				SaveIn("KickLog",string); Kick(playerid);
				SendClientMessageToAll(lightred, string);
				print(string);
			}
			return 0;
		}
	}
//==============================================================================
// Block CapsLock
//==============================================================================
	if(AccInfo[playerid][Caps] == 1)
	UpperToLower(text);
	if(ServerInfo[NoCaps] == 1)
	UpperToLower(text);
	
//==============================================================================
// Chat Lines (Console)
//==============================================================================
	for(new i = 1; i < MAX_CHAT_LINES-1; i++)
	Chat[i] = Chat[i+1];
	new ChatSTR[128];
	GetPlayerName(playerid,ChatSTR,sizeof(ChatSTR));
	format(ChatSTR,128,"[CHAT]%s: %s",ChatSTR, text[0]);
	Chat[MAX_CHAT_LINES-1] = ChatSTR;
	return 1;
}
//==============================================================================
//-------------------------------------------------
// Private Message (PM)
//-------------------------------------------------
//==============================================================================
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
	if(ServerInfo[ReadPMs] == 1 && AccInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
	{
//==============================================================================
// Send PM
//==============================================================================
    	new string[128];
		new pReciever[MAX_PLAYER_NAME];
		GetPlayerName(playerid, string, sizeof(string));
		GetPlayerName(recieverid, pReciever, sizeof(pReciever));
		format(string, sizeof(string), "PM: %s To %s: %s", string, pReciever, text);
  		for (new a = 0; a < MAX_PLAYERS; a++)
		if(IsPlayerConnected(a) && (AccInfo[a][Level] >= ServerInfo[MaxAdminLevel]) && a != playerid)
		SendClientMessage(a, grey, string);
		#if PM_CHAT_LOG == true
		SaveIn("AdmChatLog",string);
		#endif
	}
//==============================================================================
// Muted
//==============================================================================
 	if(AccInfo[playerid][Muted] == 1)
	{
		new string[128];
 		AccInfo[playerid][MuteWarnings]++;
		if(AccInfo[playerid][MuteWarnings] < ServerInfo[MaxMuteWarnings])
		{
		format(string, sizeof(string),"ATTENTION: You are Muted! Cannot talk (Warnings: %d/%d)",AccInfo[playerid][MuteWarnings],ServerInfo[MaxMuteWarnings]);
		SendClientMessage(playerid,red,string);
		}
		else
		{
		SendClientMessage(playerid,red,"You have been Automatically Kicked. (Reason: Exceeding Mute Warnings)");
		GetPlayerName(playerid, string, sizeof(string));
		format(string, sizeof(string),"Player %s (Id:%d) has been Automatically Kicked. (Reason: Exceeding Mute Warnings)", string, playerid);
		SendClientMessageToAll(lightred,string);
		SaveIn("KickLog",string);
		Kick(playerid);
		}
		return 0;
	}
	#if EnablePM_Cmd == true
	new string[128];
	format(string,256,"PM: Message to '%s(%d)': \"%s\"",PmReceiver,PMplayer1,text);
	SendClientMessage(playerid,0x00A765AA,string);
 	PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
            
	GetPlayerName(playerid, string, sizeof(string));
	format(string, sizeof(string),"PM: Message from: %s: \"%s\"",string,text);
	SendClientMessage(recieverid,0x00A765AA,string);
	#endif
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)