}
if(strcmp(cmd, "/deletarprop", true) == 0)
{
new propid;
if(sscanf(cmdtext, "s[13]d", cmd, propid))
{
SendClientMessage(playerid, Vermelho, "/deletarprop [propid]");
return 1;
}
format(string, sizeof(string), PASTA_PROPS, propid);
if(dini_Exists(string))
{
if(pAdmin[playerid] >= 5)
{
DestroyDynamicPickup(dini_Int(string, "Id"));
DestroyDynamicMapIcon(dini_Int(string, "IconId"));
DestroyDynamic3DTextLabel(ptextoid[propid]);
ptextoid[propid] = Text3D:INVALID_3DTEXT_ID;
dini_IntSet(string, "TDono", 3);
dini_Set(string, "Dono", "Ninguem");
dini_IntSet(string, "Id", -1);
dini_IntSet(string, "IconId", -1);
SendClientMessage(playerid, roxo, "Propriedade deletada com sucesso!");
}
else
{
SendClientMessage(playerid, Vermelho, "Vocк nгo tem permissгo.");
}
}
return 1;
}
if(strcmp(cmd, "/deletcar", true) == 0)
{
if(pAdmin[playerid] > 3)
{
Loop(o, sizeof(VehiclesFix))
{
if(GetPlayerVehicleID(playerid) == VehiclesFix[o])
{
SendClientMessage(playerid, Vermelho, "Este carro nгo pode ser deletado!");
return 1;
}
}
for(new carro = 0; carro < MAX_CONCES; carro++)
{
format(string, sizeof(string), PASTA_CONCE, carro);
if(GetPlayerVehicleID(playerid) == dini_Int(string, "Id"))
{
ShowPlayerDialog(playerid, deletcarconce, DIALOG_STYLE_MSGBOX, "Deletando Veнculo", "{FF0000}Este veнculo й da Conce, quer mesmo deletar?", "Sim", "Nгo");
return 1;
}
}
DestroyVehicle(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, 0x0080FFAA, "Veнculo deletado com sucesso!");
return 1;
}
}
if(strcmp(cmd, "/deletarcasa", true) == 0)
{
new casaid;
if(sscanf(cmdtext, "s[13]d", cmd, casaid))
{
SendClientMessage(playerid, Vermelho, "/deletarcasa [casaid]");
return 1;
}
format(string, sizeof(string), PASTA_CASAS, casaid);
if(dini_Exists(string))
{
if(pAdmin[playerid] > 4)
{
DestroyDynamicPickup(dini_Int(string, "Id"));
DestroyDynamicMapIcon(dini_Int(string, "IconId"));
DestroyDynamic3DTextLabel(ctextoid[casaid]);
ctextoid[casaid] = Text3D:INVALID_3DTEXT_ID;
dini_IntSet(string, "TDono", 3);
dini_Set(string, "Dono", "Ninguem");
dini_IntSet(string, "Id", -1);
dini_IntSet(string, "IconId", -1);
SendClientMessage(playerid, roxo, "Casa deletada com sucesso!");
}
else
{
SendClientMessage(playerid, Vermelho, "Vocк nгo tem permissгo.");
}
}
return 1;
esqueci o nome da include, mas й uma do DanDRT. ela pode te ajudar muito. й pra contar dias..
|
////////////////////////////////////////////////////////////////////////////////
//
//
// #### ######## ###### ######## ######## ### ## ##
// ## ## ## ## ## ## ## ## ## ### ###
// ## ## ## ## ## ## ## ## #### ####
// ## ######## ###### ## ###### ## ## ## ### ##
// ## ## ## ## ## ######### ## ##
// ## ## ## ## ## ## ## ## ## ##
// #### ## ###### ## ######## ## ## ## ##
//
//
// DelAuto Acc v2.0
//
/* ______ ______ _
// | ___ \ | ___ \ | |
// | |_/ /_ _ | |_/ /_ _ _ _| | ___
// | ___ \ | | | | __/ _` | | | | |/ _ \
// | |_/ / |_| |_ | | | (_| | |_| | | (_) |
// \____/ \__, (_) \_| \__,_|\__,_|_|\___/
// __/ |
// |___/
*/
//
// !!! Deleta automaticamente contas de usuбrios inativos, usando INI !!!
//
// [iPs]TeaM soluзхes de programaзгo em geral (agora com cursos)
//
// http://ips-team.forumeiros.com/ (contate-nos)
//
/////////////////////////////////////////////////////////////////////////////////
#define pTIME 30 //Coloque em dias aqui o tempo para que a Acc seja deletada.
#define pFILE "Contas/%s.ini" //Coloque aqui o caminho das contas dos Players.
#define pBACKUP "pBackup" //Configure aqui sua Pasta de Backups.
#define pCriarArq(%0) fclose(fopen(%0, io_append))
#define pUSERS 255 //Nъmero de linhas mбximo das Acc's.
#if !defined isnull
#define isnull(%1) !(%1[0]) || %1[0] == '\1' && !(%1[1])
#endif
forward OnAccountDeleted(conta[]);
public OnGameModeInit() {
if(fexist("pNameUsers.Paulo")) {
new File: pArq, pTime = gettime(), pStr[64], pName[24], pFind;
pArq = fopen("pNameUsers.Paulo", io_read);
while(fread(pArq, pStr)) {
if(pTime > strval(pStr[(pFind = strfind(pStr, "=") + 1)]) > 0) {
strmid(pName, pStr, 0, (pFind - 1));
format(pStr, 64, pFILE, pName);
pRemoveKey("pNameUsers.Paulo", pName);
printf("User: %s teve sua Conta deletada pois ficou invativo por mais de %i dias.", pName, pTIME);
pMoveFile(pStr);
CallLocalFunction("OnAccountDeleted", "s", pName);
}
}
fclose(pArq);
} else pCriarArq("pNameUsers.Paulo");
return CallLocalFunction("DelOnGameModeInit", #);
}
public OnPlayerConnect(playerid) {
if(fexist("pNameUsers.Paulo")) pWriteFile("pNameUsers.Paulo", pGetPlayerName(playerid), (gettime() + (60 * 60 * 24 * pTIME)));
return CallLocalFunction("DelOnPlayerConnect", "i", playerid);
}
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#define OnGameModeInit DelOnGameModeInit
#define OnPlayerConnect DelOnPlayerConnect
forward DelOnGameModeInit();
forward DelOnPlayerConnect(playerid);
pGetPlayerName(playerid) {
new pName[24];
GetPlayerName(playerid, pName, 24);
return pName;
}
pWriteFile(file[], key[], valor) {
new File: pArq, pStr[40];
pRemoveKey(file, key);
pArq = fopen(file, io_append);
format(pStr, 40, "%s=%i\r\n", key, valor);
fwrite(pArq, pStr);
fclose(pArq);
return 1;
}
stock pFileSave[pUSERS][128], bFileSave[pUSERS][128];
pMoveFile(file[]) {
new File: pFile, pStr[35], pPos;
if(!fexist(file)) return 0;
pFileSave = bFileSave;
pFile = fopen(file, io_read);
while(fread(pFile, pStr)) pFileSave[pPos++] = pStr;
fclose(pFile);
fremove(file);
strdel(file, 0, strfind(file, "/"));
format(file, 64, "%s/%s", pBACKUP, file);
pFile = fopen(file, io_write);
for(new pI; pPos > -1; --pPos) fwrite(pFile, pFileSave[pI++]);
fclose(pFile);
return 1;
}
pRemoveKey(file[], ignorekey[]) {
new File: pFile, pStr[35], bool: pVar, pPos;
if(!fexist(file)) return 0;
pFileSave = bFileSave;
pFile = fopen(file, io_read);
while(fread(pFile, pStr)) {
if(strfind(pStr, ignorekey, true) == -1) {
pFileSave[pPos++] = pStr;
} else pVar = true;
}
fclose(pFile);
if(!pVar) return 0;
fremove(file);
pFile = fopen(file, io_write);
for(new pI; pPos > -1; --pPos) fwrite(pFile, pFileSave[pI++]);
fclose(pFile);
return 1;
}
public OnAccountDeleted(conta[]) {
new i;
for ( i = 0; i < MAX_EMPRESAS; ++i ) {
if (!strcmp(BizzInfo[i][bOwner], conta) ) {
// ... Vender
}
}
return true;
}
Basta modificar a include.
pawn Код:
Gamemode: pawn Код:
|