public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
switch(dialogid) {
case DIALOG_REGISTER: {
if(!response) return Kick(playerid);
if(response) {
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""WHITE"Registering...",""RED"You have entered an invalid password.\n"WHITE"Type your password below to register a new account.","Register","Quit");
if(INI_Open(getINI(playerid))) {
INI_WriteString("Password",inputtext);
INI_WriteInt("Cash", 0);
INI_WriteInt("Admin", 0);
INI_WriteInt("FirstTime", 0);
INI_WriteInt("Skin", 0);
INI_WriteInt("Score", 0);
INI_Save();
INI_Close();
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WHITE"Login",""WHITE"Type your password below to login.","Login","Quit");
}
}
} case DIALOG_LOGIN: {
if(!response) return Kick ( playerid );
if(response) {
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""WHITE"Login",""RED"You have entered an invalid password.\n"WHITE"Type your password below to login.","Login","Quit");
if(INI_Open(getINI(playerid))) {
INI_ReadString(PlayerInfo[playerid][pPass],"Password",20);
if(strcmp(inputtext,PlayerInfo[playerid][pPass],false)) {
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""WHITE"Login",""RED"You have entered an incorrect password.\n"WHITE"Type your password below to login.","Login","Quit");
}
GivePlayerMoney( playerid, INI_ReadInt( "Cash" ) );
PlayerInfo[playerid][pAdmin] = INI_ReadInt("Admin");
gFirstTimeHasJoined[playerid] = INI_ReadInt("FirstTime");
gPlayerSkinForEver[playerid] = INI_ReadInt("Skin");
SetPlayerScore( playerid, INI_ReadInt( "Score" ) );
INI_Close();
}
}
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_REGISTER:
{
if(!response)
return Kick(playerid);
if(response)
{
if(!strlen(inputtext))
return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""WHITE"Registering...",""RED"You have entered an invalid password.\n"WHITE"Type your password below to register a new account.","Register","Quit");
if(INI_Open(getINI(playerid)))
{
INI_WriteString("Password",inputtext);
INI_WriteInt("Cash", 0);
INI_WriteInt("Admin", 0);
INI_WriteInt("FirstTime", 0);
INI_WriteInt("Skin", 0);
INI_WriteInt("Score", 0);
INI_WriteInt("Kills", 0);
INI_WriteInt("Deaths", 0);
INI_Save();
INI_Close();
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WHITE"Login",""WHITE"Type your password below to login.","Login","Quit");
}
}
}
case DIALOG_LOGIN:
{
if(!response)
return Kick ( playerid );
if(response)
{
if(!strlen(inputtext))
return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""WHITE"Login",""RED"You have entered an invalid password.\n"WHITE"Type your password below to login.","Login","Quit");
if(INI_Open(getINI(playerid)))
{
INI_ReadString(PlayerInfo[playerid][pPass],"Password",20);
if(strcmp(inputtext,PlayerInfo[playerid][pPass],false))
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""WHITE"Login",""RED"You have entered an incorrect password.\n"WHITE"Type your password below to login.","Login","Quit");
}
GivePlayerMoney( playerid, INI_ReadInt( "Cash" ) );
PlayerInfo[playerid][pAdmin] = INI_ReadInt("Admin");
PlayerInfo[playerid][pKills] = INI_ReadInt("Kills");
PlayerInfo[playerid][pDeaths] = INI_ReadInt("Deaths");
gFirstTimeHasJoined[playerid] = INI_ReadInt("FirstTime");
gPlayerSkinForEver[playerid] = INI_ReadInt("Skin");
SetPlayerScore( playerid, INI_ReadInt( "Score" ) );
INI_Close();
}
}
}
}
return 1;
}
public OnPlayerDeath( playerid, killerid, reason )
{
PlayerInfo[ playerid ][ pDeaths ] ++;
if( killerid != INVALID_PLAYER_ID ) {
PlayerInfo[ killerid ][ pKills ] ++;
}
// Rest
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[playerid][pDeaths] ++;
if(killerid != INVALID_PLAYER_ID)
{
PlayerInfo[killerid][pKills] ++;
}
if(IsPlayerConnected(killerid) && gTeam[playerid] != gTeam[killerid]) // not a suicide or team kill
{
new zoneid = GetPlayerZone(playerid);
if(zoneid != -1 && ZoneInfo[zoneid][zTeam] == gTeam[playerid]) // zone member has been killed in the zone
{
ZoneDeaths[zoneid]++;
if(ZoneDeaths[zoneid] == MIN_DEATHS_TO_START_WAR)
{
ZoneDeaths[zoneid] = 0;
ZoneAttacker[zoneid] = gTeam[killerid];
ZoneAttackTime[zoneid] = 0;
GangZoneFlashForAll(ZoneID[zoneid], GetTeamZoneColor(ZoneAttacker[zoneid]));
}
}
}
Just to be clear if my "OnPlayerDeath"-callback is right...
pawn Код:
|
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[playerid][pDeaths] ++;
PlayerInfo[killerid][pKills] ++;
if(IsPlayerConnected(killerid) && gTeam[playerid] != gTeam[killerid]) // not a suicide or team kill
{
new zoneid = GetPlayerZone(playerid);
if(zoneid != -1 && ZoneInfo[zoneid][zTeam] == gTeam[playerid]) // zone member has been killed in the zone
{
ZoneDeaths[zoneid]++;
if(ZoneDeaths[zoneid] == MIN_DEATHS_TO_START_WAR)
{
ZoneDeaths[zoneid] = 0;
ZoneAttacker[zoneid] = gTeam[killerid];
ZoneAttackTime[zoneid] = 0;
GangZoneFlashForAll(ZoneID[zoneid], GetTeamZoneColor(ZoneAttacker[zoneid]));
}
}
}
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[playerid][pDeaths] ++;
PlayerInfo[killerid][pKills] ++;
if(IsPlayerConnected(killerid) && gTeam[playerid] != gTeam[killerid]) // not a suicide or team kill
{
new zoneid = GetPlayerZone(playerid);
if(zoneid != -1 && ZoneInfo[zoneid][zTeam] == gTeam[playerid]) // zone member has been killed in the zone
{
ZoneDeaths[zoneid]++;
if(ZoneDeaths[zoneid] == MIN_DEATHS_TO_START_WAR)
{
ZoneDeaths[zoneid] = 0;
ZoneAttacker[zoneid] = gTeam[killerid];
ZoneAttackTime[zoneid] = 0;
GangZoneFlashForAll(ZoneID[zoneid], GetTeamZoneColor(ZoneAttacker[zoneid]));
}
}
}