28.11.2010, 15:56
hi all,
ive got this register/login system: (only money and score is saved)
This is my system and it also shows me the Deaths and Kills(tode) when i type in /stats
but it doesnt save them.
Money, Score and Times doesnt work yet in the playercommandtext.
But its important that kills and deaths are saved, what i have to do and to add to save this??
I just cant figure it out please help me.
Regards. Please ask if u dont understand sth.
ive got this register/login system: (only money and score is saved)
pawn Код:
#include <dini>
#define DIALOG_LOGIN 3
#define DIALOG_REG 4
enum spieler_daten
{
eingeloggt
}
new Spieler[MAX_PLAYERS][spieler_daten];
public OnPlayerConnect(playerid)
{
new pname[MAX_PLAYERS],accFormat[128];
GetPlayerName(playerid,pname,sizeof pname);
format(accFormat,sizeof accFormat,"%s.datei",pname);
if(fexist(accFormat))
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Please login!","Next","Cancel");
}
else
{
ShowPlayerDialog(playerid,DIALOG_REG,1,"Register","Please register!","Next","Cancel");
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new pname[MAX_PLAYERS],accFormat[128];
GetPlayerName(playerid,pname,sizeof pname);
format(accFormat,sizeof accFormat,"%s.datei",pname);
if(fexist(accFormat) && Spieler[playerid][eingeloggt])
{
dini_IntSet(accFormat,"Geld",GetPlayerMoney(playerid));
dini_IntSet(accFormat,"Score",GetPlayerScore(playerid));
}
Spieler[playerid][eingeloggt] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
new pname[MAX_PLAYERS],accFormat[128];
GetPlayerName(playerid,pname,sizeof pname);
format(accFormat,sizeof accFormat,"%s.datei",pname);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new pname[MAX_PLAYERS],accFormat[128];
GetPlayerName(playerid,pname,sizeof pname);
format(accFormat,sizeof accFormat,"%s.datei",pname);
if(response)
{
switch(dialogid) // dialogid auswдhlen
{
case DIALOG_LOGIN: // ID Login
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Please login!","Next","Cancel");
return SendClientMessage(playerid,0xFFFFFFFF,"No password entered!");
}
if(strcmp(inputtext,dini_Get(accFormat,"Passwort")) == 0) // Passwort Direkt aus der Datei Laden
{
GivePlayerMoney(playerid,dini_Int(accFormat,"Geld"));
SetPlayerScore(playerid,dini_Int(accFormat,"Score"));
Spieler[playerid][eingeloggt] = 1; // Spieler ist nun erfolgreich eingeloggt
SendClientMessage(playerid,0xFFFFFFFF,"You has been loged in successfully.");
}
else
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Please login!","Next","Cancel");
SendClientMessage(playerid,0xFFFFFFFF,"The password you entered is invalid!");
}
}
case DIALOG_REG: // ID Registrieren
{
if(!strlen(inputtext)) // Text darf nicht = Null sein Null im Sinne von nichts
{
ShowPlayerDialog(playerid,DIALOG_REG,1,"Register","Please register!","Next","Cancel");
return SendClientMessage(playerid,0xFFFFFFFF,"The password is too short!");
}
dini_Create(accFormat);
dini_Set(accFormat,"Passwort",inputtext);
Spieler[playerid][eingeloggt] = 1;
SendClientMessage(playerid,0xFFFFFFFF,"Account has been created successfully, you're loged in now.");
}
}
}
else
{
switch(dialogid)
{
case DIALOG_LOGIN:ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Please login!","Next","Cancel");
case DIALOG_REG:ShowPlayerDialog(playerid,DIALOG_REG,1,"Register","Please register!","Next","Cancel");
}
}
return 1;
}
but it doesnt save them.
pawn Код:
new tode[MAX_PLAYERS], kills[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
tode[playerid]++;
if(killerid!=INVALID_PLAYER_ID) {
kills[killerid]++; }
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext,"/stats",true)==0) {
new s[50];
format(s,sizeof(s),"Kills: %d | Deaths: %d | Ratio: ",kills[playerid],tode[playerid]);
//format(s,sizeof(s),"Time : %d | Score : %d | Money: %d$",kills[playerid],score[playerid],GetPlayerMoney(playerid));
SendClientMessage(playerid,0xFFFF00AA,s);
}
return 0;
}
But its important that kills and deaths are saved, what i have to do and to add to save this??
I just cant figure it out please help me.
Regards. Please ask if u dont understand sth.