SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 02/07/2012, 07:57 PM   #1
rabexann
Little Clucker
 
rabexann's Avatar
 
Join Date: May 2012
Posts: 34
Reputation: 0
Question Why won't this work?

Hi, I'm here because when I put the upcoming code in a FilterScript and compile it, I get no errors but when I'm on the server I try the commands and NONE of them work The FS loads correctly so I don't see why it doesn't work!!
ANY help would be greatly appreciated, thanks.
P.S. I know it's extremely long because i merged several other FSes so I wouldn't have a ton in the server Config.

Code:
#include <a_samp>
#define COLOR_PINK 0xFF66FFAA
#define lightgreen 0x38FF06FF
#define orange 0xFF9900AA
#define COLOR_LEMON 0xDDDD2357
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define DISTANCE_BETWEEN_PLAYERS 5  //The minimum distance between players to be able to rob
#define COLOR_ROB 0x00FFFFFF  //The color of the text send to the players when made a successfull rob
#define COLOR_FAIL 0x00FFFFFF //Color of the text displayed to the players when a rob has failed
#define COLOR_ERROR 0xFF0000FF  //Color of the text when there is an error
#define ROB_TIME 6500 //Time between rob commands to prevent spam (in milliseconds)
#define COLOR_FOUND 0xFFFF00AA //Color of the message if a hit was found in /hits
#define COLOR_MSG 0x00FFFFFF //Color of general messages
#define COLOR_ERROR 0xFF0000FF //Color of the message if there was an error
#define ANTISPAM_TIME 6 //The minimum time between /hit commands to prevent spam (in seconds)
#define COLOR_ERROR 0xFF0000FF //Color of the error messages
#define COLOR_MSG 0x00FFFFFF //Color of general messages
#define ANTISPAM_RAPE 5 //Minimum time between /rape commands (in seconds)
#define ANTISPAM_CURE 20 //Minimum time between /cure commands (in seconds)
#define CHLAMYDIA 3 //The interval which the player loses health with Chlamydia (in seconds)
#define GONORRHEA 2 //The interval which the player loses health with Gonorrhea (in seconds)
#define RAPE_DISTANCE 5.0 //Distance between players to be able to rape
#define NUMVALUES 4
#define GREY 0xAFAFAFAA
#define GREEN 0x33AA33AA
#define YELLOW 0xFFFF00AA
#define WHITE 0xFFFFFFAA
#define LIGHTBLUE 0x33CCFFAA
#define ORANGE 0xFF9900AA
#define SPECIAL_ACTION_PISSING 68
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_YELLOW 0xFFFF00AA
#include <Dini>
#define PlayerFile 	       		"Bank/%s.ini"
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA

public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid, COLOR_PINK,"To view commands, type /cmds into the chat!"); //Sends a message to a player that connects.
    SendClientMessage(playerid, orange,"Also please be sure to look at the /rules.");
    return 1;
}

public OnPlayerDisconnect(playerid)
{
	SendClientMessageToAll(lightgreen, "A player has disconnected from the server."); //Sends a message to all players when a player disconnects.
	return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/cmds", cmdtext, true)) //Sends a list of commands to any player that types /commands
    {
        SendClientMessage(playerid, lightgreen, "Server Commands: /anims, /stopanim, /placefw, /launchfw, /votekick, /vehiclemenu, /sellhouse, /trunk, /park, /sellcar ");
        SendClientMessage(playerid, lightgreen, "/bank, /banktele, /neon, /lshospital, /lsairport, /lspd, /lvbikejump, /lvpyramid, /lvsniperspot, /lvcrane");
        SendClientMessage(playerid, lightgreen, "/exitrace, /joinrace, /setplate, /findcar, /lock, /sellcarto, /housemenu, /afk, /back, /rob, /rape, /cureme, /hit, /hits, /cure");
        SendClientMessage(playerid, lightgreen, "*RCON ONLY* /healme, /armour, /createhouse, /buildrace, /startrace, /stoprace, /ghcmds, /cage, /races");
        return 1;
    }
    if (strcmp("/rules", cmdtext, true))
    {
        SendClientMessage(playerid, orange, "NO DEATH-MATCHING! Respect other players. Be nice to admins (We don't have to let you play ;D)");
        SendClientMessage(playerid, orange, "Please don't swear excessively. Cheats ARE allowed, but in moderation. Have Fun!!!");
        return 1;
    }
    if (strcmp("/races", cmdtext, true))
    {
		IsPlayerAdmin(playerid)
		SendClientMessage(playerid, COLOR_LEMON, "Server Races: BMX, Bridge, FagRace , Field , Firetruck, Jump!, LOL , LOL2 , LVAirRace , Monstertruck madness ");
		SendClientMessage(playerid, COLOR_LEMON, "Nrg, Snowy's First Race"); //Displays a list of currently made races.
		return 1;
}


public OnPlayerSpawn(playerid)
{
	GivePlayerMoney(playerid, 600000)//Gives the player 600k game cash when he/she spawns.
	new PlayerName[MAX_PLAYER_NAME],
    string[128];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    format(string, sizeof(string), "%s has spawned and recieved $600000.", PlayerName); //Sends a message to everyone saying "so & so has spawned and recieved 600k cash.
    SendClientMessageToAll(orange, string);
    return 1;
}

new robtime[MAX_PLAYERS];
new ID;


stock Float:GetDistanceBetweenPlayers(p1,p2){
	new Float:x1,Float:y1,Float:z1,Float:x3,Float:y3,Float:z3;
	if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2)){
		return -1.00;
	}
	GetPlayerPos(p1,x1,y1,z1);
	GetPlayerPos(p2,x3,y3,z3);
	return floatsqroot(floatpower(floatabs(floatsub(x3,x1)),2)+floatpower(floatabs(floatsub(y3,y1)),2)+floatpower(floatabs(floatsub(z3,z1)),2));
}

forward robtimer(id);

dcmd_rob(playerid, params[])
	{
		new pname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pname, sizeof(pname));
		if(!strlen(params))
		{
			SendClientMessage(playerid, COLOR_ERROR, "Correct usage: /rob [ID]");
		}
		else
		{
			ID = strval(params);
			if(robtime[playerid] == 0)
			{
				if(ID != playerid)
				{
					if(IsPlayerConnected(ID))
					{
						new oname[MAX_PLAYER_NAME];
						GetPlayerName(ID, oname, sizeof(oname));
						if(GetDistanceBetweenPlayers(playerid, ID) <= DISTANCE_BETWEEN_PLAYERS)
						{
							if(!GetPlayerVehicleID(ID) || GetPlayerVehicleID(ID) == GetPlayerVehicleID(ID))
							{
								if(GetPlayerMoney(ID) > 0)
								{
									new rob = random(11);
									if(rob == 1 || rob == 2 || rob == 10 || rob == 11)
									{
										new string[256];
										format(string, sizeof(string), "%s (%i) noticed you trying to rob him. Attempt failed!",oname, ID);
										SendClientMessage(playerid, COLOR_ROB, string);
										format(string, sizeof(string), "~w~%s Noticed you trying to rob him.~n~Attempt failed!.",oname, ID);
										GameTextForPlayer(playerid, string, 5000, 4);
										GetPlayerName(playerid,pname,sizeof(pname));
										format(string, sizeof(string), "You noticed %s (%i) trying to rob you. His attempt has failed!", pname, playerid);
										SendClientMessage(ID, COLOR_ROB, string);
										format(string, sizeof(string), "~w~You noticed %s trying to rob you.~n~His attempt has failed!", pname, playerid);
										GameTextForPlayer(ID, string, 5000, 4);
									}
									else if(rob == 3)
									{
										new pcash = GetPlayerMoney(ID);
										new robcash = random(pcash);
    									GivePlayerMoney(ID, -robcash);
										GivePlayerMoney(playerid, robcash);
										GetPlayerName(playerid, pname, sizeof(pname));
										new string[256];
										format(string, sizeof(string), "You have robbed $%i from %s (%i).", robcash, oname, ID);
										SendClientMessage(playerid, COLOR_ROB, string);
										format(string, sizeof(string), "~w~Robbed $%i from %s.", robcash, oname);
										GameTextForPlayer(playerid, string, 5000, 4);
										format(string, sizeof(string), "%s (%i) has robbed $%i from you.", pname, playerid, robcash);
										SendClientMessage(ID, COLOR_ROB, string);
										format(string, sizeof(string), "~w~%s has robbed $%i from you.", pname, robcash);
										GameTextForPlayer(ID, string, 5000, 4);
									}
									else if(rob == 4 || rob == 5 || rob == 8)
									{
										new pcash = GetPlayerMoney(ID);
										new robcash = random(pcash);
										new robcash2 = robcash-random(robcash);
    									GivePlayerMoney(ID, -robcash2);
										GivePlayerMoney(playerid, robcash2);
										new string[256];
										GetPlayerName(playerid, pname, sizeof(pname));
										format(string, sizeof(string), "You have robbed $%i from %s (%i).", robcash2, oname, ID);
										SendClientMessage(playerid, COLOR_ROB, string);
										format(string, sizeof(string), "~w~Robbed $%i from %s.", robcash2, oname);
										GameTextForPlayer(playerid, string, 5000, 4);
										format(string, sizeof(string), "%s (%i) has robbed $%i from you.", pname, playerid, robcash2);
										SendClientMessage(ID, COLOR_ROB, string);
										format(string, sizeof(string), "~w~%s has robbed $%i from you.", pname, robcash2);
										GameTextForPlayer(ID, string, 5000, 4);
									}
									else if(rob == 6 || rob == 7)
									{
										new pcash = GetPlayerMoney(ID);
										new robcash = random(pcash);
										new robcash2 = robcash-random(robcash);
										new robcash3 = robcash2-random(robcash2);
    									GivePlayerMoney(ID, -robcash3);
										GivePlayerMoney(playerid, robcash3);
										new string[256];
										GetPlayerName(playerid, pname, sizeof(pname));
										format(string, sizeof(string), "You have robbed $%i from %s (%i).", robcash3, oname, ID);
										SendClientMessage(playerid, COLOR_ROB, string);
										format(string, sizeof(string), "%s (%i) has robbed $%i from you.", pname, playerid, robcash3);
										SendClientMessage(ID, COLOR_ROB, string);
										format(string, sizeof(string), "~w~Robbed $%i from %s.", robcash3, oname);
										GameTextForPlayer(playerid, string, 5000, 4);
										format(string, sizeof(string), "~w~%s has robbed $%i from you.", pname, robcash3);
										GameTextForPlayer(ID, string, 5000, 4);
									}
									else
									{
										SetPlayerHealth(playerid, -69);
										new string[256];
										GetPlayerName(playerid, pname, sizeof(pname));
										format(string, sizeof(string), "Your hand has stuck to %s (%i)'s pocket. ", oname, ID);
										SendClientMessage(playerid, COLOR_FAIL, string);
										SendClientMessage(playerid, COLOR_FAIL, "He noticed it and ripped your arms off.");
										format(string, sizeof(string), "%s (%i)'s hand has stuck to your pocket while trying to rob you.", pname, playerid);
										SendClientMessage(ID, COLOR_FAIL, string);
										SendClientMessage(ID, COLOR_FAIL, "You noticed it and ripped his arms off.");
										format(string, sizeof(string), "*** %s (%i) has bled to death.", pname, playerid);
										SendClientMessageToAll(0x880000FF, string);
										format(string, sizeof(string), "~w~%s has ripped your arms off.", oname, ID);
										GameTextForPlayer(playerid, string, 5000, 4);
										format(string, sizeof(string), "~w~Ripped %s's arms off.", oname, ID);
										GameTextForPlayer(ID, string, 5000, 4);
									}
									robtime[playerid] = 1;
									SetTimerEx("robtimer", ROB_TIME, false, "i", playerid);
								}
								else
								{
									new string[256];
									format(string, sizeof(string), "%s (%i) has no money to rob!", oname, ID);
									SendClientMessage(playerid, COLOR_ERROR, string);
								}
							}
							else
							{
								new string[256];
								format(string, sizeof(string), "%s (%i) has to be in the same vehicle as you to be able to rob!", oname, ID);
								SendClientMessage(playerid, COLOR_ERROR, string);
							}
						}
						else
						{
							new string[256];
							format(string, sizeof(string), "%s (%i) is not close enough to rob.", oname, ID);
							SendClientMessage(playerid, COLOR_ERROR, string);
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_ERROR, "That player is not connected!");
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_ERROR, "You cannot rob yourself!");
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_ERROR, "Please wait before robbing someone again.");
			}
		}
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(rob, 3, cmdtext);
	return 0;
}
public robtimer(id)
{
	robtime[id] = 0;
}


new hit[MAX_PLAYERS];
new hiter[MAX_PLAYERS];
new ID;
new antispam[MAX_PLAYERS];


stock ReturnPlayerName(id)
{
	new tehname[MAX_PLAYER_NAME];
	GetPlayerName(id, tehname, sizeof(tehname));
	return tehname;
}


stock sscanf(string[], format[], {Float,_}:...)
{
	new
		formatPos = 0,
		stringPos = 0,
		paramPos = 2,
		paramCount = numargs();
	while (paramPos < paramCount && string[stringPos])
	{
		switch (format[formatPos++])
		{
			case '\0':
			{
				return 0;
			}
			case 'i', 'd':
			{
				new
					neg = 1,
					num = 0,
					ch = string[stringPos];
				if (ch == '-')
				{
					neg = -1;
					ch = string[++stringPos];
				}
				do
				{
					stringPos++;
					if (ch >= '0' && ch <= '9')
					{
						num = (num * 10) + (ch - '0');
					}
					else
					{
						return 1;
					}
				}
				while ((ch = string[stringPos]) && ch != ' ');
				setarg(paramPos, 0, num * neg);
			}
			case 'h', 'x':
			{
				new
					ch,
					num = 0;
				while ((ch = string[stringPos++]))
				{
					switch (ch)
					{
						case 'x', 'X':
						{
							num = 0;
							continue;
						}
						case '0' .. '9':
						{
							num = (num << 4) | (ch - '0');
						}
						case 'a' .. 'f':
						{
							num = (num << 4) | (ch - ('a' - 10));
						}
						case 'A' .. 'F':
						{
							num = (num << 4) | (ch - ('A' - 10));
						}
						case ' ':
						{
							break;
						}
						default:
						{
							return 1;
						}
					}
				}
				setarg(paramPos, 0, num);
			}
			case 'c':
			{
				setarg(paramPos, 0, string[stringPos++]);
			}
			case 'f':
			{
				new tmp[25];
				strmid(tmp, string, stringPos, stringPos+sizeof(tmp)-2);
				setarg(paramPos, 0, _:floatstr(tmp));
			}
			case 's', 'z':
			{
				new
					i = 0,
					ch;
				if (format[formatPos])
				{
					while ((ch = string[stringPos++]) && ch != ' ')
					{
						setarg(paramPos, i++, ch);
					}
					if (!i) return 1;
				}
				else
				{
					while ((ch = string[stringPos++]))
					{
						setarg(paramPos, i++, ch);
					}
				}
				stringPos--;
				setarg(paramPos, i, '\0');
			}
			default:
			{
				continue;
			}
		}
		while (string[stringPos] && string[stringPos] != ' ')
		{
			stringPos++;
		}
		while (string[stringPos] == ' ')
		{
			stringPos++;
		}
		paramPos++;
	}
	while (format[formatPos] == 'z') formatPos++;
	return format[formatPos];
}


dcmd_hit(playerid, params[])
{
	new amount;
	if(sscanf(params, "dd", ID, amount))
	{
		SendClientMessage(playerid, COLOR_ERROR, "USAGE: /hit [ID] [amount]");
	}
	else if(amount > 0)
	{
		if(IsPlayerConnected(ID))
		{
			if(GetPlayerMoney(playerid) >= amount)
			{
				if(antispam[playerid] == 0)
				{
					hit[ID] = amount;
					hiter[ID] = playerid;
					new string[256];
					format(string, sizeof(string), "You have placed a hit on %s (%i) for $%i", ReturnPlayerName(ID), ID, amount);
					SendClientMessage(playerid, COLOR_MSG, string);
					format(string, sizeof(string), "%s (%i) has placed a hit on %s (%i) for $%i", ReturnPlayerName(playerid), playerid, ReturnPlayerName(ID), ID, amount);
					SendClientMessageToAll(COLOR_MSG, string);
					antispam[playerid] = 1;
					SetTimerEx("antispamtimer", ANTISPAM_TIME*1000, false, "d", playerid);
				}
				else
				{
					SendClientMessage(playerid, COLOR_ERROR, "Please wait before placing another hit!");
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_ERROR, "You do not have enough money!");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_ERROR, "That player is not connected!");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_ERROR, "Minimum amount to hit a person with is $1!");
	}
	return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(hit, 3, cmdtext);

	if(!strcmp(cmdtext, "/hits", true))
	{
		new count = 0;
		SendClientMessage(playerid, COLOR_MSG, "Listing currently placed hits:");
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i) && hit[i] > 0)
			{
				new string[256];
				format(string, 256, "Hit on %s (%i) for $%i", ReturnPlayerName(i), i, hit[i]);
				SendClientMessage(playerid, COLOR_FOUND, string);
				count++
			}
		}
		if(count == 0)
		{
			SendClientMessage(playerid, COLOR_ERROR, "No hits placed at this time!");
		}
	}
	return 0;
}


public OnPlayerDeath(playerid, killerid, reason)
{
	if(reason <= 46 && hit[playerid] != 0)
	{
		new string[256];
		format(string, sizeof(string), "%s (%i) killed %s (%i) and recieved $%i for a completed hit", ReturnPlayerName(killerid), killerid, ReturnPlayerName(playerid), playerid, hit[playerid]);
		SendClientMessageToAll(COLOR_MSG, string);
		GivePlayerMoney(killerid, hit[playerid]);
		GivePlayerMoney(hiter[playerid], GetPlayerMoney(hiter[playerid])-hit[playerid]);
		hit[playerid] = 0;
	}
	else if(hit[playerid] != 0)
	{
		new string[256];
		format(string, sizeof(string), "The hit on %s (%i) has been cancelled (died)", ReturnPlayerName(playerid), playerid);
		SendClientMessageToAll(COLOR_MSG, string);
		hit[playerid] = 0;
	}
	return 1;
}


public OnPlayerDisconnect(playerid)
{
	if(hit[playerid] > 0)
	{
		new string[256];
		format(string, sizeof(string), "The hit on %s (%i) has been cancelled (disconnected)", ReturnPlayerName(playerid), playerid);
		SendClientMessageToAll(COLOR_MSG, string);
		hit[playerid] = 0;
	}
	return 1;
}

forward antispamtimer(id);

public antispamtimer(id)
{
	antispam[id] = 0;
}


stock Float:GetDistanceBetweenPlayers(p1,p2){
	new Float:x1,Float:y1,Float:z1,Float:x3,Float:y3,Float:z3;
	if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2)){
		return -1.00;
	}
	GetPlayerPos(p1,x1,y1,z1);
	GetPlayerPos(p2,x3,y3,z3);
	return floatsqroot(floatpower(floatabs(floatsub(x3,x1)),2)+floatpower(floatabs(floatsub(y3,y1)),2)+floatpower(floatabs(floatsub(z3,z1)),2));
}

new string[256];
new chlamydia[MAX_PLAYERS];
new gonorrhea[MAX_PLAYERS];
new rapespam[MAX_PLAYERS];
new curespam[MAX_PLAYERS];

stock ReturnPlayerName(id)
{
	new thename[MAX_PLAYER_NAME];
	GetPlayerName(id, thename, MAX_PLAYER_NAME);
	return thename;
}

dcmd_rape(playerid, params[])
{
	new ID = strval(params);
	if(!strlen(params))
	{
		SendClientMessage(playerid, COLOR_ERROR, "USAGE: /rape [ID]");
	}
	else
	{
		if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_ERROR, "That player is not connected!");
		if(ID == playerid) return SendClientMessage(playerid, COLOR_ERROR, "You cannot rape yourself!");
		if(rapespam[playerid] == 0)
		{
			if(GetDistanceBetweenPlayers(playerid,ID) > RAPE_DISTANCE) return SendClientMessage(playerid, COLOR_ERROR, "You are not close enough to eachother!");
			new raperand = random(5);
			if(raperand == 1 || raperand == 2)
			{
				format(string, sizeof(string), "%s (%i) noticed you trying to rape him", ReturnPlayerName(ID), ID);
				SendClientMessage(playerid, COLOR_MSG, string);
				format(string, sizeof(string), "%s (%i) tried to rape you", ReturnPlayerName(playerid), playerid);
				SendClientMessage(ID, COLOR_MSG, string);
			}
			else if(raperand == 3 || raperand == 5)
			{
				if(!chlamydia[ID])
				{
					chlamydia[ID] = 1;
					new Float:health;
					GetPlayerHealth(ID, health);
					SetPlayerHealth(ID, health-5-random(10));
					format(string, 256, "You raped and infected %s (%i) with Chlamydia", ReturnPlayerName(ID), ID);
					SendClientMessage(playerid, COLOR_MSG, string);
					format(string, sizeof(string), "%s (%i) raped you and infected you with Chlamydia", ReturnPlayerName(playerid), playerid);
					SendClientMessage(ID, COLOR_MSG, string);
				}
				else
				{
					new Float:health;
					GetPlayerHealth(ID, health);
					SetPlayerHealth(ID, health-5-random(15));
					format(string, 256, "You raped %s (%i)", ReturnPlayerName(ID), ID);
					SendClientMessage(playerid, COLOR_MSG, string);
					format(string, sizeof(string), "%s (%i) raped you", ReturnPlayerName(playerid), playerid);
					SendClientMessage(ID, COLOR_MSG, string);
				}
			}
			else if(raperand == 4)
			{
				if(!gonorrhea[ID])
				{
					gonorrhea[ID] = 1;
					new Float:health;
					GetPlayerHealth(ID, health);
					SetPlayerHealth(ID, health-5-random(20));
					format(string, 256, "You raped and infected %s (%i) with Gonorrhea", ReturnPlayerName(ID), ID);
					SendClientMessage(playerid, COLOR_MSG, string);
					format(string, sizeof(string), "%s (%i) raped you and infected you with Gonorrhea", ReturnPlayerName(playerid), playerid);
					SendClientMessage(ID, COLOR_MSG, string);
				}
				else
				{
					new Float:health;
					GetPlayerHealth(ID, health);
					SetPlayerHealth(ID, health-5-random(20));
					format(string, 256, "You raped %s (%i)", ReturnPlayerName(ID), ID);
					SendClientMessage(playerid, COLOR_MSG, string);
					format(string, sizeof(string), "%s (%i) raped you", ReturnPlayerName(playerid), playerid);
					SendClientMessage(ID, COLOR_MSG, string);
				}
			}
			rapespam[playerid] = 1;
			SetTimerEx("rapespamt", ANTISPAM_RAPE*1000, false, "i", playerid);
		}
		else
		{
		SendClientMessage(playerid, COLOR_ERROR, "Please wait before raping someone again!");
		}
	}
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(rape, 4, cmdtext);

	if(!strcmp(cmdtext, "/cure", true))
	{
		if(curespam[playerid] == 0)
		{
			if(chlamydia[playerid] || gonorrhea[playerid])
			{
				new randcure = random(3);
				if(randcure == 1 || randcure == 2)
				{
					SendClientMessage(playerid, COLOR_MSG, "You tried to cure yourself by poking yourself in random places with a needle but it failed");
				}
				else
				{
					SendClientMessage(playerid, COLOR_MSG, "You tried to cure yourself by poking yourself in random places with a needle and it worked!!");
					SendClientMessage(playerid, COLOR_MSG, "You are now cured from all diseases!");
					chlamydia[playerid] = 0;
					gonorrhea[playerid] = 0;
				}
				SetTimerEx("curespamt", ANTISPAM_CURE*1000, false, "i", playerid);
				curespam[playerid] = 1;
			}
			else
			{
			SendClientMessage(playerid, COLOR_ERROR, "You don't have any STDs to cure!");
			}
		}
		else
		{
		SendClientMessage(playerid, COLOR_ERROR, "Please wait before trying to cure yourself again!");
		}
		return 1;
	}

	return 0;
}

public OnFilterScriptInit()
{
	SetTimer("checkchlamy", CHLAMYDIA*1000, true);
	SetTimer("checkgono", GONORRHEA*1000, true);
}

public OnPlayerDeath(playerid, killerid, reason)
{
	chlamydia[playerid] = 0;
	gonorrhea[playerid] = 0;
}

forward checkchlamy();

public checkchlamy()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(chlamydia[i] == 1 && IsPlayerConnected(i))
		{
			new Float:health;
			GetPlayerHealth(i, health);
			SetPlayerHealth(i, health-5-random(10));
		}
	}
}

forward checkgono();

public checkgono()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(gonorrhea[i] == 1 && IsPlayerConnected(i))
		{
			new Float:health;
			GetPlayerHealth(i, health);
			SetPlayerHealth(i, health-5-random(20));
		}
	}
}

forward rapespamt(Id);

public rapespamt(Id)
{
	rapespam[Id] = 0;
}

forward curespamt(id);

public curespamt(id)
{
	curespam[id] = 0;
}

#include <a_samp>
#define FILTERSCRIPT
#define red 0xAA3333AA

//Sets the players health to full
{
    if(!strcmp("/healme", cmdtext, true))
    {
		if(IsPlayerAdmin(playerid))
		SetPlayerHealth(playerid, 100);
		SendClientMessage(playerid, red, "You have used the /healme command! Would you like to replace your armour?");
		SendClientMessage(playerid, red, "If you would like to, please type /armour.");
		return 1;
    }

	if(!strcmp("/armour", cmdtext, true))
	{
	    if(IsPlayerAdmin(playerid))
	    SetPlayerArmour(playerid, 100);
	    SendClientMessage(playerid, red, "You have successfully restored your armour!");
		return 1;
	}

new Votes = 0;
new Voted[MAX_PLAYERS];
new VoteActive;
new thingy;
new VPlayers;
new KickName[24];
new PlayerName[24];
new IDofotherplayer;
forward CountDownTimer(playerid);
new Count;
new Timer;
new Text:TCountDown;
new Text:VoteKick;
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" HERRRRRRTTTTTTT");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}
#endif

public OnPlayerConnect(playerid)
{
	Voted[playerid] = 0;
	return 1;
}
public CountDownTimer(playerid)
{
	new string[3];
	Count--;
	TextDrawDestroy(TCountDown);
	format(string,sizeof(string),"%d",Count);
	TCountDown = TextDrawCreate(300.0,300.0,string);

	TextDrawTextSize(TCountDown,0.7,3.0);
	TextDrawShowForAll(TCountDown);

	if(Count == 0)
	{
		KillTimer(Timer);
		KillTimer(thingy);
		TextDrawDestroy(TCountDown);
		TextDrawDestroy(VoteKick);
		Voted[playerid] = 0;
	}
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(votekick,8,cmdtext);
	dcmd(vote,4,cmdtext);
	dcmd(stopvote,8,cmdtext);
	return 0;
}
dcmd_stopvote(playerid,params[])
{
	#pragma unused params
	if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,LIGHTBLUE,"You are not an admin!");
	TextDrawDestroy(TCountDown);
	TextDrawDestroy(VoteKick);
	KillTimer(Timer);
	KillTimer(thingy);
	SendClientMessageToAll(0xFF0000FF,"An admin has stopped the vote kick.");
	return 1;
}
dcmd_votekick(playerid,params[])
{
	new id,n[24],on[24],str2[128],string[3];
	new tmp[256], tmp2[256], Index,str[128];
	VPlayers = GetPlayersOnServer()/2+1;
	if(GetPlayersOnServer() <= 2)
		return SendClientMessage(playerid,GREY,"There needs to be atleast 3 people online to use this command.");
	tmp = strtok(params,Index), tmp2 = strtok(params,Index),id = strval(tmp);
	if(IsPlayerAdmin(id)) return SendClientMessage(playerid,0xFF0000FF,"You cannot use the vote-kick feature on an admin!");
	if(VoteActive == 1) return SendClientMessage(playerid,0xFF0000FF,"There is already a votekick in proccess, please wait untill it is finished.");
	IDofotherplayer = id;
	GetPlayerName(playerid,n,24),GetPlayerName(id,on,24);
	Voted[playerid] = 1;
	KickName = on;
	PlayerName = n;
	if(!strlen(params)) return SendClientMessage(playerid,GREY,"USAGE: /votekick <ID> <Reason>");
	if(!IsPlayerConnected(id))return SendClientMessage(playerid,GREY,"You have entered an incorrect ID.");
	Votes = 1;
	VoteActive = 1;
	format(str2,sizeof(str2),"~r~Votekick on ~w~%s. ~r~%d/%d",PlayerName,Votes,VPlayers);
	VoteKick = TextDrawCreate(50.0,300.0,str2);
	TextDrawLetterSize(VoteKick,0.5,2.5);
	TextDrawShowForAll(VoteKick);
	thingy = SetTimer("VoteFail",21000,false);
	Timer = SetTimerEx("CountDownTimer",1000,true,"i",playerid);
	format(str,sizeof(str),"%s has started a votekick on %s. Reason: %s",n,on,params[2]);
	SendClientMessageToAll(0xFF0000FF,str);
	format(string,sizeof(string),"%d",Count);
	TCountDown = TextDrawCreate(300.0,300.0,string);
	Count = 21;
	return 1;
}
dcmd_vote(playerid,params[])
{
	#pragma unused params
	new str[128],name[24],str2[128];
	GetPlayerName(playerid,name,24);
	if(VoteActive == 0) return SendClientMessage(playerid,GREY,"There is no active vote kick on right now.");
	if(Voted[playerid] == 1) return SendClientMessage(playerid,LIGHTBLUE,"You have already voted!");
	KillTimer(thingy);
	thingy = SetTimer("VoteFail",21000,false);
	Votes++;
	Voted[playerid] = 1;
	format(str,sizeof(str),"%s has voted. %d/%d",name,Votes,VPlayers);
	SendClientMessageToAll(0xFF0000FF,str);
	TextDrawDestroy(VoteKick);
	format(str2,sizeof(str),"~r~Votekick on ~w~%s. ~r~%d/%d",KickName,Votes,VPlayers);
	TextDrawCreate(50.0,300,str2);
	TextDrawLetterSize(VoteKick,0.5,2.5);
	TextDrawShowForAll(VoteKick);
	KillTimer(Timer);
	Timer = SetTimer("CountDownTimer",1000,true);
	Count = 21;
	if(Votes == VPlayers)
	{
		format(str,sizeof(str),"%s has been kicked. %d/%d votes.",KickName,Votes,Votes);
		SendClientMessageToAll(0xFF0000FF,str);
		TextDrawDestroy(VoteKick);
		KillTimer(thingy);
		VoteActive = 0;
		Kick(IDofotherplayer);
	    return 1;
	}
	return 1;
}

forward VoteFail(playerid);
public VoteFail(playerid)
{
	Votes = 0;
	VoteActive = 0;
	Voted[playerid] = 0;
	SendClientMessageToAll(LIGHTBLUE,"There were not enough votes for the vote-kick.");
	TextDrawDestroy(VoteKick);
	return 1;
}

GetPlayersOnServer()
{
	new count;
	for(new x=0; x< MAX_PLAYERS; x++)
	{
 		if(IsPlayerConnected(x))
	  	{
			count++;
		}
	}
	return count;
}
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;
}

if (strcmp("/anims", cmdtext, true, 10) == 0)
        {
                SendClientMessage(playerid, COLOR_WHITE, "/relax | /scared | /sick | /wave | /spank | /taichi | /crossarms |");
		        SendClientMessage(playerid, COLOR_WHITE, "/wank | /kiss | /talk | /fuckyou | /cocaine | /rocky | /sit | /smoke |");
		        SendClientMessage(playerid, COLOR_WHITE, "/beach | /lookout | /circle | /medic | /chat | /die | /slapa | /rofl |");
		        SendClientMessage(playerid, COLOR_WHITE, "/glitched | /fakefire | /bomb | /robman | /handsup | /piss |");
		        SendClientMessage(playerid, COLOR_WHITE, "/getin | /skate | /cover | /fart | /vomit | /drunk | /bj1 | /bj2 | /bj3");
		        SendClientMessage(playerid, COLOR_WHITE, "/funnywalk | /kickass | /cell | /laugh | /eat | /injured |");
		        SendClientMessage(playerid, COLOR_WHITE, "/slapass | /laydown | /arrest | /laugh | /eat | /carjack | /strip | /strip2");
		        SendClientMessage(playerid, COLOR_WHITE, "/animswat | /animswat1 | /animswat2 | /animswat3 | /animswat4 | /animswat5");
		        SendClientMessage(playerid, COLOR_WHITE, "/animswat6 | /strip3 | /strip4 | /strip5 | /baseball | /baseball2");
        		return 1;
        }
        else if (strcmp(cmdtext, "/relax", true)==0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
            	ApplyAnimation(playerid,"BEACH", "bather", 4.0, 1, 0, 0, 0, 0);
                }
            return 1;
        }
        else if (strcmp(cmdtext, "/handsup", true)==0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
           		SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
                }
       		return 1;
        }
        else if (strcmp(cmdtext, "/bomb", true)==0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
            	ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
                }
            return 1;
        }
        else if (strcmp(cmdtext, "/robman", true)==0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
            	ApplyAnimation(playerid, "SHOP", "ROB_Loop_Threat", 4.0, 1, 0, 0, 0, 0);
                }
            return 1;
        }
        else if (strcmp(cmdtext, "/wank", true)==0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
            	ApplyAnimation(playerid,"PAULNMAC", "wank_loop", 1.800001, 1, 0, 0, 1, 600);
                }
            return 1;
        }
        else if (strcmp(cmdtext, "/crossarms", true)==0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
            	ApplyAnimation(playerid,"PAULNMAC", "wank_loop", 1.800001, 1, 0, 0, 1, 600);
                }
            return 1;
        }
        else if (strcmp(cmdtext, "/taichi", true)==0)
        {
			if (GetPlayerState(playerid)== 1)
            	{
            	ApplyAnimation(playerid,"PARK","Tai_Chi_Loop",4.0,1,0,0,0,0);
                }
            return 1;
        }
        else if (strcmp(cmdtext, "/spank", true)==0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
            	ApplyAnimation(playerid, "SWEET", "sweet_ass_slap", 4.0, 0, 0, 0, 0, 0);
                }
            return 1;
        }
        else if (strcmp(cmdtext, "/wave", true)==0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
            	ApplyAnimation(playerid, "ON_LOOKERS", "wave_loop", 4.0, 1, 0, 0, 0, 0);
                }
            return 1;
        }
        else if (strcmp(cmdtext, "/sick", true)==0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
            	ApplyAnimation(playerid, "FOOD", "EAT_Vomit_P", 3.0, 0, 0, 0, 0, 0);
                }
            return 1;
        }
        else if (strcmp(cmdtext, "/scared", true)==0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
            	ApplyAnimation(playerid, "ped", "cower", 3.0, 1, 0, 0, 0, 0);
                }
            return 1;
        }
        else if (strcmp(cmdtext, "/talk", true)==0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
             	ApplyAnimation(playerid,"PED","IDLE_CHAT",1.800001, 1, 1, 1, 1, 13000);
                }
            return 1;
        }
        else if (strcmp(cmdtext, "/kiss", true)==0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
           		ApplyAnimation(playerid,"KISSING", "Grlfrd_Kiss_02", 1.800001, 1, 0, 0, 1, 600);
                }
            return 1;
        }
        else if (strcmp(cmdtext, "/sit", true)==0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
             	ApplyAnimation(playerid,"INT_OFFICE", "OFF_Sit_Bored_Loop", 1.800001, 1, 0, 0, 1, 600);
                }
            return 1;
        }
        else if (strcmp(cmdtext, "/fuckyou", true)==0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
             	ApplyAnimation(playerid,"ped", "fucku", 4.1, 0, 1, 1, 1, 1 );
                }
            return 1;
        }
        else if (strcmp(cmdtext, "/cocaine", true)==0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
             	ApplyAnimation(playerid,"CRACK", "crckdeth2", 1.800001, 1, 0, 0, 1, 600);
                }
            return 1;
        }
        else if (strcmp(cmdtext, "/rocky", true)==0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
             	ApplyAnimation(playerid,"GYMNASIUM", "GYMshadowbox", 1.800001, 1, 0, 0, 1, 600);
                }
            return 1;
        }
        else if (strcmp(cmdtext, "/smoke", true)==0)
        {
  			if (GetPlayerState(playerid)== 1)
            	{
    			ApplyAnimation(playerid,"SMOKING", "M_smklean_loop", 4.0, 1, 0, 0, 0, 0);
                }
            return 1;
        }
        else if (strcmp("/beach", cmdtext, true, 10) == 0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
             	ApplyAnimation(playerid,"BEACH","SitnWait_loop_W",4.1,0,1,1,1,1);
                }
        	return 1;
        }
        else if (strcmp("/lookout", cmdtext, true, 10) == 0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
           		ApplyAnimation(playerid,"ON_LOOKERS","lkup_in",4.1,0,1,1,1,1);
            	}
         	return 1;
        }
        else if (strcmp("/circle", cmdtext, true, 10) == 0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
             	ApplyAnimation(playerid,"CHAINSAW","CSAW_Hit_2",4.1,0,1,1,1,1);
                }
         	return 1;
        }
        else if (strcmp("/medic", cmdtext, true, 10) == 0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
             	ApplyAnimation(playerid,"MEDIC","CPR",4.1,0,1,1,1,1);
                }
  			return 1;
        }
        else if (strcmp("/chat", cmdtext, true, 10) == 0)
        {
      		if (GetPlayerState(playerid)== 1)
            	{
             	ApplyAnimation(playerid,"PED","IDLE_CHAT",4.1,0,1,1,1,1);
                }
     		return 1;
        }
        else if (strcmp("/die", cmdtext, true, 10) == 0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
             	ApplyAnimation(playerid,"PED","BIKE_fallR",4.1,0,1,1,1,1);
                }
        	return 1;
        }
        else if (strcmp("/slapa", cmdtext, true, 10) == 0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
             	ApplyAnimation(playerid,"PED","BIKE_elbowL",4.1,0,1,1,1,1);
                }
         	return 1;
        }
        else if (strcmp("/rofl", cmdtext, true, 10) == 0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
             	ApplyAnimation(playerid,"PED","Crouch_Roll_L",4.1,0,1,1,1,1);
                }
         	return 1;
        }
        else if (strcmp("/glitched", cmdtext, true, 10) == 0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
             	ApplyAnimation(playerid,"TATTOOS","TAT_Sit_Out_O",4.1,0,1,1,1,1);
                }
         	return 1;
        }
        else if (strcmp("/fakefire", cmdtext, true, 10) == 0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
             	ApplyAnimation(playerid,"SILENCED","SilenceCrouchfire",4.1,0,1,1,1,1);
                }
         	return 1;
        }
        else if (strcmp("/fart", cmdtext, true, 10) == 0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
             	PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
                }
   			return 1;
        }
        else if (strcmp("/vomit", cmdtext, true) == 0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
                ApplyAnimation(playerid, "FOOD", "EAT_Vomit_P", 3.0, 0, 0, 0, 0, 0); // Vomit BAH!
                PlayerPlaySound(playerid, 1169, 0.0, 0.0, 0.0);
        		}
        	return 1;
        }
        else if (strcmp("/drunk", cmdtext, true, 10) == 0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
             	ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,0,1,1,1,1);
                }
         	return 1;
        }
        else if (strcmp("/getin", cmdtext, true) == 0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
             	ApplyAnimation(playerid,"NEVADA","NEVADA_getin",4.1,0,1,1,1,1);
        		}
        	return 1;
    	}
        else if (strcmp("/piss", cmdtext, true) == 0)
    	{
            if (GetPlayerState(playerid)== 1)
            	{
             	SetPlayerSpecialAction(playerid, SPECIAL_ACTION_PISSING);
        		}
          	return 1;
    	}
        else if (strcmp("/funnywalk", cmdtext, true) == 0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
             	ApplyAnimation(playerid,"WUZI","Wuzi_Walk",4.1,0,1,1,1,1);
                }
         	return 1;
    	}
        else if (strcmp("/kickass", cmdtext, true) == 0)
        {
        	if (GetPlayerState(playerid)== 1)
            	{
            	ApplyAnimation(playerid,"FIGHT_E","Hit_fightkick",4.1,0,1,1,1,1);
        		}
        	return 1;
    	}
    	if(strcmp("/cell", cmdtext, true) == 0)
        		{
                SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
    			return 1;
    			}
    	if (strcmp("/laugh", cmdtext, true) == 0)
        {
        	ApplyAnimation(playerid, "RAPPING", "Laugh_01", 4.0, 0, 0, 0, 0, 0); // Laugh
         	return 1;
        }
    	if (strcmp("/eat", cmdtext, true) == 0)
   			{
      		ApplyAnimation(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0); // Eat Burger
        	return 1;
        	}
    	if(strcmp("/injured", cmdtext, true) == 0)
        	{
         	ApplyAnimation(playerid, "SWEET", "Sweet_injuredloop", 4.0, 1, 0, 0, 0, 0);
          	return 1;
    		}
    	if (strcmp("/slapass", cmdtext, true) == 0)
        	{
            ApplyAnimation(playerid, "SWEET", "sweet_ass_slap", 4.0, 0, 0, 0, 0, 0); // Ass Slapping
            return 1;
        	}
    	if (strcmp("/laydown", cmdtext, true) == 0)
        	{
            ApplyAnimation(playerid,"BEACH", "bather", 4.0, 1, 0, 0, 0, 0); // Lay down
            return 1;
        	}
    	if (strcmp("/arrest", cmdtext, true) == 0)
        	{
            ApplyAnimation(playerid,"ped", "ARRESTgun", 4.0, 0, 1, 1, 1, -1); // Gun Arrest
            return 1;
        	}
    	if(strcmp("/carjack", cmdtext, true) == 0)
        	{
            ApplyAnimation(playerid,"PED","CAR_jackedLHS",4.0,0,1,1,1,0);
            return 1;
    		}
    	else if (strcmp(cmdtext, "/stopanim", true)==0)
        	{
        	ClearAnimations(playerid);
            return 1;
        	}
        if(strcmp("/bj1", cmdtext, true) == 0)
        	{
            ApplyAnimation(playerid,"BLOWJOBZ","BJ_STAND_END_W",4.0,0,1,1,1,0);
            return 1;
    		}
    	if(strcmp("/bj2", cmdtext, true) == 0)
    		{
            ApplyAnimation(playerid,"BLOWJOBZ","BJ_STAND_END_P",4.0,0,1,1,1,0);
            return 1;
    		}
    	if(strcmp("/bj3", cmdtext, true) == 0)
  			{
            ApplyAnimation(playerid,"BLOWJOBZ","BJ_STAND_LOOP_W",4.0,0,1,1,1,0);
            return 1;
    		}
    	if(strcmp("/animswat", cmdtext, true) == 0)
    		{
            ApplyAnimation(playerid,"SWAT","gnstwall_injurd",4.0,0,1,1,1,0);
            return 1;
    	}
    	if(strcmp("/animswat2", cmdtext, true) == 0)
    		{
            ApplyAnimation(playerid,"SWAT","JMP_Wall1m_180",4.0,0,1,1,1,0);
            return 1;
    		}
    	if(strcmp("/animswat3", cmdtext, true) == 0)
    		{
            ApplyAnimation(playerid,"SWAT","Rail_fall",4.0,0,1,1,1,0);
            return 1;
    		}
    	if(strcmp("/animswat4", cmdtext, true) == 0)
    		{
            ApplyAnimation(playerid,"SWAT","Rail_fall_crawl",4.0,0,1,1,1,0);
            return 1;
    		}
    	if(strcmp("/animswat5", cmdtext, true) == 0)
    		{
            ApplyAnimation(playerid,"SWAT","swt_breach_01",4.0,0,1,1,1,0);
            return 1;
    		}
    	if(strcmp("/animswat6", cmdtext, true) == 0)
    		{
            ApplyAnimation(playerid,"SWAT","swt_breach_02",4.0,0,1,1,1,0);
            return 1;
    		}
    	if(strcmp("/strip", cmdtext, true) == 0)
  			{
            ApplyAnimation(playerid,"STRIP","strip_A",4.0,0,1,1,1,0);
            return 1;
    		}
    	if(strcmp("/strip2", cmdtext, true) == 0)
    		{
            ApplyAnimation(playerid,"STRIP","strip_B",4.0,0,1,1,1,0);
            return 1;
    		}
    	if(strcmp("/strip3", cmdtext, true) == 0)
    		{
            ApplyAnimation(playerid,"STRIP","strip_C",4.0,0,1,1,1,0);
            return 1;
    		}
    	if(strcmp("/strip4", cmdtext, true) == 0)
    		{
            ApplyAnimation(playerid,"STRIP","strip_D",4.0,0,1,1,1,0);
            return 1;
    		}
    	if(strcmp("/stri5", cmdtext, true) == 0)
    		{
            ApplyAnimation(playerid,"STRIP","strip_E",4.0,0,1,1,1,0);
            return 1;
    		}
    	if(strcmp("/Baseball", cmdtext, true) == 0)
    		{
            ApplyAnimation(playerid,"BASEBALL","Bat_1",4.0,0,1,1,1,0);
            return 1;
    		}
    	if(strcmp("/baseball2", cmdtext, true) == 0)
    		{
            ApplyAnimation(playerid,"BASEBALL","Bat_2",4.0,0,1,1,1,0);
            return 1;
    		}

enum PLAYER_MAIN {
    Deposit,
};
new pInfo[MAX_PLAYERS][PLAYER_MAIN];
new GetinBank;
new GetoutBank;
new chosenpid;
public OnFilterScriptInit()
{
print("\n**************");
print("*EBank Loaded*");
print("**************\n");
GetinBank = CreatePickup(1318, 1, 1481.283813, -1770.431152, 18.795755, 0);
GetoutBank = CreatePickup(1318, 1, 2304.675537, -16.035686, 26.742187, 0);
SetTimer("CallConnect",1,0);
return 1;
}
forward CallConnect(playerid);
public CallConnect(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
OnPlayerConnect(i);
}
return 1;
}
public OnPlayerConnect(playerid)
{
	SendClientMessage(playerid,COLOR_YELLOW,"This Server Use Etch's EBank");
    SetPlayerMapIcon(playerid, 12, 1481.283813, -1770.431152, 18.795755, 52, 1);
  	new file[100],Name[MAX_PLAYER_NAME]; GetPlayerName(playerid,Name,sizeof(Name)); format(file,sizeof(file),PlayerFile,Name);
	if(!dini_Exists(file)) {
		dini_Create(file);
		dini_IntSet(file,"Deposit",pInfo[playerid][Deposit]);
	}
	else if(dini_Exists(file))
	{
	pInfo[playerid][Deposit] = dini_Int(file,"Deposit");
	}
	return 1;
}

public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid,pickupid)
{
if(pickupid == GetinBank)
{
SetPlayerPos(playerid,2313,-4, 27);
SendClientMessage(playerid,COLOR_YELLOW,"Type /bank");
SetCameraBehindPlayer(playerid);
return 0;
}
if(pickupid == GetoutBank)
{
SetPlayerPos(playerid,1481.130371,-1763.401000, 18.795755);
SetPlayerFacingAngle(playerid,0.0);
SetCameraBehindPlayer(playerid);
return 0;
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
 	new file[100],Name[MAX_PLAYER_NAME]; GetPlayerName(playerid,Name,sizeof(Name)); format(file,sizeof(file),PlayerFile,Name);
	dini_IntSet(file,"Deposit",pInfo[playerid][Deposit]);
	return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 1122) //deposit
    {
 		new file[100],Name[MAX_PLAYER_NAME]; GetPlayerName(playerid,Name,sizeof(Name)); format(file,sizeof(file),PlayerFile,Name);
        if(!response) return ShowPlayerDialog(playerid,1125,DIALOG_STYLE_LIST,"Bank","Deposit\nWithdraw\nBalance\nTransfer","Select","Cancel");
        else if(strval(inputtext) > GetPlayerMoney(playerid)) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount!");
        else if(!IsNumeric(inputtext))
        {
        new string[128];
        format(string,sizeof(string),"Your Curret Balance Is : %d\nEnter The Amount You Want To Deposit Below :",pInfo[playerid][Deposit]);
       	ShowPlayerDialog(playerid,1122,DIALOG_STYLE_INPUT,"Deposit",string,"Deposit","Back");
        SendClientMessage(playerid,COLOR_RED,"Please Use Numbers");
        }
		else
		{
  		GivePlayerMoney(playerid,-strval(inputtext));
		pInfo[playerid][Deposit] += strval(inputtext);
		new string[128];
		format(string,sizeof(string),"You Have Deposited : %d$",strval(inputtext));
		SendClientMessage(playerid,COLOR_YELLOW,string);
		dini_IntSet(file,"Deposit",pInfo[playerid][Deposit]);
		new string2[128]; format(string2,128,"Your New Balance Is : %d$",pInfo[playerid][Deposit]);
		SendClientMessage(playerid,COLOR_YELLOW,string2);
		ShowPlayerDialog(playerid,1125,DIALOG_STYLE_LIST,"Bank","Deposit\nWithdraw\nBalance\nTransfer","Select","Cancel");
		}
		return 1;
    }
	if(dialogid == 1123) //withdraw
	{
  		new file[100],Name[MAX_PLAYER_NAME]; GetPlayerName(playerid,Name,sizeof(Name)); format(file,sizeof(file),PlayerFile,Name);
     	if(!response) return ShowPlayerDialog(playerid,1125,DIALOG_STYLE_LIST,"Bank","Deposit\nWithdraw\nBalance\nTransfer","Select","Cancel");
     	else if(strval(inputtext) > pInfo[playerid][Deposit]) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount In Bank!");
        else if(!IsNumeric(inputtext))
        {
        new string[128];
        format(string,sizeof(string),"Your Current Balance Is :%d\nEnter The Amount You Want To Withdraw Below :",pInfo[playerid][Deposit]);
        ShowPlayerDialog(playerid,1123,DIALOG_STYLE_INPUT,"Withdraw",string,"Withdraw","Back");
        SendClientMessage(playerid,COLOR_RED,"Please Use Numbers");
        }
		else
		{
		GivePlayerMoney(playerid,strval(inputtext));
		pInfo[playerid][Deposit] -= strval(inputtext);
		new string[128];
		format(string,sizeof(string),"You Have Withdrawed : %d$",strval(inputtext));
		SendClientMessage(playerid,COLOR_YELLOW,string);
		dini_IntSet(file,"Deposit",pInfo[playerid][Deposit]);
		new string2[128]; format(string2,128,"Your New Balance Is : %d$",pInfo[playerid][Deposit]);
		SendClientMessage(playerid,COLOR_YELLOW,string2);
		ShowPlayerDialog(playerid,1125,DIALOG_STYLE_LIST,"Bank","Deposit\nWithdraw\nBalance\nTransfer","Select","Cancel");
		}
		return 1;
	}
	if(dialogid == 1124)
	{
	if(!response) return ShowPlayerDialog(playerid,1125,DIALOG_STYLE_LIST,"Bank","Deposit\nWithdraw\nBalance\nTransfer","Select","Cancel");
	else
	{
    ShowPlayerDialog(playerid,1125,DIALOG_STYLE_LIST,"Bank","Deposit\nWithdraw\nBalance\nTransfer","Select","Cancel");
    }
    return 1;
    }
    if(dialogid == 1130) //transfer (choose playerid)
	{
     	if(!response) return ShowPlayerDialog(playerid,1125,DIALOG_STYLE_LIST,"Bank","Deposit\nWithdraw\nBalance\nTransfer","Select","Cancel");
     	else if(strval(inputtext) == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"Player Not Online");
        else if(!IsNumeric(inputtext))
        {
        new string[128];
	    format(string,sizeof(string),"Your Current Balance Is :%d$\nEnter The Player ID You Want To Transfer To Below :",pInfo[playerid][Deposit]);
	    ShowPlayerDialog(playerid,1130,DIALOG_STYLE_INPUT,"Transfer",string,"Next","Back");
        SendClientMessage(playerid,COLOR_RED,"Please Use ID Not Name");
        }
		else
		{
		chosenpid = strval(inputtext);
		new string[128];
		format(string,sizeof(string),"Balance : %d\nChosen Player ID : %d\nNow Enter The Amount You Want To Transfer",pInfo[playerid][Deposit],chosenpid);
		ShowPlayerDialog(playerid,1131,DIALOG_STYLE_INPUT,"Transfer",string,"Transfer","Back");
		}
		return 1;
	}
	if(dialogid == 1131) //transfer (choose amount)
	{
  		new file[100],Name[MAX_PLAYER_NAME]; GetPlayerName(playerid,Name,sizeof(Name)); format(file,sizeof(file),PlayerFile,Name);
     	if(!response) return ShowPlayerDialog(playerid,1125,DIALOG_STYLE_LIST,"Bank","Deposit\nWithdraw\nBalance\nTransfer","Select","Cancel");
     	else if(strval(inputtext) > pInfo[playerid][Deposit]) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount In Bank To Transfer");
        else if(!IsNumeric(inputtext))
        {
        new string[128];
		format(string,sizeof(string),"Chosen Player ID : %d\nNow Enter The Amount You Want To Transfer",chosenpid);
		ShowPlayerDialog(playerid,1131,DIALOG_STYLE_INPUT,"Transfer",string,"Transfer","Back");
        SendClientMessage(playerid,COLOR_RED,"Please Use Numbers");
        }
		else
		{
		pInfo[playerid][Deposit] -= strval(inputtext);
		pInfo[chosenpid][Deposit] += strval(inputtext);
		new string[128];
		format(string,sizeof(string),"You Transfered %d$ To ID %d Bank Account",strval(inputtext),chosenpid);
		SendClientMessage(playerid,COLOR_YELLOW,string);
		dini_IntSet(file,"Deposit",pInfo[playerid][Deposit]);
		new string2[128]; format(string2,128,"Your New Balance Is : %d$",pInfo[playerid][Deposit]);
		SendClientMessage(playerid,COLOR_YELLOW,string2);
		new string3[128]; format(string3,128,"ID : %d Transfered %d$ To Your Bank Account",playerid,strval(inputtext));
		SendClientMessage(chosenpid,COLOR_YELLOW,string3);
		new string4[128]; format(string4,128,"Your New Balance : %d$",pInfo[chosenpid][Deposit]);
		SendClientMessage(chosenpid,COLOR_YELLOW,string4);
		ShowPlayerDialog(playerid,1125,DIALOG_STYLE_LIST,"Bank","Deposit\nWithdraw\nBalance\nTransfer","Select","Cancel");
		}
		return 1;
	}
	if(dialogid == 1125 && response) // /bank
		 {
		 	switch(listitem)
	    	{
	        	case 0:
		        {
		            new string[128];
		            format(string,sizeof(string),"Your Curret Balance Is : %d$\nEnter The Amount You Want To Deposit Below :",pInfo[playerid][Deposit]);
	              	ShowPlayerDialog(playerid,1122,DIALOG_STYLE_INPUT,"Deposit",string,"Deposit","Back");

	 			}
	 			case 1:
		        {
		            new string[128];
		            format(string,sizeof(string),"Your Current Balance Is :%d\nEnter The Amount You Want To Withdraw Below :",pInfo[playerid][Deposit]);
		            ShowPlayerDialog(playerid,1123,DIALOG_STYLE_INPUT,"Withdraw",string,"Withdraw","Back");
	 			}
	 			case 2:
		        {
	              	new string[128];
					format(string,sizeof(string),"Your Balance Is %d$",pInfo[playerid][Deposit]);
					ShowPlayerDialog(playerid,1124,DIALOG_STYLE_MSGBOX,"Balance",string,"Ok","Back");
	 			}
	 			case 3:
		        {
					new string[128];
		            format(string,sizeof(string),"Your Current Balance Is :%d$\nEnter The Player ID You Want To Transfer To Below :",pInfo[playerid][Deposit]);
		            ShowPlayerDialog(playerid,1130,DIALOG_STYLE_INPUT,"Transfer",string,"Next","Back");
	 			}
	 		}
	 	}
	return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(bank,4,cmdtext);
dcmd(banktele,8,cmdtext);
return 0;
}
dcmd_bank(playerid,params[])
{
#pragma unused params
if(!IsPlayerInRangeOfPoint(playerid,15.0,2313,-4, 27)) return SendClientMessage(playerid,COLOR_RED,"You Have To Be In The Bank");
else
{
ShowPlayerDialog(playerid,1125,DIALOG_STYLE_LIST,"Bank","Deposit\nWithdraw\nBalance\nTransfer","Select","Cancel");
}
return 1;
}
dcmd_banktele(playerid,params[])
{
#pragma unused params
SetPlayerPos(playerid,1481.049804,-1745.565673,13.667258);
SendClientMessage(playerid,COLOR_YELLOW,"Welcome To Bank");
SetPlayerFacingAngle(playerid,180.0);
SetCameraBehindPlayer(playerid);
return 1;
}


//------------------[SSCANF]-------------------------------------
stock sscanf(string[], format[], {Float,_}:...)
{
	#if defined isnull
		if (isnull(string))
	#else
		if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
	#endif
		{
			return format[0];
		}
	#pragma tabsize 4
	new
		formatPos = 0,
		stringPos = 0,
		paramPos = 2,
		paramCount = numargs(),
		delim = ' ';
	while (string[stringPos] && string[stringPos] <= ' ')
	{
		stringPos++;
	}
	while (paramPos < paramCount && string[stringPos])
	{
		switch (format[formatPos++])
		{
			case '\0':
			{
				return 0;
			}
			case 'i', 'd':
			{
				new
					neg = 1,
					num = 0,
					ch = string[stringPos];
				if (ch == '-')
				{
					neg = -1;
					ch = string[++stringPos];
				}
				do
				{
					stringPos++;
					if ('0' <= ch <= '9')
					{
						num = (num * 10) + (ch - '0');
					}
					else
					{
						return -1;
					}
				}
				while ((ch = string[stringPos]) > ' ' && ch != delim);
				setarg(paramPos, 0, num * neg);
			}
			case 'h', 'x':
			{
				new
					num = 0,
					ch = string[stringPos];
				do
				{
					stringPos++;
					switch (ch)
					{
						case 'x', 'X':
						{
							num = 0;
							continue;
						}
						case '0' .. '9':
						{
							num = (num << 4) | (ch - '0');
						}
						case 'a' .. 'f':
						{
							num = (num << 4) | (ch - ('a' - 10));
						}
						case 'A' .. 'F':
						{
							num = (num << 4) | (ch - ('A' - 10));
						}
						default:
						{
							return -1;
						}
					}
				}
				while ((ch = string[stringPos]) > ' ' && ch != delim);
				setarg(paramPos, 0, num);
			}
			case 'c':
			{
				setarg(paramPos, 0, string[stringPos++]);
			}
			case 'f':
			{

				new changestr[16], changepos = 0, strpos = stringPos;
				while(changepos < 16 && string[strpos] && string[strpos] != delim)
				{
					changestr[changepos++] = string[strpos++];
    				}
				changestr[changepos] = '\0';
				setarg(paramPos,0,_:floatstr(changestr));
			}
			case 'p':
			{
				delim = format[formatPos++];
				continue;
			}
			case '\'':
			{
				new
					end = formatPos - 1,
					ch;
				while ((ch = format[++end]) && ch != '\'') {}
				if (!ch)
				{
					return -1;
				}
				format[end] = '\0';
				if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
				{
					if (format[end + 1])
					{
						return -1;
					}
					return 0;
				}
				format[end] = '\'';
				stringPos = ch + (end - formatPos);
				formatPos = end + 1;
			}
			case 'u':
			{
				new
					end = stringPos - 1,
					id = 0,
					bool:num = true,
					ch;
				while ((ch = string[++end]) && ch != delim)
				{
					if (num)
					{
						if ('0' <= ch <= '9')
						{
							id = (id * 10) + (ch - '0');
						}
						else
						{
							num = false;
						}
					}
				}
				if (num && IsPlayerConnected(id))
				{
					setarg(paramPos, 0, id);
				}
				else
				{
					#if !defined foreach
						#define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
						#define __SSCANF_FOREACH__
					#endif
					string[end] = '\0';
					num = false;
					new
						name[MAX_PLAYER_NAME];
					id = end - stringPos;
					foreach (Player, playerid)
					{
      GetPlayerName(playerid, name, sizeof (name));
						if (!strcmp(name, string[stringPos], true, id))
						{
							setarg(paramPos, 0, playerid);
							num = true;
							break;
						}
					}
					if (!num)
					{
						setarg(paramPos, 0, INVALID_PLAYER_ID);
					}
					string[end] = ch;
					#if defined __SSCANF_FOREACH__
						#undef foreach
						#undef __SSCANF_FOREACH__
					#endif
				}
				stringPos = end;
			}
			case 's', 'z':
			{
				new
					i = 0,
					ch;
				if (format[formatPos])
				{
					while ((ch = string[stringPos++]) && ch != delim)
					{
						setarg(paramPos, i++, ch);
					}
					if (!i)
					{
						return -1;
					}
				}
				else
				{
					while ((ch = string[stringPos++]))
					{
						setarg(paramPos, i++, ch);
					}
				}
				stringPos--;
				setarg(paramPos, i, '\0');
			}
			default:
			{
				continue;
			}
		}
		while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
		{
			stringPos++;
		}
		while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
		{
			stringPos++;
		}
		paramPos++;
	}
	do
	{
		if ((delim = format[formatPos++]) > ' ')
		{
			if (delim == '\'')
			{
				while ((delim = format[formatPos++]) && delim != '\'') {}
			}
			else if (delim != 'z')
			{
				return delim;
			}
		}
	}
	while (delim > ' ');
	return 0;
}
stock IsNumeric(string[])
{
	for (new i = 0, j = strlen(string); i < j; i++)
	{
		if (string[i] > '9' || string[i] < '0') return 0;
	}
	return 1;
}

return 0;
}
#endif
__________________
R.I.P. Edward Khil..
We will miss
Quote:
Trololololololo
rabexann is offline   Reply With Quote
Old 02/07/2012, 08:05 PM   #2
Toreno
Gangsta
 
Join Date: Nov 2010
Posts: 725
Reputation: 41
Default Re: Why won't this work?

This script is messed up! You're having two OnPlayerCommandText publics and commands inside which is wrong when using dcmd. You really got to RE-SCRIPT the entire script.
Toreno is offline   Reply With Quote
Old 02/07/2012, 08:21 PM   #3
rabexann
Little Clucker
 
rabexann's Avatar
 
Join Date: May 2012
Posts: 34
Reputation: 0
Default Re: Why won't this work?

Quote:
P.S. I know it's extremely long because i merged several other FSes so I wouldn't have a ton in the server Config.
I didn't script all of these, a few though but thanks.
__________________
R.I.P. Edward Khil..
We will miss
Quote:
Trololololololo
rabexann is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Work command does not work on shamal Neil. Scripting Help 3 03/06/2012 08:58 AM
Ticket key work And PayTicket key dont work. Admigo Scripting Help 1 26/03/2012 07:14 PM
My Server work on Windows and dont work on linux Justinlol Help Archive 10 14/08/2011 01:43 PM
function doesnt work as i want it to work. legodude Help Archive 0 14/03/2011 02:25 PM
should FS/GM that work with windows work on linux iggy1 Help Archive 4 01/06/2010 09:53 AM


All times are GMT. The time now is 06:55 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.