Algumas Definiзхes . Preciso Dessa Ajuda. -
Lucas-Fc - 19.10.2012
Bom Galera, Eu tava pensando, em fazer um sistema de Horas Jogadas, com salvamento em DINI, em alguma pasta na ScriptFiles.
Seria Assim : A cada 1 hr Jogada, o Player ganharia 1 Score
Esse Score seria salvo ( como hora jogada ).
Por que isso ? - Estou pensando tambйm, em restringir o acesso de alguns players, a algum veiculo especifico.
Exemplo :
Se um player que tem 1 Score ( Uma Hora Jogada ) Tentar entrar num Veiculo, Cujo Score necessбrio para o player poder dirijir , for 5 ( 5 Horas Jogadas ) , O Player Nгo conseguiria dirigir o carro.
" Vocк nгo tem score para dirigir esse carro "
Tem como fazer isso ? se tiver, alguйm te a bondade de me ensinar ?
Й isso.
Re: Algumas Definiзхes . Preciso Dessa Ajuda. -
Lucas-Fc - 19.10.2012
Alguйm aceita o desafio ? kkkk UP :\
Re: Algumas Definiзхes . Preciso Dessa Ajuda. -
PawnoBrasil[xPBx] - 19.10.2012
pawn Код:
#include <a_samp>
#include <dof2>
new hInfo{HorasJogadas};
new HorasInfo[MAX_PLAYERS][hInfo];
new CarroProibido[1];
public OnGameModeInit(){
CarroProibido[0] = AddStaticVehicle(MODELO,X,Y,Z,A,COR1,COR2);
return 1;
}
public OnPlayerConnect(playerid){
new file[70],snd[MAX_PLAYER_NAME];
GetPlayerName(playerid,snd,sizeof(snd));
format(file,sizeof(file),"Horas Jogadas/%s.ini",snd);
if(!DOF2_FileExists(file)) { CriarPlayer(playerid); } else
{ CarregarPlayer(playerid); }
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate){
new Carro = GetPlayerVehicleID(playerid);
for(new x = 0; x < sizeof(CarroProibido); x++){
if(Carro == CarroProibido[x] && GetPlayerState(playerid) == PLAYER_STATE_DRIVER && HorasInfo[playerid][HorasJogadas] < 3){ // Vocк pode mudar o 3 pelas horas jogadas que vocк quiser.
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,-1,"Vocк nгo tem horas jogadas o suficiente para usar este veiculo!");
}
}
return 1;
}
stock CriarPlayer(playerid){
new file[70],snd[MAX_PLAYER_NAME];
GetPlayerName(playerid,snd,sizeof(snd));
format(file,sizeof(file),"Horas Jogadas/%s.ini",snd);
DOF2_CreateFile(file);
DOF2_SetInt(file,"Score",0);
DOF2_SaveFile();
CarregarPlayer(playerid);
return 1;
}
stock CarregarPlayer(playerid){
new file[70],snd[MAX_PLAYER_NAME];
GetPlayerName(playerid,snd,sizeof(snd));
format(file,sizeof(file),"Horas Jogadas/%s.ini",snd);
HorasInfo[playerid][HorasJogadas] = DOF2_GetInt(file,"Score");
return 1;
}
Nгo se esqueзa de criar a pasta
Horas Jogadas na pasta
scriptfiles..
Eu fiz em
dof2 pq nгo mecho com dini..
Re: Algumas Definiзхes . Preciso Dessa Ajuda. -
PawnoBrasil[xPBx] - 19.10.2012
@DoublePost
Atualizado para upar a cada uma hora..
pawn Код:
#include <a_samp>
#include <dof2>
new hInfo{HorasJogadas};
new HorasInfo[MAX_PLAYERS][hInfo];
new CarroProibido[1];
forward Upar(playerid);
public OnGameModeInit(){
CarroProibido[0] = AddStaticVehicle(MODELO,X,Y,Z,A,COR1,COR2);
return 1;
}
public OnPlayerConnect(playerid){
new file[70],snd[MAX_PLAYER_NAME];
SetTimer("Upar",60000,true);
GetPlayerName(playerid,snd,sizeof(snd));
format(file,sizeof(file),"Horas Jogadas/%s.ini",snd);
if(!DOF2_FileExists(file)) { CriarPlayer(playerid); } else
{ CarregarPlayer(playerid); }
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate){
new Carro = GetPlayerVehicleID(playerid);
for(new x = 0; x < sizeof(CarroProibido); x++){
if(Carro == CarroProibido[x] && GetPlayerState(playerid) == PLAYER_STATE_DRIVER && HorasInfo[playerid][HorasJogadas] < 3){ // Vocк pode mudar o 3 pelas horas jogadas que vocк quiser.
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,-1,"Vocк nгo tem horas jogadas o suficiente para usar este veiculo!");
}
}
return 1;
}
public Upar(playerid){ HorasInfo[playerid][HorasJogadas] += 1; }
stock CriarPlayer(playerid){
new file[70],snd[MAX_PLAYER_NAME];
GetPlayerName(playerid,snd,sizeof(snd));
format(file,sizeof(file),"Horas Jogadas/%s.ini",snd);
DOF2_CreateFile(file);
DOF2_SetInt(file,"Score",0);
DOF2_SaveFile();
CarregarPlayer(playerid);
return 1;
}
stock CarregarPlayer(playerid){
new file[70],snd[MAX_PLAYER_NAME];
GetPlayerName(playerid,snd,sizeof(snd));
format(file,sizeof(file),"Horas Jogadas/%s.ini",snd);
HorasInfo[playerid][HorasJogadas] = DOF2_GetInt(file,"Score");
return 1;
}
Nгo testei o script..
Re: Algumas Definiзхes . Preciso Dessa Ajuda. -
Lucas-Fc - 19.10.2012
Vou testar, agora nгo pq to no cel