Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new firedcannon[MAX_PLAYERS];
- stock randomEx(min, max)
- {
- new rand9 = random(max-min)+min;
- return rand9;
- }//credits to yless
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys == KEY_FIRE)
- {
- if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 601)
- {
- if(firedcannon[playerid] == 0)
- {
- firedcannon[playerid] = 1;
- SetTimerEx("cannonfired", 1000, false,"i",playerid);
- new
- Float:x8, Float:y8, Float:z8,
- Float:x2, Float:y2, Float:z2,
- Float:x7, Float:y7, Float:z7,
- Float:object_x, Float:object_y, Float:object_z;
- GetPlayerPos(playerid,x7,y7,z7);
- GetPlayerCameraPos(playerid, x8,y8,z8);
- GetPlayerCameraFrontVector(playerid, x2,y2,z2);
- new sa = randomEx(30, 100);
- object_x = x8 + floatmul(x2, sa);
- object_y = y8 + floatmul(y2, sa);
- MapAndreas_FindZ_For2DCoord(object_x, object_y, object_z);
- if(z8+floatmul(z2, sa) < object_z)
- {
- foreach (new i : Player)
- {
- if(GetPlayerTeam(i) != (GetPlayerTeam(playerid)))
- {
- if(i != playerid)
- {
- if(IsPlayerInRangeOfPoint(i,40,x7,y7,z7))
- {
- GetPlayerPos(i,x7,y7,z7);
- if(GetPlayerCameraFrontVector(playerid, x7,y7,z7))
- {
- CreateExplosion(x7,y7,z7, 12, 5.0);
- }
- }
- }
- else CreateExplosion(object_x, object_y, object_z, 12, 5.0);
- }
- else CreateExplosion(object_x, object_y, object_z, 12, 5.0);
- }
- }
- else if(z8+floatmul(z2, sa) > object_z)
- {
- foreach (new i : Player)
- {
- if(GetPlayerTeam(i) != (GetPlayerTeam(playerid)))
- {
- if(i != playerid)
- {
- if(IsPlayerInRangeOfPoint(i,6,x7,y7,z7))
- {
- GetPlayerPos(i,x7,y7,z7);
- if(GetPlayerCameraFrontVector(playerid, x7,y7,z7))
- {
- CreateExplosion(x7,y7,z7, 12, 5.0);
- new Float:HP;
- GetPlayerHealth(i, HP);
- if(GetPlayerHealth(i,HP) <= 0)
- {
- if(i != playerid)
- {
- SetPlayerScore(playerid, GetPlayerScore(playerid) + 4);
- GivePlayerMoney(playerid,4000);
- SendClientMessage(playerid, COLOR_LIGHTGREEN, "Good Job on Killing him, you recived +4 scores and 4000$ money");
- SetPlayerScore(i, GetPlayerScore(playerid) - 1);
- GivePlayerMoney(i,-2000);
- }
- }
- }
- }
- }
- else CreateExplosion(object_x, object_y, z8+floatmul(z2, sa), 12, 5.0);
- }
- else CreateExplosion(object_x, object_y, z8+floatmul(z2, sa), 12, 5.0);
- }
- }
- foreach (new i : Player)
- {
- if(i != playerid)
- {
- new Float:HP;
- GetPlayerHealth(i, HP);
- if(GetPlayerHealth(i,HP) <= 0)
- {
- if(IsPlayerInRangeOfPoint(i,5,object_x, object_y, object_z))
- {
- SetPlayerScore(playerid, GetPlayerScore(playerid) + 4);
- GivePlayerMoney(playerid,4000);
- SendClientMessage(playerid, COLOR_LIGHTGREEN, "Good Job on Killing him, you recived +4 scores and 4000$ money");
- SetPlayerScore(i, GetPlayerScore(playerid) - 1);
- GivePlayerMoney(i,-2000);
- }
- }
- }
- }
- }
- }
- }
- return 1;
- }
- forward cannonfired(playerid);
- public cannonfired(playerid)
- {
- firedcannon[playerid] = 0;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment