04.05.2011, 17:25
pawn Код:
public OnPlayerConnect(playerid)
{
static file[33];
format(file,sizeof(file),"Players/%s",GetPlayerNameData(playerid));
if (fexist(file))
{
ShowPlayerDialog(playerid,0,DIALOG_STYLE_INPUT,"Logar","Bem vindo por favor insira a sua senha:","Logar!", "Sair!");
}
if (!fexist(file))
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Registrar","Nгo registrado por favor insira uma senha para registrar:","Logar!", "Sair!");
}
return true;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
static file[33];
format(file,sizeof(file),"Players/%s",GetPlayerNameData(playerid));
if (dialogid == 1 && response)
{
Fini_Create(file);
Fini_OpenFile(file);
Fini_SetVal("Score",1);
Fini_SetVal("Levelup",0);
Fini_SaveFile(file);
Fini_CloseFile();
SendClientMessage(playerid,0x99E8A5FF,"Cadastrado!");
}
if (dialogid == 0 && response)
{
Fini_OpenFile(file);
SetPlayerScore(playerid,Fini_GetValue("Score"));
LevelUP[playerid] = Fini_GetValue("Levelup");
Fini_CloseFile();
}
return true;
}
public OnPlayerDisconnect(playerid,reason)
{
static file[33];
format(file,sizeof(file),"Players/%s",GetPlayerNameData(playerid));
if (fexist(file))
{
Fini_OpenFile(file);
Fini_SetVal("Score",GetPlayerScore(playerid));
Fini_SetVal("Levelup",LevelUP[playerid]);
Fini_SaveFile(file);
Fini_CloseFile();
}
return true;
}
pawn Код:
static LevelUP[MAX_PLAYERS];
public OnPlayerDeath(playerid,killerid,reason)
{
LevelUP[killerid]++;
if (LevelUP[killerid] == 5*GetPlayerScore(killerid))
{
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
SendClientMessage(playerid,0x99E8A5FF,"vocк passou de level.");
if (PlayerInfo[killerid][pClass] == 1 && GetPlayerScore(killerid) == 2)
{
GivePlayerWeapon(killerid,9,1);
}
else if (PlayerInfo[killerid][pClass] > 1 && GetPlayerScore(killerid) == 2)
{
GivePlayerWeapon(killerid,44,500);
GivePlayerWeapon(killerid,39,500);
}
}
return true;
}
public OnPlayerSpawn(playerid)
{
if (GetPlayerScore(playerid) > 1 && PlayerInfo[killerid][pClass] > 1)
{
GivePlayerWeapon(playerid,44,500);
GivePlayerWeapon(playerid,39,500);
}
else if (GetPlayerScore(playerid) > 1 && PlayerInfo[killerid][pClass] == 1)
{
GivePlayerWeapon(playerid,9,1);
}
return true;
}