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);
- object_z = z8 + floatmul(z2, sa);
- foreach (new i : Player)
- {
- if(IsPlayerInRangeOfPoint(i,20,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+3, 12, 5.0);
- }
- }
- }
- }
- return 1;
- }
- forward cannonfired(playerid);
- public cannonfired(playerid)
- {
- firedcannon[playerid] = 0;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment