[FilterScript] Sistema de Cofre Admin (Pedido)
#1

☻Introduзгo
ATUALIZADO NOVO COMANDO

E um sistema de banco simples, para admins logado na Rocon, e facil de editar.
O Sistema e Totalmente Salvavel.

☻Comandos

/depositar - > Deposita seu dinheiro
/Sacar -> Saca o dinheiro
/saldo -> saldo do dinheiro

☻Configuraзгo
Abra o FS e procure no comeзo
pawn Код:
#define LugarCofre 1,1,1
1,1,1 -> Troque para as coordenadas do Cofre.

☻Creditos: HigorOliver
♣ Idealiza dor: Ricop522

pawn Код:
#define FILTERSCRIPT
#include <a_samp>
#include <dini>

#define LugarCofre 1,1,1
#define Admin IsPlayerAdmin
#define Radio 20

new
    Cofre;
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
//==============================================================================
public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("Sistema de Banco Admin By:Higor");
    print("--------------------------------------\n");
    if(!dini_Exists("Cofre.ini")) dini_Create("Cofre.ini");
    Cofre = dini_Int("Cofre.ini", "Cofre");

    return 1;
}
//==============================================================================
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256],
    idx,
    tmp[256];

    if(strcmp(cmd, "/saldo", true) == 0)
    {
        new string[256];
        if(!Admin(playerid)) return SendClientMessage(playerid,GetPlayerColor(playerid), "Vocк nгo e admin amigao ):");
        format(string, sizeof(string), "O Banco Atualmente tem: %d", Cofre);
        SendClientMessage(playerid,GetPlayerColor(playerid), string);
        return true;
    }

    if(strcmp(cmd, "/depositar", true) == 0)
    {
        new string[100];
        tmp = strtok(cmdtext, idx);
        if(!Admin(playerid)) return SendClientMessage(playerid,GetPlayerColor(playerid), "Vocк nгo e admin amigao ):");
        if(!strval(tmp)) return  SendClientMessage(playerid, GetPlayerColor(playerid), "Use /depositar [dinheiro].");
        if(strval(tmp) < GetPlayerMoney(playerid)) return SendClientMessage(playerid, GetPlayerColor(playerid), "Vocк nгo tem essa quantia");
        if(PlayerToPoint(Radio, playerid, LugarCofre)){
        format(string, sizeof(string), "Vocк depositou: %d.", strval(tmp));
        SendClientMessage(playerid, GetPlayerColor(playerid), string);
        Cofre += strval(tmp);
        GivePlayerMoney(playerid,-strval(tmp));
        dini_IntSet("Cofre.ini","Cofre",Cofre);
        } else SendClientMessage(playerid, GetPlayerColor(playerid), "Vocк nгo esta perto do cofre");
        return 1;
    }

    if(strcmp(cmd, "/sacar", true) == 0)
    {
        new string[100];
        tmp = strtok(cmdtext, idx);
        if(!Admin(playerid)) return SendClientMessage(playerid,GetPlayerColor(playerid), "Vocк nгo e admin amigao ):");
        if(!strval(tmp)) return  SendClientMessage(playerid, GetPlayerColor(playerid), "Use /sacar [dinheiro].");
        if(strval(tmp) < Cofre) return SendClientMessage(playerid, GetPlayerColor(playerid), "O banco nao tem isso tudo");
        if(PlayerToPoint(Radio, playerid, LugarCofre)){
        format(string, sizeof(string), "Vocк Sacou: %d.", strval(tmp));
        SendClientMessage(playerid, GetPlayerColor(playerid), string);
        Cofre -= strval(tmp);
        GivePlayerMoney(playerid,strval(tmp));
        dini_IntSet("Cofre.ini","Cofre",Cofre);
        }else SendClientMessage(playerid, GetPlayerColor(playerid), "Vocк nгo esta perto do cofre");
        return 1;
    }

    return 0;
}
//==============================================================================
strtok(const string[], &index)
{
    new length = strval(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
//==============================================================================
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        tempposx = (oldposx -x);
        tempposy = (oldposy -y);
        tempposz = (oldposz -z);
//      printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}
//==============================================================================
Reply
#2

Legal, simples e funcional!
Reply
#3

Uia,Higor ta ficando Foda no Pawn.

Parabйns denovo Higor.

Filhinho de Papai
Reply
#4

Legal....Vc Hoje ta como uma maquina de fazer codigos neh? Kkkkkkkkk //Zoa
Reply
#5

Higor o natal jб passou pode ficar ruinzinho dinovo riariairairairairar
Reply
#6

Nгo sei porque me deu vontade do nada de Codar hoje.

Talvez e porque vi a foto da mгe do drakon
Reply
#7

Muito foda vey
Valeu ^^
Reply
#8

so nao tem como ver o saldo

hehehe fico legal.
Reply
#9

Quote:
Originally Posted by [Banido]HigorOliver
Посмотреть сообщение
Nгo sei porque me deu vontade do nada de Codar hoje.

Talvez e porque vi a foto da mгe do drakon
Minha mгe й bonitona,rs.

Higor parabйns pelos cуdigos viu,poderia ter usado ZCMD.

Mesmo assim estб уtimo.

Parabйns Amiga.
Reply
#10

Quote:
Originally Posted by [FeK]DraKiNs
Посмотреть сообщение
Minha mгe й bonitona,rs.

Higor parabйns pelos cуdigos viu,poderia ter usado ZCMD.

Mesmo assim estб уtimo.

Parabйns Amiga.
Dб prуxima penso em usar.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)