2 errors [help]
#1

here is the script
Код:
#include <a_samp>
#include <dudb>
#include <dutils>
#include <utils>
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define COLOR_SYSTEM 0xEFEFF7AA
// VEHICLE LICENSE SYSTEM BY BLACKFOX - ICQ 480 814 388 - SLYFER1@******MAIL.COM
#define 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;
new pickup;
#if defined FILTERSCRIPT
/* DEFINES */
forward PlayerToPoint (Float:radi, playerid, Float:x, Float:y, Float:z);
new gLicenseC[MAX_PLAYERS];
new gLicenseF[MAX_PLAYERS];
new gLicenseB[MAX_PLAYERS];
new gLicenseZ[MAX_PLAYERS];
/*========*/
public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Filterscript Driving/Fly/Boat/Bike Scool System");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" FS LOADED.");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

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

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    new formatZ[256];
	  new playrname[MAX_PLAYER_NAME];
  	new connect[128];
  GetPlayerName(playerid, playrname, sizeof(playrname));
	format(connect, sizeof(connect), "%s.cer", playrname);
	if(fexist(connect))
	{
		gPlayerAccount[playerid] = 1;
		SendClientMessage(playerid, COLOR_YELLOW, "You are registered, please login with /login password");
		return 1;
	}
	else
	{
		gPlayerAccount[playerid] = 0;
		SendClientMessage(playerid, COLOR_YELLOW, "You are new here or not registered, please register with /register password");
	}
	  
    format(formatZ,sizeof(formatZ),"%s.lics.bfx",PlayerName(playerid));
    if(!udb_Exists(formatZ))
    {
    udb_Create(formatZ,"209010");
    }
  gLicenseC[playerid] = dUserINT(formatZ).("carlic");
  gLicenseF[playerid] = dUserINT(formatZ).("fluglic");
  gLicenseB[playerid] = dUserINT(formatZ).("bootlic");
  gLicenseZ[playerid] = dUserINT(formatZ).("bikelic");
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new formatZ2[256];
    OnPlayerUpdate(playerid);
  gPlayerLogged[playerid] = 0;
	  format(formatZ2,sizeof(formatZ2),"%s.lics.bfx",PlayerName(playerid));
  dUserSetINT(formatZ2).("carlic",gLicenseC[playerid]);
  dUserSetINT(formatZ2).("fluglic",gLicenseF[playerid]);
  dUserSetINT(formatZ2).("bootlic",gLicenseB[playerid]);
  dUserSetINT(formatZ2).("bikelic",gLicenseZ[playerid]);
    return 1;
}
stock PlayerName(playerid) {
 new name[255];
 GetPlayerName(playerid, name, 255);
 return name;
}
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 OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerPrivmsg(playerid, recieverid, text[])
{
    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, "	You are already logged in.");
				return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GREY, "	USAGE: /login [password]");
				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, "USAGE: /register [password]");
			return 1;
		}
		if (gPlayerAccount[playerid] == 1)
		{
			SendClientMessage(playerid, COLOR_GREY, "  That name is already registered");
			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.cer", playername);
		new File: file = fopen(string, io_read);
		if (file)
		{
			SendClientMessage(playerid, COLOR_GREY, "  That name is already registered");
			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, "Succesfully Registered!");
		SendClientMessage(playerid, COLOR_WHITE, "Next time you connect, type /login <password> to log in.");
		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, "  You are not Logged in !");
			}
		}
		return 1;
	}
//=================[Bank System]================================================================
  if(strcmp(cmd, "/bank", true) == 0 || strcmp(cmd, "/deposit", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(!PlayerToPoint(20.0,playerid,2313.0049,-3.5899,26.7422))
	    {
	      SendClientMessage(playerid, COLOR_GREY, "  You are not at the Bank !");
	      return 1;
	    }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /bank [amount]");
				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, "USAGE: /bank [amount]");
				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, "  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, COLOR_GRAD2, 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(cmd, "/withdraw", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(!PlayerToPoint(20.0,playerid,2313.0049,-3.5899,26.7422))
	    {
	      SendClientMessage(playerid, COLOR_GREY, "  You are not at the Bank !");
	      return 1;
	    }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /withdraw [amount]");
				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, "USAGE: /withdraw [amount]");
				format(string, sizeof(string), " You Have $%d in your account.", PlayerInfo[playerid][pBank]);
				SendClientMessage(playerid, COLOR_GRAD3, string);
				return 1;
			}
			if (cashdeposit > PlayerInfo[playerid][pBank] || cashdeposit < 1)
			{
				SendClientMessage(playerid, COLOR_GRAD2, "  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(cmd, "/balance", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if(!PlayerToPoint(20.0,playerid,2313.0049,-3.5899,26.7422))
	    {
	      SendClientMessage(playerid, COLOR_GREY, "  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(cmd, "/transfer", true) == 0 || strcmp(cmd, "/wiretransfer", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if(!PlayerToPoint(20.0,playerid,2313.0049,-3.5899,26.7422))
	    {
	      SendClientMessage(playerid, COLOR_GREY, "  You are not at the Bank !");
	      return 1;
	    }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /transfer [playerid/PartOfName] [amount]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "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, COLOR_GRAD1, string);
						format(string, sizeof(string), "  You have recieved $%d to into your account from %s", moneys, sendername, playerid);
						SendClientMessage(giveplayerid, COLOR_GRAD1, 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, COLOR_GRAD1, "  Invalid transaction amount.");
					}
				}
			}
			else
			{
				format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
//==========================[Enter and Exit]==========================================================================================================
soz for the split
Reply


Messages In This Thread
2 errors [help] - by sggassasin - 08.08.2009, 02:44
Re: 2 errors [help] - by sggassasin - 08.08.2009, 02:44
Re: 2 errors [help] - by sggassasin - 08.08.2009, 02:51

Forum Jump:


Users browsing this thread: 2 Guest(s)