rendered paste body#include <a_samp>
#include <dini>
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
forward ExtractParametersFromString(const string[], number, out[]);
#define COLOR_AMARILLO 0xFFFF00
#define COLOR_AZUL 0x0066FF
#define COLOR_ROJO 0xFF3300
#define COLOR_VERDEFLOJO 0x00FF00
#define COLOR_NARANJA 0xFF9900
#define COLOR_CELESTE 0x00FFFF
#define COLOR_SYSTEM 0xEFEFF7AA
#define COLOR_VERDE 0x00CC00
#define COLOR_VERDEOSCURO 0x006600
#define COLOR_BLANCO 0xFFFFFF
#define COLOR_MARRON 0x996600
#define COLOR_NEGRO 0x000000
#define COLOR_AZULMARINO 0x0066CC
#define COLOR_LILA 0xCC66FF
#define COLOR_ROSA 0xFF66FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_VERDE 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_AQUA 0x00FFFFFF
#define COLOR_AQUAGRN 0x7FFFD4FF
#define COLOR_BLUEVILOT 0x8A2BE2FF
#define COLOR_LTGREEN 0x7FFF00FF
#define COLOR_DKGREEN 0x006400FF
#define COLOR_GOLD 0xFFD700FF
#define COLOR_GOLDENROD 0xDAA520FF
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_DARKRED 0x660000AA
#define COLOR_ORANGE 0xFF9900AA
public OnFilterScriptInit()
{
print("\n--------------------------------------------");
print("System stats made by Delit(c)\n");
print("1.0");
print("--------------------------------------------\n");
return 1;
}
//------------------------------------------------------------------------------
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{//Public Enemy
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);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}
//------------------------------------------------------------------------------
public ExtractParametersFromString(const string[], number, out[])
{//by EKup
new length = strlen(string);
new indexStart = 0;
new indexEnd = 0;
new numParInStr = 0;
out[0]=EOS;
while ((numParInStr < number) && (indexEnd < length))
{
indexStart = indexEnd;
while ((indexEnd < length) && (string[indexEnd] != ' '))
{
indexEnd++;
}
numParInStr++;
if((numParInStr < number) && (indexEnd < length) && (string[indexEnd] == ' ')) indexEnd++;
}
if(numParInStr!=number) return 0;
new offset = indexStart;
for(new i=indexStart; i<indexEnd; i++)
{
out[i - offset] = string[i];
}
out[indexEnd-offset] = EOS;
return 1;
}
//------------------------------------------------------------------------------
public OnPlayerConnect(playerid)
{
SetPlayerMapIcon(playerid, 1, 2414.6880,1124.5837,10.8203, 52, COLOR_VERDE);
SetPlayerMapIcon(playerid, 2, -2624.8325,1410.0132,7.0938, 52, COLOR_VERDE);
SetPlayerMapIcon(playerid, 3, -1697.8715,952.3763,24.8906, 52, COLOR_VERDE);
SetPlayerMapIcon(playerid, 4, 1631.3008,-1170.6663,24.0781, 52, COLOR_VERDE);
SetPlayerMapIcon(playerid, 5, 1291.9000,269.4450,19.5547, 52, COLOR_VERDE);
SetPlayerMapIcon(playerid, 6, -183.5646,1033.9642,19.7422, 52, COLOR_VERDE);
new playername[256];
GetPlayerName(playerid, playername, 256);
new str[256];
format(str,sizeof(str),"bank/%s", playername);
if(dini_Exists(str))
{
SendClientMessage(playerid, 0xFF9900AA, "Dinero de su cuenta Bancaria,cargado");
}
else
{
format(str,sizeof(str),"bank/%s", playername);
if(!dini_Exists(str)) dini_Create(str);
dini_IntSet(str, "bank",0);
}
return 1;
}
//------------------------------------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
ExtractParametersFromString(cmdtext, 1, cmd);
if(strcmp(cmd, "/guardar", true) == 0)
{
if(PlayerToPoint(100, playerid,827.9430,4.9825,1004.1870) || PlayerToPoint(100, playerid,212.6392,-8.1615,1001.2109) || PlayerToPoint(100, playerid,346.4020,172.5660,1014.1875) || PlayerToPoint(100, playerid,-2662.8271,1411.1824,906.2734) || PlayerToPoint(100, playerid,-26.9156,-55.3495,1003.5469))
{
new nummoney2[256];
new nummoney;
new oldmoney;
new pmoney;
new newmoney;
new playername[256];
new str[256];
new text[256];
GetPlayerName(playerid, playername, 256);
if(!ExtractParametersFromString(cmdtext, 2, nummoney2))
{
SendClientMessage(playerid, COLOR_VERDE, "Usa: /guardar [cantidad]");
return 1;
}
else
{
nummoney = strval(nummoney2);
}
if(GetPlayerMoney(playerid) < nummoney)
{
SendClientMessage(playerid, COLOR_VERDE, "No tienes suficiente dinero");
}
else
{
format(str,sizeof(str),"bank/%s", playername);
oldmoney = dini_Int(str,"bank");
newmoney = nummoney+oldmoney;
dini_IntSet(str, "bank",newmoney);
pmoney = GetPlayerMoney(playerid);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, pmoney-nummoney);
new string[256];
SendClientMessage(playerid, 0xF0F0F0FF, "|______ Cuente de Banco ______|");
format(string,sizeof(string)," Dinero que tenias: %d$", oldmoney);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string,sizeof(string)," Guardado: %d$", nummoney);
SendClientMessage(playerid, COLOR_WHITE, string);
format(text,sizeof(text)," Total Dinero: %d$", newmoney);
SendClientMessage(playerid, COLOR_WHITE, text);
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Entra en un banco situados en el mapa con una $ verde");
}
return 1;
}
if(strcmp(cmd, "/sacar", true) == 0)
{
if(PlayerToPoint(100, playerid,827.9430,4.9825,1004.1870) || PlayerToPoint(100, playerid,212.6392,-8.1615,1001.2109) || PlayerToPoint(100, playerid,346.4020,172.5660,1014.1875) || PlayerToPoint(100, playerid,-2662.8271,1411.1824,906.2734) || PlayerToPoint(100, playerid,-26.9156,-55.3495,1003.5469))
{
new nummoney2[256];
new nummoney;
new oldmoney;
new newmoney;
new playername[256];
new str[256];
new text[256];
GetPlayerName(playerid, playername, 256);
if(!ExtractParametersFromString(cmdtext, 2, nummoney2))
{
SendClientMessage(playerid, COLOR_VERDE, "Usa: /sacar [cantidad]");
}
else
{
nummoney = strval(nummoney2);
}
format(str,sizeof(str),"bank/%s", playername);
oldmoney = dini_Int(str,"bank");
if(oldmoney < nummoney)
{
SendClientMessage(playerid, COLOR_VERDE, "No tienes esa cantidad de dinero en tu cuenta");
}
else
{
newmoney = oldmoney-nummoney;
dini_IntSet(str, "bank",newmoney);
GivePlayerMoney(playerid, nummoney);
new string[256];
SendClientMessage(playerid, 0xF0F0F0FF, "|______ Cuenta de Banco ______|");
format(string,sizeof(string)," Dinero que tenias: %d$", oldmoney);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string,sizeof(string)," Dinero sacado: %d$", nummoney);
SendClientMessage(playerid, COLOR_WHITE, string);
format(text,sizeof(text)," Total Dinero: %d$", newmoney);
SendClientMessage(playerid, COLOR_WHITE, text);
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Entra en un banco situados en el mapa con una $ verde ");
}
return 1;
}
if(strcmp(cmd, "/banco", true) == 0)
{
new playername[256];
new str[256];
new money2;
GetPlayerName(playerid, playername, 256);
format(str,sizeof(str),"bank/%s", playername);
money2 = dini_Int(str,"bank");
format(str,sizeof(str)," Tu Dinero: %d$", money2);
SendClientMessage(playerid, 0xF0F0F0FF, "|______ Cuenta Bancaria ______|");
SendClientMessage(playerid, COLOR_WHITE, str);
return 1;
}
return 0;
}