01.01.2013, 08:10
pawn Код:
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME],str[128];
GetPlayerName(playerid,name,sizeof(name));
format(str,sizeof(str),"{FF9900}%s Has joined {FF66FF}Drife 4 Life {ffffff}Server",name);
SendClientMessageToAll(COLOR_BLUE,str);
if(IsPlayerNPC(playerid))
{
if(!strcmp(GetPlayersName(playerid),"Dragdriver"))
{
PutPlayerInVehicle(playerid,Carn,0);
}
}
LoadAcc(playerid);
return 1;
}
stock LoadAcc(playerid)
{
new str[100];
if(IsPlayerNPC(playerid))
{
return 0;
}
if(fexist(Path(playerid)))
{
INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_PASSWORD,"Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");
}
else
{
ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
return 1;
}
if(pInfo[playerid][Banned] == 1)
{
format(str,sizeof(str),"This Name %s Is banned make unban apply on the forums",GetPlayersName(playerid));
SendClientMessage(playerid,COLOR_LIGHTBLUE,str);
format(str,sizeof(str),"Player %s Has been Banned Reason: Attempt to Ban evading ",GetPlayersName(playerid));
SendClientMessageToAll(COLOR_LIGHTBLUE,str);
Ban(playerid);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(fexist(Path(playerid)))
{
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"Player's Data");
INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]);
INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);
INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
INI_WriteInt(file,"Scores",GetPlayerScore(playerid));
INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
INI_WriteInt(file,"Banned",pInfo[playerid][Banned]);
INI_WriteInt(file,"Leader",pInfo[playerid][Leader]);
INI_WriteInt(file,"Member",pInfo[playerid][Member]);
INI_WriteInt(file,"Rank",pInfo[playerid][Rank]);
INI_Close(file);
return 1;
}
return 1;
}