14.03.2009, 12:09
My server crashes on Restart :S But, not if you just connect...
Here is OnPlayerDisconnect and OnPlayerConnect... I would REALLY Appriciate if someone could figure this out....
Here is OnPlayerDisconnect and OnPlayerConnect... I would REALLY Appriciate if someone could figure this out....
pawn Код:
public OnPlayerConnect(playerid)
{
BanCheck(playerid);
TempBanCheck(playerid);
new string[256],pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
format(string,sizeof(string),"EQRP//Players//%s.ini",pName);
if(dini_Exists(string))
{
PlayerInfo[playerid][pRegged] = 1;
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Account Registered, use /login [password]");
}
if(!dini_Exists(string))
{
PlayerInfo[playerid][pRegged] = 0;
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Account Not Registered, use /register [password]");
}
if(dini_Int(string,"Jailed") != 0)
{
new time;
time = dini_Int(string,"Jailed");
PlayerInfo[playerid][pJailed] = time;
}
SendClientMessage(playerid,COLOR_YELLOW,"Welcome to El Quebrados Extremely RolePlay");
SendClientMessage(playerid,COLOR_WHITE,"Hope you enyoy your stay here...");
SendClientMessage(playerid,COLOR_YELLOW,"Forums: ExtremeRolePlayForums.team.pro");
SendClientMessage(playerid,COLOR_RED,"Owner: IntrozeN/Peter");
SetPlayerMapIcon(playerid,0,-1530.8995,2592.9998,55.8359,56,0); // 24/7
SetPlayerMapIcon(playerid,2,-1328.7019,2677.5137,49.6276,55,0); //Gas Station refuel
SetPlayerMapIcon(playerid,3,-1407.2548,2667.7400,55.4794,55,0); //PDRepair
SetPlayerMapIcon(playerid,4,-1390.0269,2637.6213,55.9844,30,0); //PD
SetPlayerMapIcon(playerid,5,-1514.8240,2521.2922,55.8612,20,0); //Hostpital
SetPlayerMapIcon(playerid,6,-1519.1346,2609.1191,55.8359,49,0); //Bar
SetPlayerMapIcon(playerid,7,-1295.5038,2712.0017,50.2935,14,0); //Cluckinbell
IsInShop[playerid] = 0;
KeyTimer[playerid] = -1;
wait[playerid] = 0;
count[playerid] = 0;
HasBoughtNewSkin[playerid] = 0;
LastPos[playerid][0] = 0;
LastPos[playerid][1] = 0;
LastPos[playerid][2] = 0;
LastPos[playerid][3] = 0;
LastInterior[playerid] = 0;
LastVW[playerid] = 0;
LastSkin[playerid] = 0;
TextdrawActive[playerid] = 0;
Skin[playerid] = 0;
IsDead[playerid] = 0;
SetPlayerColor(playerid,COLOR_WHITE);
if (!IsValidName(playerid))
{
SetTimerEx("name",1000*5,0,"u",playerid);
}
return 1;
}
public name(playerid)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
new name[512]; // warning 219: local variable "name" shadows a variable at a preceding level
format(name,sizeof(name),"SERVER: Kicked %s, Reason: Non-RP Name, get a roleplay one. Example: Tony_Nuoro",pName);
SendClientMessageToAll(COLOR_DARKRED,name);
Kick(playerid);
}
public OnPlayerDisconnect(playerid, reason)
{
if(TextdrawActive[playerid] == 1)
{
TextDrawHideForPlayer(playerid, TextDraw[playerid]);
TextDrawDestroy(TextDraw[playerid]);
}
PlayerInfo[playerid][pRentedRoom] = 0;
PlayerInfo[playerid][pLogged] = 0;
PlayerInfo[playerid][pDuty] = 0;
if(Block[playerid]) DestroyObject(Block[playerid]);
Block[playerid] = 0;
//-----------Saving--------------
new pName[MAX_PLAYER_NAME], string[256], money;
GetPlayerName(playerid,pName,sizeof(pName));
format(string,sizeof(string),"EQRP/Players/%s.ini",pName);
money = GetPlayerMoney(playerid);
dini_IntSet(string,"Money",money);
//--------------------------------
return 1;
}