CMD:pcb(playerid, params[])
{
if(PlayerInfo[playerid][pFaction] != 4 && PlayerInfo[playerid][pLeader] != 4) return SendClientMessage(playerid, COLOR_GRAD2, "You're not a member of the International Contract Agency !");
if(PlayerInfo[playerid][pC4]) return SendClientMessage(playerid, COLOR_GRAD2, " You can only deploy 1 C4 at a time !");
if(!PlayerInfo[playerid][pBombs]) return SendClientMessage(playerid, COLOR_GRAD2, "You do not have C4!");
new closestcar = GetClosestCar(playerid, GetPlayerVehicleID(playerid));
if(!IsPlayerInRangeOfVehicle(playerid, closestcar, 4.0) || closestcar == INVALID_VEHICLE_ID) return SendClientMessage(playerid, COLOR_GRAD2, "You're not close enough to any vehicle!");
if(VehicleBomb{closestcar}) return SendClientMessage(playerid, COLOR_GRAD2, "There is already a C4 on the vehicle engine!");
VehicleBomb{closestcar} = 1;
PlacedVehicleBomb[playerid] = closestcar;
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
SendClientMessage(playerid, COLOR_GREEN, "You have placed C4 on the vehicle engine, /pickupbomb to remove it.");
PlayerInfo[playerid][pC4] = 1;
PlayerInfo[playerid][pBombs]--;
PlayerInfo[playerid][pC4Used] = 2;
return 1;
}
CMD:engine(playerid, params[])
{
//Stuff here??
new veh = GetPlayerVehicleID(playerid);
if(VehicleBomb{veh}) //Vehicle has a bomb attached
{
new Float:x, Float:y, Float:z;
GetVehiclePos(veh, x, y, z);
CreateExplosion(x, y, z, 6, 8.0);
SendClientMessage(playerid, -1, "Your car had a bomb attached to it!");
VehicleBomb{veh} = 0;
}
//More stuff here?
return 1;
}
CMD:pcb(playerid, params[])
{
if(PlayerInfo[playerid][pFaction] == 4 || PlayerInfo[playerid][pLeader] == 4)
{
if(PlayerInfo[playerid][pC4] == 0)
{
if(PlayerInfo[playerid][pBombs] != 0)
{
new carid = GetPlayerVehicleID(playerid), sucess;
for(new x = 0; x < MAX_VEHICLES; x++)
{
if(FindNearCar(playerid,5, x) && GetVehicleVirtualWorld(x) == GetPlayerVirtualWorld(playerid))
{
sucess++;
if(VehicleBomb{x} == 1) return SendClientMessage(playerid, COLOR_GRAD2, "There is already a C4 on the vehicle engine!");
VehicleBomb{x} = 1;
PlacedVehicleBomb[playerid] = x;
ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
SendClientMessage(playerid, COLOR_GREEN, "You have placed C4 on the vehicle engine, /pickupbomb to remove it.");
PlayerInfo[playerid][pC4] = 1;
PlayerInfo[playerid][pBombs]--;
PlayerInfo[playerid][pC4Used] = 2;
return 1;
}
}
if(!sucess) return SendClientMessageEx(playerid, COLOR_LIGHTRED, "no closets vehicle!");
} else SendClientMessage(playerid, COLOR_GRAD2, "You do not have C4!");
} else SendClientMessage(playerid, COLOR_GRAD2, " You can only deploy 1 C4 at a time ! ");
} else SendClientMessage(playerid, COLOR_GRAD2, "You're not a member of the International Contract Agency ! ");
return 1;
}
stock FindNearCar(playerid,Float:Distancia,VehID)
{
new Float:PosV[3];
GetVehiclePos(VehID,PosV[0],PosV[1],PosV[2]);
if(IsPlayerInRangeOfPoint(playerid,Distancia,PosV[0],PosV[1],PosV[2]))
{
return 1;
}
return 0;
}
// Put this in SetVehicleEngine
if(VehicleBomb{GetPlayerVehicleID(playerid)}) //Vehicle has a bomb attached
{
new Float:MyPos[3];
GetVehiclePos(veh, MyPos[0], MyPos[1], MyPos[2]);
CreateExplosion(MyPos[0], MyPos[1], MyPos[2], 6, 8.0);
VehicleBomb{veh} = 0;
}
CMD:engine(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid), string[128];
if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == VEHICLE_PARAMS_ON)
{
SetVehicleEngine(vehicleid, playerid);
}
else if((engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET))
{
SetTimerEx("SetVehicleEngine", 2000, 0, "dd", vehicleid, playerid);
if(PlayerInfo[playerid][pMask] == 1) { format(string, sizeof(string), "Stranger has successfully started their Vehicle engine"); }
else { format(string, sizeof(string), "* %s has successfully started their Vehicle engine", GetPlayerNameEx(playerid)); }
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
return 1;
}
CMD:pcb(playerid, params[])
{
if(PlayerInfo[playerid][pFaction] != 4 && PlayerInfo[playerid][pLeader] != 4) return SendClientMessage(playerid, COLOR_GRAD2, "You're not a member of the International Contract Agency !");
if(PlayerInfo[playerid][pC4]) return SendClientMessage(playerid, COLOR_GRAD2, " You can only deploy 1 C4 at a time !");
if(!PlayerInfo[playerid][pBombs]) return SendClientMessage(playerid, COLOR_GRAD2, "You do not have C4!");
new closestcar = GetClosestCar(playerid, GetPlayerVehicleID(playerid));
if(!IsPlayerInRangeOfVehicle(playerid, closestcar, 4.0) || closestcar == INVALID_VEHICLE_ID) return SendClientMessage(playerid, COLOR_GRAD2, "You're not close enough to any vehicle!");
if(VehicleBomb{closestcar}) return SendClientMessage(playerid, COLOR_GRAD2, "There is already a C4 on the vehicle engine!");
VehicleBomb{closestcar} = 1;
PlacedVehicleBomb[playerid] = closestcar;
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
SendClientMessage(playerid, COLOR_GREEN, "You have placed C4 on the vehicle engine, /pickupbomb to remove it.");
PlayerInfo[playerid][pC4] = 1;
PlayerInfo[playerid][pBombs]--;
PlayerInfo[playerid][pC4Used] = 2;
return 1;
}
CMD:engine(playerid, params[])
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, -1, "You must be the driver of a vehicle to use this command.");
new vehicleid = GetPlayerVehicleID(playerid);
switch(GetVehicleModel(vehicleid))
{
case 481, 509, 510: return SendClientMessageEx(playerid, COLOR_WHITE, "This command can't be used in this vehicle.");
default:
{
if(VehicleBomb{vehicleid}) //Vehicle has a bomb attached
{
new Float:x, Float:y, Float:z;
GetVehiclePos(vehicleid, x, y, z);
CreateExplosion(x, y, z, 6, 8.0);
SendClientMessage(playerid, -1, "Your car had a bomb attached to it!");
VehicleBomb{vehicleid} = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
if(PlacedVehicleBomb[i] != vehicleid) continue;
PlacedVehicleBomb[i] = INVALID_VEHICLE_ID;
PlayerInfo[i][pC4] = 0;
SendClientMessage(i, -1, "The bomb you planted has been triggered!");
break;
}
}
new temp[7];
GetVehicleParamsEx(vehicleid, temp[0], temp[1], temp[2], temp[3], temp[4], temp[5], temp[6]);
if(temp[0] == VEHICLE_PARAMS_ON) SetVehicleEngine(vehicleid, playerid);
else if((temp[0] == VEHICLE_PARAMS_OFF || temp[0] == VEHICLE_PARAMS_UNSET))
{
SetTimerEx("SetVehicleEngine", 2000, 0, "dd", vehicleid, playerid);
if(PlayerInfo[playerid][pMask]) ProxDetector(30.0, playerid, "Stranger has successfully started their Vehicle engine", COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
else
{
new string[75];
format(string, sizeof(string), "* %s has successfully started their Vehicle engine", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
}
}
}
}
return 1;
}
pawn Код:
|