12.07.2012, 16:31
Hi been some days I'm trying to find the Garsino bomb system with no results. Does anyone still have it or know where to download it?
// © [03]Garsino 2010 - Keep The Credits.
/*
Thanks to:
- ****** for sscanf.
- Dracoblue for dini and dcmd.
- Incognito for his streamer plugin.
*/
#include <a_samp>
#include <streamer>
#include <dini>
#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 CARBOMB_PRICE 50000 // How much 1 carbomb cost
#define CARBOMB_DIALOG 12345
new CMDSString[1500], BombShop[3]; // Excuse the huge ass size, I use it for other stuff in my gamemode and it have to be that big.
// Change the size if you're not happy about it!
public OnFilterScriptInit()
{
print("GarBomb v1.0 By [03]Garsino Has Been Successfully Loaded!");
BombShop[0] = CreateDynamicCPEx(-1787.00, 1204.41, 25.12, 2.50, -1, 0, -1, 100.0, "Bombshop"); // Bombshop SF
BombShop[1] = CreateDynamicCPEx(1998.16, 2298.59, 10.82, 2.50, -1, 0, -1, 100.0, "Bombshop"); // Bombshop LV
BombShop[2] = CreateDynamicCPEx(1839.37, -1863.91, 13.38, 2.50, -1, 0, -1, 100.0, "Bombshop"); // Bombshop LS
CreateDynamicMapIcon(-1787.00, 1204.41, 25.12, 48, 0, -1, -1, -1, 200.0); // Bombshop Mapicon SF
CreateDynamicMapIcon(1998.16, 2298.59, 10.82, 48, 0, -1, -1, -1, 200.0); // Bombshop Mapicon LV
CreateDynamicMapIcon(1839.37, -1863.91, 13.38, 48, 0, -1, -1, -1, 200.0); // Bombshop Mapicon LS
return 1;
}
public OnFilterScriptExit()
{
new file[MAX_PLAYER_NAME+15];
print("GarBomb v1.0 By [03]Garsino Has Been Successfully Unloaded!");
for(new i = 0; i < GetMaxPlayers(); i++) // I used GetMaxPlayers here, you may replace it with your own define/redefined MAX_PLAYERS
{
if(IsPlayerConnected(i) && !IsPlayerNPC(i))
{
format(file, sizeof(file), "/GarBomb/%s.ini", pNick(i));
if(dini_Exists(file))
{
dini_IntSet(file, "Bomb", GetPVarInt(i, "Bomb"));
}
}
}
return 1;
}
public OnPlayerConnect(playerid)
{
new file[MAX_PLAYER_NAME+15];
SetPVarInt(playerid, "RiggedVehicle", INVALID_VEHICLE_ID);
format(file, sizeof(file), "/GarBomb/%s.ini", pNick(playerid));
if(dini_Exists(file))
{
SetPVarInt(playerid, "Bomb", dini_Int(file, "Bomb"));
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new file[MAX_PLAYER_NAME+15];
format(file, sizeof(file), "/GarBomb/%s.ini", pNick(playerid));
if(dini_Exists(file))
{
dini_IntSet(file, "Bomb", GetPVarInt(playerid, "Bomb"));
}
return 1;
}
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == BombShop[0] || checkpointid == BombShop[1] || checkpointid == BombShop[2])
{
ShowPlayerDialog(playerid, CARBOMB_DIALOG, DIALOG_STYLE_MSGBOX, "GarBomb - Car-Bomb Buying", "Do You Want To Buy A Car-Bomb For $50,000?", "Buy", "Cancel");
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(bomb, 4, cmdtext);
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == CARBOMB_DIALOG && response)
{
if(GetPlayerMoney(playerid) < CARBOMB_PRICE) return SendClientMessage(playerid, 0xB60000FF, "You Do Not Have Enough Money To Buy A Car-Bomb.");
if(GetPVarInt(playerid, "Bomb") == 1) return SendClientMessage(playerid, 0xB60000FF, "You Already Have A Car-Bomb.");
else
{
new string[128];
SetPVarInt(playerid, "Bomb", 1);
GivePlayerMoney(playerid, -CARBOMB_PRICE);
format(string, sizeof(string), "You've Bought A Car-Bomb For $%d. Use /bomb For More Information.", CARBOMB_PRICE);
SendClientMessage(playerid, 0x00983BFF, string);
return 1;
}
}
return 0;
}
dcmd_bomb(playerid, params[])
{
new amount, tmpcount = 0, string[128], Float:X, Float:Y, Float:Z, file[MAX_PLAYER_NAME+15];
if(GetPVarInt(playerid, "Bomb") == 0) return SendClientMessage(playerid, 0xB60000FF, "You Do Not Have A Car-Bomb!");
format(file, sizeof(file), "/GarBomb/%s.ini", pNick(playerid));
if(sscanf(params, "d", amount) && GetPVarInt(playerid, "Bomb") == 1)
{
CMDSString = "";
if(!dini_Exists(file))
{
dini_Create(file);
}
switch(GetPVarInt(playerid, "BombStatus"))
{
case 0: strcat(CMDSString, "Your Car-Bomb Is Not Rigged In A Vehicle.\nUse /bomb 1 (/b 1) While In A Vehicle To Rig The Bomb.\nThen Use /bomb 1 (/b 1) If You Want To Detonate The Bomb.");
case 1:
{
new tmpstring1[MAX_PLAYER_NAME+10], tmpstring2[50], tmpcount2 = 0;
strcat(CMDSString, "Your Car-Bomb Is Rigged In A Vehicle.\n");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i) && GetPlayerVehicleID(i) == GetPVarInt(playerid, "RiggedVehicle"))
{
tmpcount2++;
}
}
switch(tmpcount2)
{
case 1: format(tmpstring2, sizeof(tmpstring2), "There Are 1 Player In Your Rigged Vehicle.\n");
case 0, 2..499: format(tmpstring2, sizeof(tmpstring2), "There Are %d Players In Your Rigged Vehicle.\n", tmpcount2);
}
strcat(CMDSString, tmpstring2);
if(tmpcount2 >= 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i) && GetPlayerVehicleID(i) == GetPVarInt(playerid, "RiggedVehicle"))
{
format(tmpstring1, sizeof(tmpstring1), "%s (%d)\n", pNick(i), i);
strcat(CMDSString, tmpstring1);
}
}
}
strcat(CMDSString, "\nUse /bomb 1 (/b 1) To Detonate The Car-Bomb.");
}
}
ShowPlayerDialog(playerid, CARBOMB_DIALOG-1, DIALOG_STYLE_MSGBOX, "GarBomb v1.0 - Car Bomb Info", CMDSString, "OK", "Close");
}
if(amount == 1)
{
if(!dini_Exists(file))
{
dini_Create(file);
}
switch(GetPVarInt(playerid, "BombStatus"))
{
case 0:
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, 0xB60000FF, "Your Need To Be Driving A Vehicle To Rig It.");
else
{
switch(random(100))
{
case 0..25:
{
GetPlayerPos(playerid, X, Y, Z);
CreateExplosion(X, Y, Z+3, 0, 4.5);
CreateExplosion(X, Y+3, Z, 0, 4.5);
CreateExplosion(X+3, Y, Z, 0, 4.5);
SetVehicleHealth(GetPVarInt(playerid, "RiggedVehicle"), 200.0);
SetPlayerHealth(playerid, 0.0);
SendDeathMessage(playerid, playerid, 40);
SetPVarInt(playerid, "BombStatus", 0);
SetPVarInt(playerid, "Bomb", 0);
SetPVarInt(playerid, "RiggedVehicle", INVALID_VEHICLE_ID);
GameTextForPlayer(playerid, "~n~ ~r~Your Car-Bomb Bomb Has Exploded~n~While Rigging It!", 7000, 3);
SendClientMessage(playerid, 0xB60000FF, "Your Car-Bomb Exploded While You Were Rigging It.");
}
case 26..99:
{
SetPVarInt(playerid, "RiggedVehicle", GetPlayerVehicleID(playerid));
SetPVarInt(playerid, "BombStatus", 1);
SendClientMessage(playerid, 0x00BC00FF, "You've Successfully Rigged Your Car-Bomb To This Vehicle.");
}
}
}
}
case 1:
{
SetPVarInt(playerid, "BombStatus", 0);
SetPVarInt(playerid, "Bomb", 0);
SetPVarInt(playerid, "RiggedVehicle", INVALID_VEHICLE_ID);
switch(random(100))
{
case 0..30:
{
GameTextForPlayer(playerid, "~n~ ~r~Your Car-Bomb Failed To Detonate!", 7000, 3);
SendClientMessage(playerid, 0xB60000FF, "Your Car-Bomb Failed To Detonate.");
}
case 31..99:
{
GameTextForPlayer(playerid, "~n~ ~r~Your Car-Bomb Bomb Has Exploded!", 7000, 3);
GetVehiclePos(GetPVarInt(playerid, "RiggedVehicle"), X, Y, Z);
CreateExplosion(X, Y, Z+3, 0, 4.5);
CreateExplosion(X, Y+3, Z, 0, 4.5);
CreateExplosion(X+3, Y, Z, 0, 4.5);
SetVehicleHealth(GetPVarInt(playerid, "RiggedVehicle"), 200.0);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i) && GetPlayerVehicleID(i) == GetPVarInt(playerid, "RiggedVehicle"))
{
SetPlayerHealth(i, 0.0);
SendDeathMessage(playerid, i, 40);
format(string, sizeof(string), "%s (%d) Has Been Killed By %s (%d)'s Car-Bomb.", pNick(i), i, pNick(playerid), playerid);
SendClientMessageToAll(0xB60000FF, string);
tmpcount++;
}
}
switch(tmpcount)
{
case 0, 2..499:
{
format(string, sizeof(string), "Your Car-Bomb Has Been Detonated Successfully And Killed %d Players.", tmpcount);
SendClientMessage(playerid, 0x00BC00FF, string);
}
case 1:
{
format(string, sizeof(string), "Your Car-Bomb Has Been Detonated Successfully And Killed %d Player.", tmpcount);
SendClientMessage(playerid, 0x00BC00FF, string);
}
}
}
}
}
}
}
return 1;
}
stock pNick(playerid) // By [03]Garsino (Probally made by someone else too but I scripted this myself xD)!
{
new GFSnick[MAX_PLAYER_NAME];
GetPlayerName(playerid, GFSnick, MAX_PLAYER_NAME);
return GFSnick;
}
stock sscanf(string[], format[], {Float,_}:...) // Credits to ******!
{
#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;
}
// CreateDynamicCPEx - Created By [03]Garsino!
stock CreateDynamicCPEx(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid = -1, Float:distance = 25.0, text[])
{
Create3DTextLabel(text, 0x00BC00FF, x, y, z+0.7, (distance + 10.0), 0, 0);
return CreateDynamicCP(x, y, z, size, worldid, interiorid, playerid, distance);
}