Can you cut some?[HELP ME PLEASE]
#1

Can you cut the bank system from this script!
Please! 'cause i'm cutin' this all month, but have no effect!
Plaese help me!
I'm stupid newbie!

Код:
#include <a_samp>

#include <utils>

#define FILTERSCRIPT

#if defined FILTERSCRIPT
#define COLOR_GREY 0xBEBEBEAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_GRAD5 0xE3E3E3FF
#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD3 0xCBCCCEFF

forward ShowStats(playerid,targetid);
forward OnPlayerUpdate(playerid);
forward Encrypt(string[]);
forward OnPlayerLogin(playerid,const string[]);
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
forward ABroadCast(color,const string[],level);
forward CustomPickups();

enum pInfo
{
	pPassword[128],
	pKills,
	pDeaths,
	pCash,
	pBank,
};

new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];
new gPlayerAccount[MAX_PLAYERS];
new ConsumingMoney[MAX_PLAYERS];
new sendername[MAX_PLAYER_NAME];
new playermoney;


public OnFilterScriptInit()
{
	print("\n$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
	print(" Kevin433's Login/Register Filterscript");
	print("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
	SetTimer("CustomPickups", 1000, 1);
	AddStaticPickup(1274, 2,2026.4064,1017.9352,10.8203);
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnPlayerConnect(playerid)
{
  new playrname[MAX_PLAYER_NAME];
  	new connect[128];
  GetPlayerName(playerid, playrname, sizeof(playrname));
	format(connect, sizeof(connect), "%s.ini", playrname);
	if(fexist(connect))
	{
		gPlayerAccount[playerid] = 1;
		SendClientMessage(playerid, COLOR_YELLOW, "[СЕРВЕР]:Ты зарегестрирован, вводи /login пароль");
		return 1;
	}
	else
	{
		gPlayerAccount[playerid] = 0;
		SendClientMessage(playerid, COLOR_YELLOW, "[СЕРВЕР]:Ты не зарегестрирован, зарегестрируся командой: /register пароль");
	}
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
  OnPlayerUpdate(playerid);
  gPlayerLogged[playerid] = 0;
	return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
  new kills = PlayerInfo[playerid][pKills];
  SetPlayerScore(playerid, kills);
  new Float:Health;
  GetPlayerHealth(playerid, Health);
  if(Health == 0.0)
  {
  PlayerInfo[playerid][pDeaths] += 1;
  }
  GivePlayerMoney(killerid,2000);
  PlayerInfo[killerid][pKills] = PlayerInfo[killerid][pKills] + 1;
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256];
  new idx;
  cmd = strtok(cmdtext, idx);
  	new tmp[256];
  new playername[MAX_PLAYER_NAME];
  new string[256];
  new moneys;
  new giveplayer[MAX_PLAYER_NAME];
  new giveplayerid;
  if (strcmp(cmd, "/login", true) ==0 )
	{
	  if(IsPlayerConnected(playerid))
	  {
	    new tmppass[64];
			if(gPlayerLogged[playerid] == 1)
			{
				SendClientMessage(playerid, COLOR_GREY, "[СЕРВЕР]:Ты уже залогинен.");
				return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GREY, "[СЕРВЕР]:Используй: /login [пароль]");
				return 1;
			}
			strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
			Encrypt(tmppass);
			OnPlayerLogin(playerid,tmppass);
		}
		return 1;
	}
	if (strcmp(cmd, "/register", true)==0)
	{
		//new string[265];
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_GREY, "[СЕРВЕР]:Используй: /register [пароль]");
			return 1;
		}
		if (gPlayerAccount[playerid] == 1)
		{
			SendClientMessage(playerid, COLOR_GREY, "[СЕРВЕР]:Ник уже зарегестрирован");
			return 1;
		}

		strmid(PlayerInfo[playerid][pPassword], tmp, 0, strlen(cmdtext), 255);
		Encrypt(PlayerInfo[playerid][pPassword]);
		GetPlayerName(playerid, playername, sizeof(playername));
		format(string, sizeof(string), "%s.ini", playername);
		new File: file = fopen(string, io_read);
		if (file)
		{
			SendClientMessage(playerid, COLOR_GREY, "[СЕРВЕР]:Ник уже зарегестрирован");
			fclose(file);
			return 1;
		}
		new File:hFile;
		hFile = fopen(string, io_append);
		new var[32];//
    format(var, 32, "%s\n", PlayerInfo[playerid][pPassword]);fwrite(hFile, var);
    format(var, 32, "Kills=%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var);
    format(var, 32, "Deaths=%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
    PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
    format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
    format(var, 32, "Bank=%d\n",PlayerInfo[playerid][pBank]);fwrite(hFile, var);
		fclose(hFile);
		SendClientMessage(playerid, COLOR_WHITE, "[СЕРВЕР]:Удачно зарегестрирован!");
		SendClientMessage(playerid, COLOR_WHITE, "[СЕРВЕР]:Следующий раз, при входе пиши /login <пароль> чтобы войти.");
		OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]);
		return 1;
	}
	if (strcmp(cmd, "/stats", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if (gPlayerLogged[playerid] != 0)
			{
				ShowStats(playerid,playerid);
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "[СЕРВЕР]:Ты не залогинен !");
			}
		}
		return 1;
	}
//=================[Bank System]================================================================
  if(strcmp(cmd, "/bank", true) == 0 || strcmp(cmd, "/deposit", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(!PlayerToPoint(20.0,playerid,2305.688964,-16.088100,26.749599))
	    {
	      SendClientMessage(playerid, COLOR_GREY, "  Ты не в банке !");
	      return 1;
	    }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "[БАНК]:Использование: /bank [сумма]");
				format(string, sizeof(string), " You Have $%d in your account.", PlayerInfo[playerid][pBank]);
				SendClientMessage(playerid, COLOR_GRAD3, string);
				return 1;
			}
			new cashdeposit = strval(tmp);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "[БАНК]:Использование: /bank [сумма]");
				format(string, sizeof(string), " You Have $%d in your account.", PlayerInfo[playerid][pBank]);
				SendClientMessage(playerid, COLOR_GRAD3, string);
				return 1;
			}
			if (cashdeposit > GetPlayerMoney(playerid) || cashdeposit < 1)
			{
				SendClientMessage(playerid, COLOR_GRAD2, "[БАНК]:У тебя нет такого количества денег");
				return 1;
			}
			GivePlayerMoney(playerid,-cashdeposit);
			new curfunds = PlayerInfo[playerid][pBank];
			PlayerInfo[playerid][pBank]=cashdeposit+PlayerInfo[playerid][pBank];
			SendClientMessage(playerid, COLOR_GREEN, "|___ БАНК САН АНДРЕАС ___|");
			format(string, sizeof(string), " Старый баланс: $%d", curfunds);
			SendClientMessage(playerid, COLOR_GRAD2, string);
			format(string, sizeof(string), " Внесено: $%d",cashdeposit);
			SendClientMessage(playerid, COLOR_GRAD4, string);
			SendClientMessage(playerid, COLOR_GREEN, "|-----------------------------------------|");
			format(string, sizeof(string), " Новый баланс: $%d", PlayerInfo[playerid][pBank]);
			SendClientMessage(playerid, COLOR_WHITE, string);
			return 1;
		}
		return 1;
	}
	if(strcmp(cmd, "/withdraw", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(!PlayerToPoint(20.0,playerid,2305.688964,-16.088100,26.749599))
	    {
	      SendClientMessage(playerid, COLOR_GREY, "[СЕРВЕР]:Ты не в банке !");
	      return 1;
	    }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "[БАНК]:Использование: /withdraw [сумма]");
				format(string, sizeof(string), "[БАНК]:У тебя $%d на аккаунте.", PlayerInfo[playerid][pBank]);
				SendClientMessage(playerid, COLOR_GRAD3, string);
				return 1;
			}
			new cashdeposit = strval(tmp);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "[БАНК]:Использование: /withdraw [сумма]");
				format(string, sizeof(string), "[БАНК]:У тебя $%d на аккаунте.", PlayerInfo[playerid][pBank]);
				SendClientMessage(playerid, COLOR_GRAD3, string);
				return 1;
			}
			if (cashdeposit > PlayerInfo[playerid][pBank] || cashdeposit < 1)
			{
				SendClientMessage(playerid, COLOR_GRAD2, "[БАНК]:У тебя нет такого количества денег !");
				return 1;
			}
		  ConsumingMoney[playerid] = 1;
			GivePlayerMoney(playerid,cashdeposit);
			PlayerInfo[playerid][pBank]=PlayerInfo[playerid][pBank]-cashdeposit;
			format(string, sizeof(string), "[БАНК]:Ты снял $%d со счёта, Баланс: $%d ", cashdeposit,PlayerInfo[playerid][pBank]);
			SendClientMessage(playerid, COLOR_YELLOW, string);
			return 1;
		}
		return 1;
	}
	if(strcmp(cmd, "/balance", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if(!PlayerToPoint(20.0,playerid,2305.688964,-16.088100,26.749599))
	    {
	      SendClientMessage(playerid, COLOR_GREY, "[СЕРВЕР]:Ты не в банке !");
	      return 1;
	    }
			format(string, sizeof(string), "[БАНК]:У тебя $%d на аккаунте.",PlayerInfo[playerid][pBank]);
			SendClientMessage(playerid, COLOR_YELLOW, string);
		}
		return 1;
	}
	if(strcmp(cmd, "/transfer", true) == 0 || strcmp(cmd, "/wiretransfer", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if(!PlayerToPoint(20.0,playerid,2305.688964,-16.088100,26.749599))
	    {
	      SendClientMessage(playerid, COLOR_GREY, "[СЕРВЕР]:Ты не в банке !");
	      return 1;
	    }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "[БАНК]:Использование: /transfer [id/Ник] [сумма]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "[БАНК]:Использование: /transfer [id/Ник] [сумма]");
				return 1;
			}
			moneys = strval(tmp);
			if (IsPlayerConnected(giveplayerid))
			{
			  if(giveplayerid != INVALID_PLAYER_ID)
			  {
					GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					GetPlayerName(playerid, sendername, sizeof(sendername));
					playermoney = PlayerInfo[playerid][pBank] ;
					if (moneys > 0 && playermoney >= moneys)
					{
						PlayerInfo[playerid][pBank] -= moneys;
						PlayerInfo[giveplayerid][pBank] += moneys;
						format(string, sizeof(string), "[БАНК]:Ты передал $%d на аккаунт %s", moneys, giveplayer,giveplayerid);
						PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
						SendClientMessage(playerid, COLOR_GRAD1, string);
						format(string, sizeof(string), "[БАНК]:Ты получил $%d на свой аккаунт от %s", moneys, sendername, playerid);
						SendClientMessage(giveplayerid, COLOR_GRAD1, string);
						format(string, sizeof(string), "[БАНК]:%s передал $%d гроку %s", sendername, moneys, giveplayer);
		        if(moneys >= 500000)
						{
							ABroadCast(COLOR_GREEN,string,1);
						}
						printf("%s", string);
						PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
					}
					else
					{
						SendClientMessage(playerid, COLOR_GRAD1, "[БАНК]:Не корректная сумма.");
					}
				}
			}
			else
			{
				format(string, sizeof(string), "[БАНК]:%d неактивный игрок.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
//==========================[Enter and Exit]==========================================================================================================
  if(strcmp(cmd, "/enter", true) == 0)
	{
			if (PlayerToPoint(3.0, playerid,-2054.6311,456.6516,35.1719))// Bank
			{
				SetPlayerPos(playerid,2305.688964,-16.088100,26.749599);
				GameTextForPlayer(playerid, "~w~Welcome to the City Bank!~n~~w~Type /exit to get out", 5000, 5);
				SetPlayerInterior(playerid, 0);
			}
      return 1;
	}
	if(strcmp(cmdtext, "/exit", true) == 0)
	{
	    if (PlayerToPoint(3.0, playerid,2305.688964,-16.088100,26.749599))// Bank
			{
				SetPlayerPos(playerid,1465.1801,-1010.9435,26.8438);
				SetPlayerInterior(playerid, 0);
			}
      return 1;
	}
	return 0;
}

public Encrypt(string[])
{
	for(new x=0; x < strlen(string); x++)
	 {
		 string[x] += (3^x) * (x % 15);
		 if(string[x] > (0xff))
		 {
			 string[x] -= 64;
		 }
	 }
	return 1;
}


public OnPlayerLogin(playerid,const string[])
{
  new pname2[MAX_PLAYER_NAME];
	new pname3[MAX_PLAYER_NAME];
	new string2[64];
	new string3[128];
	GetPlayerName(playerid, pname2, sizeof(pname2));
	format(string2, sizeof(string2), "%s.ini", pname2);
	new File: UserFile = fopen(string2, io_read);

	if (UserFile)
	{
		new valtmp[128];
		fread(UserFile, valtmp);strmid(PlayerInfo[playerid][pPassword], valtmp, 0, strlen(valtmp)-1, 255);

		if ((strcmp(PlayerInfo[playerid][pPassword], string, true, strlen(valtmp)-1) == 0))
		{
			new key[128],val[128];
 			new Data[128];
 			while(fread(UserFile,Data,sizeof(Data)))
			{
				key = ini_GetKey(Data);
        if( strcmp( key , "Kills" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKills] = strval( val ); }
        if( strcmp( key , "Deaths" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDeaths] = strval( val ); }
        if( strcmp( key , "Money" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
        if( strcmp( key , "Bank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBank] = strval( val ); }
        GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
			}
			fclose(UserFile);
			gPlayerLogged[playerid] = 1;
			gPlayerAccount[playerid] = 1;
		  new kills = PlayerInfo[playerid][pKills];
      SetPlayerScore(playerid, kills);
			GetPlayerName(playerid, pname3, sizeof(pname3));
			format(string3, sizeof(string3), "[СЕРВЕР]:Привет %s, Ты удачно вошел!", pname3);
			SendClientMessage(playerid, COLOR_GREEN,string3);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "[СЕРВЕР]:Пароль не подходит к нику");
			fclose(UserFile);
		}
	}
	return 1;
}

public OnPlayerUpdate(playerid)
{
	if(IsPlayerConnected(playerid))
	{
		if(gPlayerLogged[playerid])
		{
			new string3[32];
			new pname3[MAX_PLAYER_NAME];
			GetPlayerName(playerid, pname3, sizeof(pname3));
			format(string3, sizeof(string3), "%s.ini", pname3);
			new File: pFile = fopen(string3, io_write);
			if (pFile)
			{
				new var[32];
				format(var, 32, "%s\n", PlayerInfo[playerid][pPassword]);fwrite(pFile, var);
				fclose(pFile);
				new File: hFile = fopen(string3, io_append);
				PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
				format(var, 32, "Kills=%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var);
				format(var, 32, "Deaths=%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
				format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
				format(var, 32, "Bank=%d\n",PlayerInfo[playerid][pBank]);fwrite(hFile, var);
				fclose(hFile);
			}
		}
	}
	return 1;
}

stock ini_GetKey( line[] )
{
	new keyRes[128];
	keyRes[0] = 0;
  if ( strfind( line , "=" , true ) == -1 ) return keyRes;
  strmid( keyRes , line , 0 , strfind( line , "=" , true ) , sizeof( keyRes) );
  return keyRes;
}

stock ini_GetValue( line[] )
{
	new valRes[128];
	valRes[0]=0;
	if ( strfind( line , "=" , true ) == -1 ) return valRes;
	strmid( valRes , line , strfind( line , "=" , true )+1 , strlen( line ) , sizeof( valRes ) );
	return valRes;
}


strtok(const string[], &index)
{
	new length = strlen(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 ShowStats(playerid,targetid)
{
  if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
	{
		new cash = GetPlayerMoney(targetid);
		new deaths = PlayerInfo[targetid][pDeaths];
		new kills = PlayerInfo[targetid][pKills];
		new name[MAX_PLAYER_NAME];
		GetPlayerName(targetid, name, sizeof(name));
		new Float:px,Float:py,Float:pz;
		GetPlayerPos(targetid, px, py, pz);
		new coordsstring[256];
		new bank = PlayerInfo[targetid][pBank];
		SendClientMessage(playerid, COLOR_GREEN,"________________________________________________");
		format(coordsstring, sizeof(coordsstring),"*** %s ***",name);
		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
		format(coordsstring, sizeof(coordsstring), "Убийства:[%d] Смерти:[%d] Деньги:[$%d] Банк:[$%d]",kills,deaths,cash,bank);
		SendClientMessage(playerid, COLOR_GRAD5,coordsstring);
		SendClientMessage(playerid, COLOR_GREEN,"________________________________________________");
	}
}

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);
		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
		{
			return 1;
		}
	}
	return 0;
}

public ABroadCast(color,const string[],level)
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
				SendClientMessage(i, color, string);
				printf("%s", string);
		}
	}
	return 1;
}

public CustomPickups()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	if (PlayerToPoint(3, i,-2054.6311,456.6516,35.1719)) // Bank outside
	{
  GameTextForPlayer(i, "~y~Welcome to The ~y~City Bank~n~~w~Type /enter to go in", 5000, 5);
	}
	}
	return 1;
}


#endif
HELP PLEASE
Reply
#2

I got one question:

Is that some filterscript, and you want to add it to your gamemode, so you don't need to use the filterscript?
Reply
#3

Quote:
Originally Posted by Johnson_boy
I got one question:

Is that some filterscript, and you want to add it to your gamemode, so you don't need to use the filterscript?
I want to cut the banking system of this script and make a separate script of the banking system!
Reply
#4

Just cut the cmds and the defines
Reply
#5

Quote:
Originally Posted by Chuck_Taylor
Just cut the cmds and the defines
when i cut them, i always have many errors!
Reply
#6

Please don't use a freaking "!" after each sentence. If you tell us the errors we can help you out.
Reply
#7

Quote:
Originally Posted by Rubennnnn
Please don't use a freaking "!" after each sentence. If you tell us the errors we can help you out.
Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

new PlayerInfo[MAX_PLAYERS][500]

forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);


public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif
public OnPlayerCommandText(playerid, cmdtext[])
{
//=================[Bank System]================================================================
  if(strcmp(cmdtext, "/bank", true) == 0 || strcmp(cmdtext, "/deposit", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(!PlayerToPoint(20.0,playerid,2305.688964,-16.088100,26.749599))
	    {
	      SendClientMessage(playerid, 0xBEBEBEAA, "  Ты не в банке !");
	      return 1;
	    }
	    new tmp[250];
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, 0xB4B5B7FF, "USAGE: /bank [amount]");
				new string[150];
				format(string, sizeof(string), " You Have $%d in your account.", PlayerInfo[playerid][pBank]);
				SendClientMessage(playerid, 0xB4B5B7FF, string);
				return 1;
			}
			new cashdeposit = strval(tmp);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, 0xB4B5B7FF, "USAGE: /bank [amount]");
				format(string, sizeof(string), " You Have $%d in your account.", PlayerInfo[playerid][pBank]);
				SendClientMessage(playerid, 0xB4B5B7FF, string);
				return 1;
			}
			if (cashdeposit > GetPlayerMoney(playerid) || cashdeposit < 1)
			{
				SendClientMessage(playerid, 0xB4B5B7FF, "  You dont have that much");
				return 1;
			}
			GivePlayerMoney(playerid,-cashdeposit);
			new curfunds = PlayerInfo[playerid][pBank];
			PlayerInfo[playerid][pBank]=cashdeposit+PlayerInfo[playerid][pBank];
			SendClientMessage(playerid, COLOR_WHITE, "|___ BANK STATMENT ___|");
			format(string, sizeof(string), " Old Balance: $%d", curfunds);
			SendClientMessage(playerid, 0xB4B5B7FF, string);
			format(string, sizeof(string), " Deposit: $%d",cashdeposit);
			SendClientMessage(playerid, COLOR_GRAD4, string);
			SendClientMessage(playerid, COLOR_GRAD6, "|-----------------------------------------|");
			format(string, sizeof(string), " New Balance: $%d", PlayerInfo[playerid][pBank]);
			SendClientMessage(playerid, COLOR_WHITE, string);
			return 1;
		}
		return 1;
	}
	if(strcmp(cmdtext, "/withdraw", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(!PlayerToPoint(20.0,playerid,2305.688964,-16.088100,26.749599))
	    {
	      SendClientMessage(playerid, 0xBEBEBEAA, "  You are not at the Bank !");
	      return 1;
	    }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, 0xB4B5B7FF, "USAGE: /withdraw [amount]");
				format(string, sizeof(string), " You Have $%d in your account.", PlayerInfo[playerid][pBank]);
				SendClientMessage(playerid, 0xB4B5B7FF, string);
				return 1;
			}
			new cashdeposit = strval(tmp);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, 0xB4B5B7FF, "USAGE: /withdraw [amount]");
				format(string, sizeof(string), " You Have $%d in your account.", PlayerInfo[playerid][pBank]);
				SendClientMessage(playerid, 0xB4B5B7FF, string);
				return 1;
			}
			if (cashdeposit > PlayerInfo[playerid][pBank] || cashdeposit < 1)
			{
				SendClientMessage(playerid, 0xB4B5B7FF, "  You dont have that much !");
				return 1;
			}
		  ConsumingMoney[playerid] = 1;
			GivePlayerMoney(playerid,cashdeposit);
			PlayerInfo[playerid][pBank]=PlayerInfo[playerid][pBank]-cashdeposit;
			format(string, sizeof(string), " You Have Withdrawn $%d from your account Total: $%d ", cashdeposit,PlayerInfo[playerid][pBank]);
			SendClientMessage(playerid, COLOR_YELLOW, string);
			return 1;
		}
		return 1;
	}
	if(strcmp(cmdtext, "/balance", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if(!PlayerToPoint(20.0,playerid,2305.688964,-16.088100,26.749599))
	    {
	      SendClientMessage(playerid, 0xBEBEBEAA, "  You are not at the Bank !");
	      return 1;
	    }
			format(string, sizeof(string), " You Have $%d in your account.",PlayerInfo[playerid][pBank]);
			SendClientMessage(playerid, COLOR_YELLOW, string);
		}
		return 1;
	}
	if(strcmp(cmdtext, "/transfer", true) == 0 || strcmp(cmd, "/wiretransfer", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if(!PlayerToPoint(20.0,playerid,2305.688964,-16.088100,26.749599))
	    {
	      SendClientMessage(playerid, 0xBEBEBEAA, "  You are not at the Bank !");
	      return 1;
	    }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, 0xB4B5B7FF, "USAGE: /transfer [playerid/PartOfName] [amount]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, 0xB4B5B7FF, "USAGE: /transfer [playerid/PartOfName] [amount]");
				return 1;
			}
			moneys = strval(tmp);
			if (IsPlayerConnected(giveplayerid))
			{
			  if(giveplayerid != INVALID_PLAYER_ID)
			  {
					GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					GetPlayerName(playerid, sendername, sizeof(sendername));
					playermoney = PlayerInfo[playerid][pBank] ;
					if (moneys > 0 && playermoney >= moneys)
					{
						PlayerInfo[playerid][pBank] -= moneys;
						PlayerInfo[giveplayerid][pBank] += moneys;
						format(string, sizeof(string), "  You have transferd $%d to %s's account", moneys, giveplayer,giveplayerid);
						PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
						SendClientMessage(playerid, 0xB4B5B7FF, string);
						format(string, sizeof(string), "  You have recieved $%d to into your account from %s", moneys, sendername, playerid);
						SendClientMessage(giveplayerid, 0xB4B5B7FF, string);
						format(string, sizeof(string), "%s transferd $%d to %s", sendername, moneys, giveplayer);
		        if(moneys >= 500000)
						{
							ABroadCast(COLOR_YELLOW,string,1);
						}
						printf("%s", string);
						PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
					}
					else
					{
						SendClientMessage(playerid, 0xB4B5B7FF, "  Invalid transaction amount.");
					}
				}
			}
			else
			{
				format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, 0xB4B5B7FF, string);
			}
		}
		return 1;
	}
	return 0;
}

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;
}

Код:
C:\Users\Nexotronix\Desktop\test server\filterscripts\bank.pwn(50) : error 017: undefined symbol "strtok"
C:\Users\Nexotronix\Desktop\test server\filterscripts\bank.pwn(50) : error 033: array must be indexed (variable "tmp")
C:\Users\Nexotronix\Desktop\test server\filterscripts\bank.pwn(55) : error 017: undefined symbol "PlayerInfo"
C:\Users\Nexotronix\Desktop\test server\filterscripts\bank.pwn(55) : warning 215: expression has no effect
C:\Users\Nexotronix\Desktop\test server\filterscripts\bank.pwn(55) : error 001: expected token: ";", but found "]"
C:\Users\Nexotronix\Desktop\test server\filterscripts\bank.pwn(55) : error 029: invalid expression, assumed zero
C:\Users\Nexotronix\Desktop\test server\filterscripts\bank.pwn(55) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)