05.10.2013, 00:20
Roubo a carro forte
Entгo galera, resolvi traduzir um FS de roubo a carro forte, algo simples e nгo muito complexo. Tenho a perm. do criador, caso queria ter certeza clique aqui
Comandos:
/comprarbomba
/plantarbomba
/detonarbomba
/enchermala
Download:
Entгo galera, resolvi traduzir um FS de roubo a carro forte, algo simples e nгo muito complexo. Tenho a perm. do criador, caso queria ter certeza clique aqui
Comandos:
/comprarbomba
/plantarbomba
/detonarbomba
/enchermala
Download:
pawn Код:
/* Fs feito por: TonyII
Traduzido por: Menor
NГO RETIRE OS CRЙDITOS!! */
#include <a_samp>
#include <zcmd>
#pragma tabsize 0
//Variбveis
new Bomb[MAX_PLAYERS];
new FBTimer;
new CountTime;
new Counting;
new BagTime;
new BagCounting;
new VanMoved;
new SMoney;
new DetonateBomb[MAX_PLAYERS];
new SecurityVanID[MAX_PLAYERS];
new SVBeingRobbed[MAX_VEHICLES];
new FullBag[MAX_PLAYERS];
new MoneyLeft[MAX_VEHICLES];
new Float:VanX,Float:VanY,Float:VanZ;
//Forwards
forward VanMovedTimer(playerid,Float:X,Float:Y,Float:Z);
forward FillingBags(playerid);
forward SecureMoney(playerid);
//Publics
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("System roubo ao carro forte - Traduzido por Menor. [By TonyII]");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(FullBag[playerid] == 1)
{
GivePlayerMoney(playerid, -100000);
KillTimer(SMoney);
FullBag[playerid] = 0;
SendClientMessage(playerid, 0xFF0000FF,"Erro: Seu assalto deu errado, vocк morreu.");
}
return 1;
}
public VanMovedTimer(playerid)
{
new Float:X,Float:Y,Float:Z;
if(!Counting)
{
KillTimer(VanMoved);
Bomb[playerid] = 0;
DetonateBomb[playerid] = 1;
SendClientMessage(playerid, 0xFFFF00FF,"Tudo pronto, a bomba esta plantada. Saia de perto e use /detonarbomba");
ClearAnimations(playerid);
}
else
{
new SVID = SecurityVanID[playerid];
GetVehiclePos(SVID, X,Y,Z);
if(X == VanX && Y == VanY && Z == VanZ)
{
new string[128];
format(string,sizeof(string),"%i",CountTime);
GameTextForPlayer(playerid,string,1000,5);
CountTime --;
if(CountTime == 0)
{
Counting = 0;
}
}
else
{
KillTimer(VanMoved);
SendClientMessage(playerid, 0xFF0000FF,"Erro: Vocк saiu de perto do carro-forte ao plantar a bomba!");
}
}
return 1;
}
public SecureMoney(playerid)
{
SendClientMessage(playerid, 0xFFFF00FF,"O Dinheiro esta seguro agora.");
FullBag[playerid] = 0;
KillTimer(SMoney);
return 1;
}
public FillingBags(playerid)
{
if(!BagCounting)
{
KillTimer(FBTimer);
FullBag[playerid] = 1;
GivePlayerMoney(playerid, 100000);
SendClientMessage(playerid, 0xFFFF00FF,"Vocк encheu a mala, a mala contйm $100,000 Dуlares.");
SendClientMessage(playerid, 0xFFFF00FF,"Deixe a бrea, se vocк morrer, vocк perde o dinheiro!");
ClearAnimations(playerid);
SMoney = SetTimerEx("SecureMoney",600000,false,"i",playerid);
}
else
{
new string[128];
format(string,sizeof(string),"%i",BagTime);
GameTextForPlayer(playerid,string,1000,5);
BagTime --;
if(BagTime == 0)
{
BagCounting = 0;
}
}
return 1;
}
//Stocks
stock SecurityVan(vehicleid)
{
switch(GetVehicleModel(vehicleid))
{
case 428: return 1;
}
return 0;
}
stock GetDistanceToCar(playerid, veh, Float: posX = 0.0, Float: posY = 0.0, Float: posZ = 0.0)
{
new Float: Floats[2][3];
if(posX == 0.0 && posY == 0.0 && posZ == 0.0)
{
if(!IsPlayerInAnyVehicle(playerid)) GetPlayerPos(playerid, Floats[0][0], Floats[0][1], Floats[0][2]);
else GetVehiclePos(GetPlayerVehicleID(playerid), Floats[0][0], Floats[0][1], Floats[0][2]);
}
else
{
Floats[0][0] = posX;
Floats[0][1] = posY;
Floats[0][2] = posZ;
}
GetVehiclePos(veh, Floats[1][0], Floats[1][1], Floats[1][2]);
return floatround(floatsqroot((Floats[1][0] - Floats[0][0]) * (Floats[1][0] - Floats[0][0]) + (Floats[1][1] - Floats[0][1]) * (Floats[1][1] - Floats[0][1]) + (Floats[1][2] - Floats[0][2]) * (Floats[1][2] - Floats[0][2])));
}
stock GetClosestCar(playerid, exception = INVALID_VEHICLE_ID)
{
new Float: Distance,target = -1,Float: vPos[3];
if(!IsPlayerInAnyVehicle(playerid)) GetPlayerPos(playerid, vPos[0], vPos[1], vPos[2]);
else GetVehiclePos(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]);
for(new v; v < MAX_VEHICLES; v++) if(GetVehicleModel(v) >= 400)
{
if(v != exception && (target < 0 || Distance > GetDistanceToCar(playerid, v, vPos[0], vPos[1], vPos[2])))
{
target = v;
Distance = GetDistanceToCar(playerid, v, vPos[0], vPos[1], vPos[2]);
}
}
return target;
}
//Comandos
CMD:comprarbomba(playerid, params[])
{
if(GetPlayerMoney(playerid) <= 10000) return SendClientMessage(playerid, 0xFF0000FF,"Erro: Dinheiro insuficiente.");
if(Bomb[playerid] == 1) return SendClientMessage(playerid, 0xFF0000FF,"Erro: Vocк jб tem uma bomba.");
Bomb[playerid] = 1;
ApplyAnimation(playerid,"PED","fucku",4.0,0,0,0,0,0);
SendClientMessage(playerid, 0xFFFF00FF,"Vocк comprou com sucesso uma bomba.");
SendClientMessage(playerid, 0xFFFF00FF,"Aproxime-se de um carro-forte e plante nas portas traseiras. /Plantarbomba");
GivePlayerMoney(playerid, -100000);
return 1;
}
CMD:plantarbomba(playerid, params[])
{
new ClosestCar = GetClosestCar(playerid);
GetVehiclePos(ClosestCar, VanX,VanY,VanZ);
if(Bomb[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF,"Erro: Vocк nгo tem uma bomba.");
if(IsPlayerInRangeOfPoint(playerid, 7.0, VanX,VanY,VanZ))
{
if(SecurityVan(ClosestCar))
{
SecurityVanID[playerid] = ClosestCar;
VanMoved = SetTimerEx("VanMovedTimer",1000,true,"i",playerid);
CountTime = 5;
Counting = 1;
SendClientMessage(playerid, 0xFFFF00FF,"Vocк estб plantando a bomba!");
ApplyAnimation(playerid, "BOMBER","BOM_Plant_Loop",4.0,1,0,0,1,0);
}
else return SendClientMessage(playerid, 0xFF0000FF,"Erro: Esse veнculo nгo й um carro-forte!");
}
else return SendClientMessage(playerid, 0xFF0000FF,"Erro: Nгo hб nenhum carro-forte por perto.");
return 1;
}
CMD:detonarbomba(playerid, params[])
{
new Float:X,Float:Y,Float:Z;
if(DetonateBomb[playerid] == 1)
{
new SVID = SecurityVanID[playerid];
GetVehiclePos(SVID, X,Y,Z);
CreateExplosion(X, Y, Z, 7, 10);
SetVehicleHealth(SVID, 350);
SVBeingRobbed[SVID] = 1;
DetonateBomb[playerid] = 0;
MoneyLeft[SVID] = 5;
SetPlayerWantedLevel(playerid,4);
SendClientMessage(playerid, 0xFFFF00FF,"A bomba explodiu, encha as malas e saia daqui. Use /enchermala");
SendClientMessage(playerid, 0xFF0000FF,"A polнcia esta na sua cola, agora vocк й um procurado!");
}
else return SendClientMessage(playerid, 0xFF0000FF,"Erro: Vocк nгo tem uma bomba plantada aqui.");
return 1;
}
CMD:enchermala(playerid, params[])
{
static Ladrao[MAX_PLAYER_NAME], sStr[70];
GetPlayerName(playerid, Ladrao, sizeof(Ladrao));
new ClosestCar = GetClosestCar(playerid);
if(BagCounting == 1) return SendClientMessage(playerid, 0xFF0000FF,"Erro: Vocк jб estб enchendo suas malas!");
if(GetPlayerWeapon(playerid) == 46) return SendClientMessage(playerid, 0xFF0000FF, "Erro: Vocк nгo tem uma mochila ! ");
if(MoneyLeft[ClosestCar] == 0) return SendClientMessage(playerid, 0xFF0000FF,"Este carro estб vazio!");
if(FullBag[playerid] == 1) return SendClientMessage(playerid, 0xFF0000FF,"Erro: Suas malas estгo cheias, gaste o dinheiro do roubo anterior!");
if(SVBeingRobbed[ClosestCar] == 1)
{
SendClientMessage(playerid, 0xFFFF00FF,"Aguarde, vocк estб enchendo suas malas com dinheiro.");
FBTimer = SetTimerEx("FillingBags",1000,true,"i",playerid);
BagTime = 5;
BagCounting = 1;
MoneyLeft[ClosestCar] -= 1;
ApplyAnimation(playerid, "BOMBER","BOM_Plant_Loop",4.0,1,0,0,1,0);
format(sStr, sizeof(sStr), "ATENЗГO! %s[%d] estб roubando o Banco!", Ladrao, playerid);
SendClientMessageToAll(0xE31919FF, sStr);
}
else return SendClientMessage(playerid, 0xFF0000FF,"Erro: Este carro nгo estб sendo roubado.");
return 1;
}