Bombing vehicles
#1

Hello, im creating a vehicle bomb system and everything works except a thing, the bomb explosion.

I have the cmd: /bomb to place a bomb if you're in a vehicle:

pawn Код:
CMD:bomb(playerid, params[])
{
if(pInfo[playerid][Skill] == 2)
{
if(pInfo[playerid][Logged] == 0) return SCM(playerid,0x0080C0FF,"Please login before using this command.");
if(pInfo[playerid][Jailed] == 1) return SCM(playerid,0xFF0000FF,"You can't use this command in jail.");
if(pSpawned[playerid] == 0) return SCM(playerid, COLOR_LIGHTBLUE, "Please spawn before doing any action.");
if(pAlive[playerid] == 0) return SCM(playerid, COLOR_LIGHTBLUE, "You can't use this command if you are dead.");
if(pInfo[playerid][Bombs] == 0) return SCM(playerid,0xFF0000FF,"You dont have any bombs left, you can buy some at 24/7.");
if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid, 0xF60000AA, "You must be in a vehicle to plant a bomb.");
if(GetPVarInt(playerid,"PlantBomb")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"Please wait 5 minutes before planting a bomb again.");
new crand = random(120);
if(crand <= 53)
{
SetPVarInt(playerid,"PlantBomb",GetTickCount()+300000);
SCM(playerid,0x15FF00FF,"** Bomb attempt failed, the bomb fragments seriously injured you!");
new Float: x;
new Float: y;
new Float: z;
SetPlayerPos(playerid,x,y,z+2);
SetPlayerHealth(playerid, 0);
new pname[24];
GetPlayerName(playerid, pname, 24);
new BombMsg[170];
format(BombMsg, sizeof(BombMsg), "2,4** %s (%d) got seriously injured by bomb fragments while trying to place a bomb in a car.", pname,playerid);
IRC_GroupSay(gGroupID, IRC_CHANNEL, BombMsg);
SetPlayerScore(playerid, GetPlayerScore(playerid) -1);
pInfo[playerid][Deaths] ++;
SendDeathMessage(INVALID_PLAYER_ID, playerid, 51);
new all[170];
format(all, sizeof(all), "** %s (%d) got seriously injured by bomb fragments while trying to place a bomb in a car.", pname,playerid);
SCMTA(COLOR_CON_GREEN,all);
}
else
{
new carid;
carid = GetPlayerVehicleID(playerid);
VehicleBombID[playerid] = carid;
SetPVarInt(playerid,"PlantBomb",GetTickCount()+300000);
BombTimer[playerid] = SetTimerEx("BombCar",10000,false,"d",playerid);
pInfo[playerid][BombsPlanted] ++;
pInfo[playerid][Bombs] --;
new BomberMsg[128];
format(BomberMsg, sizeof(BomberMsg), "** Bomb planted, the vehicle will explode in 10 seconds, exit fast! Bombs left: %d", pInfo[playerid][Bombs]);
SCM(playerid,COLOR_CON_GREEN,BomberMsg);
new pname[24];
GetPlayerName(playerid, pname, 24);
new BombedMsg[170];
format(BombedMsg, sizeof(BombedMsg), "2,4** %s (%d) planted a bomb in their car.", pname,playerid);
IRC_GroupSay(gGroupID, IRC_CHANNEL, BombedMsg);
new alll[128];
format(alll, sizeof(alll), "** %s (%d) planted a bomb in their car.", pname,playerid);
SCMTA(COLOR_CON_GREEN,alll);
}
}
return 1;
}
And works, thid is the BombCar timer:

pawn Код:
public BombCar(playerid)
{
    new carid = GetPlayerVehicleID(playerid);
    new Float:vehx, Float:vehy, Float:vehz;
    GetVehiclePos(carid, vehx, vehy, vehz);
    CreateExplosion(VehicleBombID,vehx,vehy,vehz,7,5);
    CreateExplosion(VehicleBombID,vehx,vehy,vehz,5,5);
    CreateExplosion(VehicleBombID,vehx,vehy,vehz,6,5);
    CreateExplosion(VehicleBombID,vehx,vehy,vehz,4,5);
    SetVehicleHealth(VehicleBombID, 0.0);
    new rando = random(12345)+127;
    new exploded[170];
    format(exploded, sizeof(exploded), "** The bomb in the car has exploded and you earned %d CSCash and 1 score!", rando);
    SCM(playerid, COLOR_CON_GREEN, exploded);
    GivePlayerCash(playerid, rando);
    SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
    KillTimer(BombTimer[playerid]);
    return 1;
}
I've stored the vehicle id where the player types /bomb, but seems not work:

Quote:

(2992) : error 035: argument type mismatch (argument 1)
(2993) : error 035: argument type mismatch (argument 1)
(2994) : error 035: argument type mismatch (argument 1)
(2995) : error 035: argument type mismatch (argument 1)
(2996) : error 035: argument type mismatch (argument 1)

Error lines:

pawn Код:
CreateExplosion(VehicleBombID,vehx,vehy,vehz,7,5);
    CreateExplosion(VehicleBombID,vehx,vehy,vehz,5,5);
    CreateExplosion(VehicleBombID,vehx,vehy,vehz,6,5);
    CreateExplosion(VehicleBombID,vehx,vehy,vehz,4,5);
    SetVehicleHealth(VehicleBombID, 0.0);
To store the vehicle id, in /bomb cmd i used:

pawn Код:
VehicleBombID[playerid] = carid;
Whats wrong? I need to store the vehicleid of where the player types bomb, than if he exit, the explosions will destroy ONLY that vehicleid where the bomb has been placed.
Reply


Messages In This Thread
Bombing vehicles - by Face9000 - 10.04.2013, 09:10
Re: Bombing vehicles - by Riddick94 - 10.04.2013, 09:27
Re: Bombing vehicles - by Face9000 - 10.04.2013, 09:43
Re: Bombing vehicles - by Riddick94 - 10.04.2013, 09:51
Re: Bombing vehicles - by Face9000 - 10.04.2013, 10:00
Re: Bombing vehicles - by Riddick94 - 10.04.2013, 10:05
Re: Bombing vehicles - by Djole1337 - 10.04.2013, 10:06
Re: Bombing vehicles - by Face9000 - 10.04.2013, 10:11

Forum Jump:


Users browsing this thread: 1 Guest(s)