[Ajuda] kills/deaths nao salvam
#1

Bom, eu estou tentando colocar esse sistema de salvar kills/deaths no meu sv: https://sampforum.blast.hk/showthread.php?tid=281736(peguei a parte apenas que salva kills/deaths pois ja tenho registro/login...), ele cria as linhas na pasta desejada! o problema e que ele nao conta as kills/deaths!
oque pode ser?

tambem testei esse e nada!:
Quote:

enum Playerinfos
{
Matou,
Morreu,
}
new pInfo[MAX_PLAYERS][Playerinfos];




public OnPlayerDeath(playerid, killerid, reason)
{
pInfo[killerid][Matou]++; // Vai dar mais 1 para o que matou (killerid)
pInfo[playerid][Morreu]++; //Vai dar mais 1 para o que morreu (playerid)
return 1;
}


// SALVAR

DOF2_SetInt(String, "Morreu", pInfo[playerid][Morreu]);
DOF2_SetInt(String, "Matou", pInfo[playerid][Matou]);

// CARREGAR
pInfo[playerid][Matou] = DOF2_GetInt(String, "Matou");
pInfo[playerid][Morreu] = DOF2_GetInt(String, "Morreu");

Reply
#2

enum Playerinfos
{
Matou,
Morreu // Quando for o ъltimo vocк nгo utiliza vнrgula
}; // Fecha com ";"
new pInfo[MAX_PLAYERS][Playerinfos];

public OnPlayerDeath(playerid, killerid, reason)
{
pInfo[killerid][Matou]++; // Vai dar mais 1 para o que matou (killerid)
pInfo[playerid][Morreu]++; //Vai dar mais 1 para o que morreu (playerid)
return 1;
}


// SALVAR

DOF2_SetInt(String, "Morreu", pInfo[playerid][Morreu]);
DOF2_SetInt(String, "Matou", pInfo[playerid][Matou]);

// CARREGAR
pInfo[playerid][Matou] = DOF2_GetInt(String, "Matou");
pInfo[playerid][Morreu] = DOF2_GetInt(String, "Morreu");
Reply
#3

tlgd! o meu ta assim:

Quote:

enum InfoPlayer {

Senha,
Skin,
Score,
Dinheiro,
Admin,
pKills,
pDeaths,
pMoney,
pAdmin

};

new Player[MAX_PLAYERS][InfoPlayer];

playerdeath...

Player[killerid][pKills]++; // Will increase the killerid kills
Player[playerid][pDeaths]++; // Will increase the playerid ( the one who died ) the deaths.

playerdisconnect...

DOF2_SetInt( GetPlayerArquivo( playerid ), "Kills",Player[playerid][pKills]); // We set/update the players settings.
DOF2_SetInt( GetPlayerArquivo( playerid ), "Deaths",Player[playerid][pDeaths]);
return 1;
}

LoadPlayer(playerid)...

Player[ playerid ][ pKills ] = DOF2_GetInt(GetPlayerArquivo( playerid ),"Kills"); // We load our settings
Player[ playerid ][ pDeaths ] = DOF2_GetInt(GetPlayerArquivo( playerid ),"Deaths");
eu so nao adicionei isso que ele mandou: #include <Double-O-Files_2>
sera que tem algum problema?
Reply
#4

stock LoadPlayer(playerid)
{
Player[playerid][Matou] = DOF2_GetInt(Arquivo(playerid), "Matou");
Player[playerid][Morreu] = DOF2_GetInt(Arquivo(playerid), "Morreu");
return 1;
}
stock SalvarJogador(playerid)
{
DOF2_SetInt(Arquivo(playerid), "Matou", Player[playerid][Matou]);
DOF2_SetInt(Arquivo(playerid), "Morreu", Player[playerid][Morreu]);
DOF2_SaveFile();
return 1;
}
Reply
#5

deu nao, sera q e pq eu tou me matando? precisa que algum player me mate para contar?
Reply
#6

kkkkkk o viaje de vcs
tenta ai
stock LoadPlayer(playerid)
{
if( DOF2_FileExists(Arquivo(playerid)) )
{
Player[playerid][Matou] = DOF2_GetInt(Arquivo(playerid), "Matou");
Player[playerid][Morreu] = DOF2_GetInt(Arquivo(playerid), "Morreu");
}
return 1;
}
stock SalvarJogador(playerid)
{
if( DOF2_FileExists( Arquivo(playerid) ) )
{
DOF2_CreateFile(Arquivo(playerid));
DOF2_SetInt(Arquivo(playerid), "Matou", Player[playerid][Matou]);
DOF2_SetInt(Arquivo(playerid), "Morreu", Player[playerid][Morreu]);
DOF2_SaveFile();
}
return 1;
}
Reply
#7

nada ainda... cria as linhas matou/morreu! so que nao salva as mortes e provavelmente os kills tbm nao!"nao testei o kil"!

meu sistema ta assim atualmente:
Quote:

enum Playerinfos
{
Matou,
Morreu
};

new pInfo2[MAX_PLAYERS][Playerinfos];

playerdeath..

pInfo2[killerid][Matou]++;
pInfo2[playerid][Morreu]++;

stock SavePlayer(playerid)
{
if( DOF2_FileExists( GetPlayerArquivo( playerid ) ) )
{

DOF2_CreateFile(GetPlayerArquivo(playerid));

//DOF2_SetInt( GetPlayerArquivo( playerid ), "Skin", Player[ playerid ][ Skin ] );
DOF2_SetInt( GetPlayerArquivo( playerid ), "Score", Player[ playerid ][ Score ] );
DOF2_SetInt( GetPlayerArquivo( playerid ), "Dinheiro", GetPlayerMoney( playerid ));
DOF2_SetInt( GetPlayerArquivo( playerid ), "Admin", Player[ playerid ][ Admin ] );
DOF2_SetInt( GetPlayerArquivo(playerid), "Morreu", pInfo2[playerid][Morreu]);
DOF2_SetInt( GetPlayerArquivo(playerid), "Matou", pInfo2[playerid][Matou]);

DOF2_SaveFile();

}
return 1;
}

stock LoadPlayer(playerid)
{
if( DOF2_FileExists( GetPlayerArquivo( playerid ) ) )
{
//Player[ playerid ][ Skin ] = DOF2_GetInt( GetPlayerArquivo( playerid ), "Skin" );
Player[ playerid ][ Score ] = DOF2_GetInt( GetPlayerArquivo( playerid ), "Score" );
Player[ playerid ][ Dinheiro ] = DOF2_GetInt( GetPlayerArquivo( playerid ), "Dinheiro" );
Player[ playerid ][ Admin ] = DOF2_GetInt( GetPlayerArquivo( playerid ), "Admin" );
pInfo2[playerid][Matou] = DOF2_GetInt( GetPlayerArquivo(playerid), "Matou");
pInfo2[playerid][Morreu] = DOF2_GetInt( GetPlayerArquivo(playerid), "Morreu");

SetPlayerScore( playerid, Player[ playerid ][ Score ] );
GivePlayerMoney( playerid, Player[ playerid] [ Dinheiro ] );
//SetPlayerSkin(playerid, Player[ playerid ][ Skin ] );

}
return 1;
}

Reply
#8

PHP код:
// SALVAR 
new String[50], Nome[MAX_PLAYER_NAME];
GetPlayerName(playeridNomesizeof Nome);
format(Stringsizeof String"Pasta/%s.ini"Nome);
DOF2_SetInt(String"Morreu"pInfo[playerid][Morreu]); 
DOF2_SetInt(String"Matou"pInfo[playerid][Matou]); 
// CARREGAR 
new String[50], Nome[MAX_PLAYER_NAME];
GetPlayerName(playeridNomesizeof Nome);
format(Stringsizeof String"Pasta/%s.ini"Nome);
pInfo[playerid][Matou] = DOF2_GetInt(String"Matou"); 
pInfo[playerid][Morreu] = DOF2_GetInt(String"Morreu"); 
Substitua o nome "Pasta" para o nome da pasta que deseja salvar.

@DogMal, nгo tem nada haver oq vc falou cara, enum pode ser da maneira que ele definiu.

@PedroH, nossa em.. De onde vc tirou essa lуgica ? '-'
PHP код:
if( DOF2_FileExistsGetPlayerArquivoplayerid ) ) )
{
DOF2_CreateFile(GetPlayerArquivo(playerid));

O correto й usar assim:
PHP код:
if(!DOF2_FileExists( ..) ) DOF2_CreateFile(..); //Se nгo existir, criar! 
Reply
#9

Quote:
Originally Posted by XandyMello
Посмотреть сообщение
@PedroH, nossa em.. De onde vc tirou essa lуgica ? '-'
PHP код:
if( DOF2_FileExistsGetPlayerArquivoplayerid ) ) )
{
DOF2_CreateFile(GetPlayerArquivo(playerid));

O correto й usar assim:
PHP код:
if(!DOF2_FileExists( ..) ) DOF2_CreateFile(..); //Se nгo existir, criar! 
isso faz parte do sistema de salvamento que eu uso!
devo colocar isso nas callbacks?

coloquei assim e nao foi, tenho uma leve impressao de que tem algo faltando kk

Quote:

OnPlayerDisconnect..

new String[50], Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome, sizeof Nome);
format(String, sizeof String, "Pasta2/%s.ini", Nome);
DOF2_SetInt(String, "Morreu", pInfo2[playerid][Morreu]);
DOF2_SetInt(String, "Matou", pInfo2[playerid][Matou]);

OnPlayerSpawn...

new String[50], Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome, sizeof Nome);
format(String, sizeof String, "Pasta/%s.ini", Nome);
DOF2_SetInt(String, "Morreu", pInfo2[playerid][Morreu]);
DOF2_SetInt(String, "Matou", pInfo2[playerid][Matou]);
SetTextPlayer(playerid);

eu tambem tentei adpatar esse que era um sistema de salvar score tentei fazer com o matou/morreu e deu nisso:

erro:
Quote:

C:\Users\Pedro W7\Desktop\matoumorreu.pwn(47) : error 035: argument type mismatch (argument 3)
C:\Users\Pedro W7\Desktop\matoumorreu.pwn(4 : error 035: argument type mismatch (argument 3)
C:\Users\Pedro W7\Desktop\matoumorreu.pwn(54) : error 035: argument type mismatch (argument 3)
C:\Users\Pedro W7\Desktop\matoumorreu.pwn(55) : error 035: argument type mismatch (argument 3)
C:\Users\Pedro W7\Desktop\matoumorreu.pwn(6 : error 033: array must be indexed (variable "Nome")
C:\Users\Pedro W7\Desktop\matoumorreu.pwn(69) : error 033: array must be indexed (variable "Nome")
C:\Users\Pedro W7\Desktop\matoumorreu.pwn(72) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

Sistema:

Quote:

#define FILTERSCRIPT

#include <a_samp>
#include DOF2

enum Playerinfos
{
Matou,
Morreu
};

new pInfo2[MAX_PLAYERS][Playerinfos];

public OnFilterScriptInit()
{
printf("Sistema de salvamento de Score carregado!");
return 1;
}

public OnFilterScriptExit()
{
DOF2_Exit();
printf("Sistema de salvamento de Score descarregado!");
return 1;
}


public OnPlayerDeath(playerid, killerid, reason)
{
pInfo2[killerid][Matou]++;
pInfo2[playerid][Morreu]++;
return 1;
}

public OnPlayerConnect(playerid)
{
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
new String[50], Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome, sizeof Nome);
format(String, sizeof String, "Pasta2/%s.ini", Nome);
if(DOF2_FileExists(String))
{
DOF2_SetInt(String, "Morreu", Nome);
DOF2_SetInt(String, "Matou", Nome);
DOF2_SaveFile();
}
else
{
DOF2_CreateFile(String);
DOF2_SetInt(String, "Morreu", Nome);
DOF2_SetInt(String, "Matou", Nome);
DOF2_SaveFile();
}
return 1;
}

public OnPlayerSpawn(playerid)
{
new String[50], Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome, sizeof Nome);
format(String, sizeof (String), "Pasta2/%s.ini", Nome);
if(DOF2_FileExists(String))
{
Nome = DOF2_GetInt(String, "Matou");
Nome = DOF2_GetInt(String, "Morreu");
}
}
return 1;
}

Reply
#10

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    new
        
String[50],
        
Nome[MAX_PLAYER_NAME]
    ;
    
GetPlayerName(playeridNomesizeof Nome);
    
format(Stringsizeof String"Pasta2/%s.ini"Nome);
    if(!
DOF2_FileExists(String)) { DOF2_CreateFile(String); }
    
DOF2_SetInt(String"Morreu"pInfo2[playerid][Morreu]);
    
DOF2_SetInt(String"Matou"pInfo2[playerid][Matou]);
    
DOF2_SaveFile();
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
pInfo2[playerid][Matou] = EOS;
    
pInfo2[playerid][Morreu] = EOS;
    new
        
String[50],
        
Nome[MAX_PLAYER_NAME]
    ;
    
GetPlayerName(playeridNomesizeof Nome);
    
format(Stringsizeof (String), "Pasta2/%s.ini"Nome);
    if(
DOF2_FileExists(String))
    {
        
pInfo2[playerid][Matou] = DOF2_GetInt(String"Matou");
        
pInfo2[playerid][Morreu] = DOF2_GetInt(String"Morreu");
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)