17.05.2014, 11:05
often,when someone joins the server,server gets freezed,and no one can perform and command or text or anything,so these the codes while connecting in my server:
From My GM:
Codes From PPC_House:
Codes From LuxAdmin:
From My GM:
pawn Код:
#define DIALOG_RULES2 12
#define savefolder "/Accounts/%s.ini" // This defines the file name and folder
public OnPlayerConnect(playerid)
{
new string[64], pName2[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName2,MAX_PLAYER_NAME);
format(string,sizeof string,"%s (%d) Has Joined The Server.",pName2,playerid);
GameTextForPlayer(playerid, "Welcome To The Los Santos Gang War Server", 5000, 4);
ShowPlayerDialog(playerid, DIALOG_RULES2, DIALOG_STYLE_MSGBOX, "Server Rules", "1- No Cheating\n2- No Spamming\n3- Slide Bug Is Not Allowed But C Bug Is Allowed\n4- No Rule Breaking\n5- No G Abuse\n6- No Advertising\n7- Teleport Abuse Is Not Allowed\n8- Weapon Mods Are Allowed Only\n9- Respect Player Especially Admins\n10- Scamming Is Not Allowed\n11- Aimbot Is Not Allowed\n12- Don't Try To Climb Up Over The Freeroam Walls If You Are(not) In Freeroam Mod\n\nDo You Agree The Server Rules?", "Yes", "No");
SendClientMessageToAll(0xAFAFAFAA,string);
SendClientMessage(playerid,-1,"Welcome To The {FFEA00}LOS SANTOS GANG WARS{FFFFFF} Version 2.2! Please Enjoy Your Stay.");
SendClientMessage(playerid,-1,"You Can Listen,Save,Stop,Check Your Favourite Song Or Unsave Your Song By Some Commands For It In /cmds");
SendClientMessage(playerid, 0x00EEFFFF, "Please Visit Our Forums: lsgangwars.createaforum.com");
SendClientMessage(playerid, 0x00FF22FF, "When You Spawn A Skin Type /help To See The Help Menu.");
new pname[128]; // This get's the length of the player name
new file[128]; // This get's the lenght of the file
GetPlayerName(playerid, pname, sizeof(pname)); // This get's the player name with the lenght of the player name
format(file, sizeof(file), savefolder,pname); // This describe's where to save and how to save it
if(dini_Exists(file)) { // If the file exist
SetPlayerScore(playerid, dini_Int(file, "Score"));
SetPlayerMoney(playerid, dini_Int(file, "Money"));
LPinfo[playerid][Drugs] = dini_Int(file,"Drugs");
LPinfo[playerid][Adre] = dini_Int(file,"Adrenaline Pills");
BankMoney[playerid] = dini_Int(file,"BankMoney");
Favouritesong[playerid] = dini_Int(file,"SongID");
}
else {
dini_Create(file); // Create the file
dini_IntSet(file, "Score", 0); // Set's "Score"
dini_IntSet(file, "Money", 0); // Set's "Money"
dini_IntSet(file, "Drugs", LPinfo[playerid][Drugs]); // Set's "Kills"
dini_IntSet(file, "Adrenaline Pills", LPinfo[playerid][Adre]); // Set's "Kills"
dini_IntSet(file, "BankMoney", BankMoney[playerid]); // Set's "Kills"
dini_IntSet(file, "SongID", Favouritesong[playerid]); // Set's "Kills"
SetPlayerScore(playerid, dini_Int(file, "Score")); // This describes where to load the score
SetPlayerMoney(playerid, dini_Int(file, "Money")); // This describes where to load the money
// the same thing
} // This get's the length of the player name
pInfo[playerid][Last] = -1;
pInfo[playerid][NoPM] = 0;
PlayerCar[playerid] = -1;
AntiKillRowSpam[playerid] = 0;
PlayAudioStreamForPlayer(playerid, "http://s3.argim.net/files/r/gta_san_andreas_theme_song_wmm.mp3");
return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
// Setup local variables
new HouseID, HouseSlot, Name[24];
// Get the player's name
GetPlayerName(playerid, Name, sizeof(Name));
// Loop through all houses to find the ones which belong to this player
for (HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
{
// Check if the house exists
if (IsValidDynamicPickup(AHouseData[HouseID][PickupID]))
{
// Check if the house is owned
if (AHouseData[HouseID][Owned] == true)
{
// Check if the player is the owner of the house
if (strcmp(AHouseData[HouseID][Owner], Name, false) == 0)
{
// Add the HouseID to the player's account for faster reference later on
APlayerData[playerid][Houses][HouseSlot] = HouseID;
// Load housecars if they weren't loaded at FilterscriptInit
if (LoadCarsDuringFSInit == false)
HouseFile_LoadCars(HouseID);
// Select the next HouseSlot
HouseSlot++;
}
}
}
}
return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
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][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 been Automatically 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" [Password])");
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";
case 6: AdmRank = "Professional Admin";
case 7: AdmRank = "Trusted Admin";
case 8: AdmRank = "Perfect Admin";
case 9: AdmRank = "Co-Owner";
case 10: AdmRank = "Owner";
}
//==============================================================================
// 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" [Password])");
}
return 1;
}