07.10.2012, 18:47
DiGiTaL BaR
Hi! I finally made my first FilterScript. It is a bar, in Marina, LS. It's on top of BurgerShot, you'll see it in the image below. Unfortunately, I couldn't make it to work as a FS, so you must include it in your GameMode.
Here are the codes:
PICTURE
Credits
Scripting - DiGiTaL_AnGeL
Mapping - DiGiTaL_AnGeL
Time eplased during mading the script: 6.30 hours
Hi! I finally made my first FilterScript. It is a bar, in Marina, LS. It's on top of BurgerShot, you'll see it in the image below. Unfortunately, I couldn't make it to work as a FS, so you must include it in your GameMode.
Here are the codes:
pawn Код:
Under your other forwards put this:
forward IsAtBar(playerid);
pawn Код:
Put this at the end of your gm, or wherever you want:
public IsAtBar(playerid)
{
if(IsPlayerConnected(playerid)))
{
if(PlayerToPoint(0.0,playerid,803.3525,-1613.2156,19.5313,357.3214,0,0,0,0,0,0))
{return 1;
}
}
return 0;
}
pawn Код:
Put those codes under "OnGameModeInit"
CreateObject(8613, 786.88, -1609.30, 15.19, 0.00, 0.00, -90.00);
CreateObject(2592, 803.33, -1612.22, 19.50, 0.00, 0.00, 0.00);
CreateObject(2643, 803.39, -1611.26, 20.25, 0.00, 0.00, 0.00);
CreateObject(214, 803.39, -1611.71, 19.74, 90.00, 0.00, 0.00);
CreateObject(1432, 796.14, -1614.97, 18.53, 0.00, 0.00, 0.00);
CreateObject(1432, 796.47, -1619.09, 18.53, 0.00, 0.00, 0.00);
CreateObject(1432, 800.31, -1616.69, 18.53, 0.00, 0.00, 0.00);
CreateObject(1432, 800.60, -1621.94, 18.53, 0.00, 0.00, 0.00);
CreateObject(1432, 796.44, -1624.22, 18.53, 0.00, 0.00, 0.00);
CreateObject(1669, 802.10, -1612.28, 19.57, 0.00, 0.00, 0.00);
CreateObject(1669, 801.80, -1612.19, 19.57, 0.00, 0.00, 0.00);
CreateObject(1668, 802.41, -1612.28, 19.57, 0.00, 0.00, 0.00);
CreateObject(1668, 804.67, -1612.27, 19.57, 0.00, 0.00, 0.00);
CreateObject(1668, 803.09, -1612.33, 19.57, 0.00, 0.00, 0.00);
CreateObject(1668, 803.70, -1612.18, 19.57, 0.00, 0.00, 0.00);
CreateObject(1669, 802.67, -1612.30, 19.57, 0.00, 0.00, 0.00);
CreateObject(1668, 802.85, -1612.16, 19.57, 0.00, 0.00, 0.00);
CreateObject(1669, 803.35, -1612.27, 19.57, 0.00, 0.00, 0.00);
CreateObject(1669, 804.37, -1612.30, 19.57, 0.00, 0.00, 0.00);
CreateObject(1669, 803.95, -1612.30, 19.57, 0.00, 0.00, 0.00);
CreateObject(1669, 804.79, -1612.37, 19.57, 0.00, 0.00, 0.00);
CreateObject(1667, 800.76, -1616.92, 19.22, 0.00, 0.00, 0.00);
CreateObject(1667, 800.27, -1616.15, 19.22, 0.00, 0.00, 0.00);
CreateObject(1667, 799.84, -1616.82, 19.22, 0.00, 0.00, 0.00);
CreateObject(19019, 803.39, -1611.71, 20.42, 0.00, 0.00, -90.00);
CreateObject(2829, 796.17, -1614.97, 19.14, 0.00, 0.00, 0.00);
CreateObject(2829, 796.47, -1624.14, 19.14, 0.00, 0.00, 0.00);
CreateObject(2829, 800.62, -1621.97, 19.14, 0.00, 0.00, 0.00);
CreateObject(1432, 804.72, -1617.82, 18.53, 0.00, 0.00, 0.00);
CreateObject(2829, 804.78, -1617.85, 19.15, 0.00, 0.00, 0.00);
CreateObject(2829, 800.31, -1616.64, 19.14, 0.00, 0.00, 0.00);
CreateObject(1716, 802.47, -1612.50, 18.53, 0.00, 0.00, 0.00);
CreateObject(1716, 803.26, -1612.50, 18.53, 0.00, 0.00, 0.00);
CreateObject(1716, 804.06, -1612.51, 18.53, 0.00, 0.00, 0.00);
CreateObject(1716, 804.92, -1612.45, 18.53, 0.00, 0.00, 0.00);
CreateObject(2179, 800.46, -1611.67, 20.00, 0.00, 0.00, 0.00);
CreateObject(2179, 806.02, -1611.69, 20.00, 0.00, 0.00, 0.00);
CreateObject(2179, 792.28, -1606.64, 18.91, 0.00, 90.00, 90.00);
CreateObject(2179, 793.83, -1603.82, 18.91, 90.00, 90.00, 0.00);
CreateObject(2179, 798.23, -1604.79, 18.91, 90.00, 55.00, 0.00);
CreateObject(2179, 792.21, -1609.63, 18.91, 90.00, 0.00, 0.00);
CreateObject(2179, 792.16, -1615.99, 18.91, 90.00, 0.00, 0.00);
CreateObject(2179, 791.44, -1611.94, 16.34, 0.00, 0.00, 0.00);
CreateObject(2179, 791.42, -1614.62, 16.34, 0.00, 0.00, 0.00);
CreateObject(2179, 792.15, -1620.30, 18.91, 90.00, 0.00, 0.00);
CreateObject(2179, 792.14, -1624.63, 18.91, 90.00, 0.00, 0.00);
CreateObject(2179, 793.62, -1627.35, 18.91, 90.00, 0.00, 90.00);
CreateObject(2179, 797.93, -1627.35, 18.91, 90.00, 0.00, 90.00);
CreateObject(2179, 802.29, -1625.58, 18.91, 90.00, 0.00, -45.00);
CreateObject(2179, 805.34, -1622.52, 18.91, 90.00, 0.00, -45.00);
CreateObject(2179, 806.61, -1618.72, 18.91, 90.00, 0.00, 0.00);
CreateObject(2179, 806.64, -1614.40, 18.91, 90.00, 0.00, 0.00);
CreateObject(2179, 806.37, -1612.35, 16.42, 0.00, 0.00, 0.00);
CreateObject(2212, 796.49, -1619.33, 19.20, -25.00, 19.56, 0.00);
CreateObject(625, 795.03, -1604.68, 19.40, 0.00, 0.00, 0.00);
CreateObject(625, 801.41, -1607.11, 19.40, 0.00, 0.00, 0.00);
CreateObject(625, 794.73, -1626.44, 19.40, 0.00, 0.00, 0.00);
CreateObject(625, 802.09, -1626.46, 19.40, 0.00, 0.00, 0.00);
CreateObject(625, 807.68, -1620.86, 19.40, 0.00, 0.00, 0.00);
CreatePickup(1239,23,803.3525,-1613.2156,19.5313,357.3214);//Bar
pawn Код:
Put those codes under "OnPlayerCommandText"
if(strcmp(cmd, "/takedrink", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsAtBar(playerid))
{
if(PlayerDrunk[playerid] < 10)
{
new Float:health;
new x_nr[128];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr)) {
SendClientMessage(playerid, COLOR_WHITE, "|__________________ Bar Drinks __________________|");
SendClientMessage(playerid, COLOR_WHITE, "{00A1FF}USAGE{FFFFFF}: /drink [drinkname]");
SendClientMessage(playerid, COLOR_GREY, "Available names: Beer ($6), Vodka ($10), Whiskey ($10), Water ($2), Coke($2)");
SendClientMessage(playerid, COLOR_WHITE, "|________________________________________________|");
return 1;
}
return 1;
}
if(strcmp(x_nr,"beer",true) == 0)
{
if(PlayerInfo[playerid][pAge] < 16)
{
SendClientMessage(playerid, COLOR_WHITE, "Bartender: Sorry, you need to be 16 years to get this drink.");
return 1;
}
if(PlayerToPoint(0.0,playerid,803.3525,-1613.2156,19.5313,357.3214,0,0,0,0,0,0))
{
GivePlayerMoney(playerid, - 200);
PlayerDrunk[playerid] += 1;
if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~You are~n~~p~Drunk", 3500, 1); }
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 15; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 15.0); }
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s drinks a %s.", sendername ,x_nr);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
new Drunk = GetPlayerDrunkLevel(playerid);
SetPlayerDrunkLevel(playerid, Drunk+100);
GivePlayerMoney(playerid, - 6);
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 15; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 15.0); }
}
}
else if(strcmp(x_nr,"vodka",true) == 0)
{
if(PlayerInfo[playerid][pAge] < 18)
{
SendClientMessage(playerid, COLOR_WHITE, "Bartender: Sorry, you need to be 18 years to get this drink.");
return 1;
}
if(PlayerToPoint(0.0,playerid,803.3525,-1613.2156,19.5313,357.3214,0,0,0,0,0,0))
{
GivePlayerMoney(playerid, - 400);
PlayerDrunk[playerid] += 2;
if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~You are~n~~p~Drunk", 3500, 1); }
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 25; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 25.0); }
}
new Drunk = GetPlayerDrunkLevel(playerid);
SetPlayerDrunkLevel(playerid, Drunk+1500);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s drinks a %s.", sendername ,x_nr);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
GivePlayerMoney(playerid, - 10);
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 25; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 25.0); }
}
}
else if(strcmp(x_nr,"whiskey",true) == 0)
{
if(PlayerInfo[playerid][pAge] < 18)
{
SendClientMessage(playerid, COLOR_WHITE, "Bartender: Sorry, you need to be 18 years to get this drink.");
return 1;
}
if(PlayerToPoint(0.0,playerid,803.3525,-1613.2156,19.5313,357.3214,0,0,0,0,0,0))
{
GivePlayerMoney(playerid, - 500);
PlayerDrunk[playerid] += 3;
if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~You are~n~~p~Drunk", 3500, 1); }
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 27; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 27.0); }
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s drinks a %s.", sendername ,x_nr);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
new Drunk = GetPlayerDrunkLevel(playerid);
SetPlayerDrunkLevel(playerid, Drunk+2500);
GivePlayerMoney(playerid, - 10);
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 27; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 27.0); }
}
}
else if(strcmp(x_nr,"water",true) == 0)
{
if(PlayerToPoint(0.0,playerid,803.3525,-1613.2156,19.5313,357.3214,0,0,0,0,0,0))
{
GivePlayerMoney(playerid, - 50);
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo[playerid][pAlcoholPerk] > 0) { new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 5; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 5.0); }
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s drinks a %s.", sendername ,x_nr);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
GivePlayerMoney(playerid, - 2);
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo[playerid][pAlcoholPerk] > 0) { new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 5; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 5.0); }
}
}
else if(strcmp(x_nr,"coke",true) == 0)
{
if(PlayerToPoint(0.0,playerid,803.3525,-1613.2156,19.5313,357.3214,0,0,0,0,0,0))
{
GivePlayerMoney(playerid, - 70);
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo[playerid][pAlcoholPerk] > 0) { new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 5; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 5.0); }
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s drinks a %s.", sendername ,x_nr);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
GivePlayerMoney(playerid, - 2);
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo[playerid][pAlcoholPerk] > 0) { new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 5; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 5.0); }
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Bartender: I don't have that drink, sorry.");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s drinks a %s.", sendername ,x_nr);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You can't drink anymore, you will throw up !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not at a Bar !");
return 1;
}
}
return 1;
Credits
Scripting - DiGiTaL_AnGeL
Mapping - DiGiTaL_AnGeL
Time eplased during mading the script: 6.30 hours