28.12.2010, 19:36
(
Последний раз редактировалось [Banido]HigorOliver; 29.12.2010 в 15:13.
)
☻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
☻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;
}
//==============================================================================