08.03.2015, 10:52
When someone registers it gives that player kills and deaths of the player who left before him
onplayerconnect
Onplayedeath
Register
onplayerconnect
Код:
new INI:file = INI_Open(Path(playerid)); INI_SetTag(file,"Player's Data"); INI_WriteInt(file,"AdminLevel",PInfo[playerid][Level]); INI_WriteInt(file,"Money",GetPlayerMoney(playerid)); INI_WriteInt(file,"Score",GetPlayerScore(playerid)); INI_WriteInt(file,"Kill",PInfo[playerid][Kill]); INI_WriteInt(file,"Death",PInfo[playerid][Death]); INI_WriteInt(file,"Mute",MutedTimer[playerid]); INI_WriteInt(file,"Jail",JailedTimer[playerid]); INI_WriteInt(file,"CMDMuted",CMDMutedTimer[playerid]); INI_WriteInt(file,"Crash",PInfo[playerid][Crashed]); INI_Close(file);
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new string[128],pName[24],pName1[24];
SendDeathMessage(killerid,playerid,reason);
PInfo[playerid][Score]++;
PInfo[playerid][Death]++;
PInfo[killerid][Kill]++;
format(string,sizeof(string),"%d",PInfo[playerid][Death]);
PlayerTextDrawSetString(playerid,Deaths[playerid],string);
PlayerTextDrawHide(playerid,Deaths[playerid]);
PlayerTextDrawShow(playerid,Deaths[playerid]);
format(string,sizeof(string),"%d",PInfo[playerid][Kill]);
PlayerTextDrawSetString(playerid,Kills[playerid],string);
PlayerTextDrawHide(playerid,Kills[playerid]);
PlayerTextDrawShow(playerid,Kills[playerid]);
}
Код:
if(dialogid == DIALOG_REGISTER)
{
if(!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
return 1;
}
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"Player's Data");
INI_WriteString(file,"Password",hashpass);
INI_WriteInt(file,"AdminLevel",0);
INI_WriteInt(file,"Money",0);
INI_WriteInt(file,"Score",0);
INI_WriteInt(file,"Kill",0);
INI_WriteInt(file,"Death",0);
INI_WriteInt(file,"Mute",0);
INI_WriteInt(file,"Jail",0);
INI_WriteInt(file,"CMDMuted",0);
INI_WriteInt(file,"Crashed",0);
INI_Close(file);
SendClientMessage(playerid,COLOR_GREEN,"You have been successfully registered");
PInfo[playerid][Logged] = 1;
TextDrawShowForPlayer(playerid,Loading);
ShowCustomClassSelection(playerid);
}
}


