05.03.2013, 16:56
Entгo galera,eu fui mudar a maneira de salvar as mortes e os assasinatos dos players.
antes era assim
e salvava de boa,mas ai inventei de mudar pra isso:
antes era assim
pawn Код:
new Matou[MAX_PLAYERS];
new Morreu[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
if(IsPlayerConnected(killerid))
{
GameTextForPlayer(playerid,"~r~Seu nub morreu pra esse cara",5000,5);
GameTextForPlayer(killerid,"~g~Ae tu matou esse otario",3000,5);
Matou[playerid]++;
SetPlayerScore(killerid,GetPlayerScore(playerid)+1);
GivePlayerMoney(killerid,GetPlayerMoney(playerid)+1000);
Morreu[playerid]++;
SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
GivePlayerMoney(playerid,GetPlayerMoney(playerid)-1000);
}
return 1;
}
// e no final
SetarPlayer(playerid)
{
new contastexto[50];
new Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome, sizeof(Nome));
format(contastexto, sizeof(contastexto), CONTAS, Nome);
GivePlayerMoney(playerid, DOF2_GetInt(contastexto,"Dinheiro"));
SetPlayerScore(playerid, DOF2_GetInt(contastexto,"Score"));
Admin[playerid] = DOF2_GetInt(contastexto,"Admin");
Matou[playerid] = DOF2_GetInt(contastexto, "Matou");
Morreu[playerid] = DOF2_GetInt(contastexto, "Morreu");
return 1;
}
SalvarContas(playerid)
{
new Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid,Nome,sizeof(Nome));
new String[50];
format(String,sizeof(String),CONTAS,Nome);
DOF2_SetInt(String,"Admin", Admin[playerid]);
DOF2_SetInt(String,"Score", GetPlayerScore(playerid));
DOF2_SetInt(String,"Dinheiro", GetPlayerMoney(playerid));
DOF2_SetInt(String,"Matou",Matou[playerid]);
DOF2_SetInt(String,"Morreu",Morreu[playerid]);
DOF2_SaveFile();
return 1;
}
pawn Код:
enum info
{
dinheiro,
score,
matou,
morreu
}
new pInfo[MAX_PLAYERS][info];
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
if(IsPlayerConnected(killerid))
{
GameTextForPlayer(playerid,"~r~Seu nub morreu pra esse cara",5000,5);
GameTextForPlayer(killerid,"~g~Ae tu matou esse otario",3000,5);
pInfo[killerid][matou]++;
SetPlayerScore(killerid,GetPlayerScore(playerid)+1);
GivePlayerMoney(killerid,GetPlayerMoney(playerid)+1000);
pInfo[playerid][morreu]++;
SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
GivePlayerMoney(playerid,GetPlayerMoney(playerid)-1000);
}
return 1;
}
SetarPlayer(playerid)
{
new contastexto[50];
new Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome, sizeof(Nome));
format(contastexto, sizeof(contastexto), CONTAS, Nome);
GivePlayerMoney(playerid, DOF2_GetInt(contastexto,"Dinheiro"));
SetPlayerScore(playerid, DOF2_GetInt(contastexto,"Score"));
Admin[playerid] = DOF2_GetInt(contastexto,"Admin");
pInfo[playerid][matou] = DOF2_GetInt(contastexto, "Matou");
pInfo[playerid][morreu] = DOF2_GetInt(contastexto, "Morreu");
return 1;
}
SalvarContas(playerid)
{
new Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid,Nome,sizeof(Nome));
new String[50];
format(String,sizeof(String),CONTAS,Nome);
DOF2_SetInt(String,"Admin", Admin[playerid]);
DOF2_SetInt(String,"Score", GetPlayerScore(playerid));
DOF2_SetInt(String,"Dinheiro", GetPlayerMoney(playerid));
DOF2_SetInt(String,"Matou",pInfo[playerid][matou]);
DOF2_SetInt(String,"Morreu",pInfo[playerid][morreu]);
DOF2_SaveFile();
return 1;
}