Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Ovni by adri1
- //Idea: SnickertS
- //Ovni v2.0 Now in Hydra too by adri1
- #include <a_samp>
- // On foot
- new Ovni[MAX_PLAYERS];
- new Light[MAX_PLAYERS];
- new bomb;
- forward HideBomb();
- //On Plane Hydra
- new Ovni2[MAX_PLAYERS];
- new Light2[MAX_PLAYERS];
- new SpawnAuto[MAX_PLAYERS];
- public OnPlayerConnect(playerid)
- {
- Ovni[playerid] = 0;
- Light[playerid] = 0;
- Ovni2[playerid] = 0;
- Light2[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- Ovni[playerid] = 0;
- Light[playerid] = 0;
- Ovni2[playerid] = 0;
- Light2[playerid] = 0;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(!IsPlayerInAnyVehicle(playerid))
- {
- if(Ovni[playerid] == 1)
- {
- if (newkeys & KEY_FIRE)
- {
- new Float:x,Float:y,Float:z,Float:a;
- GetPlayerPos(playerid,x,y,z);
- GetPlayerFacingAngle(playerid,a);
- bomb = CreateObject(3786, x, y, z-2, 0, 0, a-90);
- MoveObject(bomb, x, y, z-300, 30.0);
- SetTimer("HideBomb",1000,0);
- }
- else if (newkeys & KEY_YES)
- {
- if(Light[playerid] == 0)
- {
- SetPlayerAttachedObject(playerid,5,18656,1,0.918999,-0.342001,-0.760999,-12.000008,0.000000,90.000,1.000000,1.000000,1.000000);
- Light[playerid] = 1;
- }
- else if(Light[playerid] == 1)
- {
- SetPlayerAttachedObject(playerid,5,18657,1,0.918999,-0.342001,-0.760999,-12.000008,0.000000,90.000,1.000000,1.000000,1.000000);
- Light[playerid] = 2;
- }
- else if(Light[playerid] == 2)
- {
- SetPlayerAttachedObject(playerid,5,18658,1,0.918999,-0.342001,-0.760999,-12.000008,0.000000,90.000,1.000000,1.000000,1.000000);
- Light[playerid] = 0;
- }
- }
- else if (newkeys & KEY_NO)
- {
- RemovePlayerAttachedObject(playerid, 5);
- Light[playerid] = 0;
- }
- }
- }
- else if(IsPlayerInAnyVehicle(playerid))
- {
- if(Ovni2[playerid] == 1)
- {
- if (newkeys & KEY_YES)
- {
- if(Light2[playerid] == 0)
- {
- SetPlayerAttachedObject(playerid,3,18656,1,5.162999,-0.976000,-4.204011,0.000000,-2.100000,106.999916,4.111006,2.611997,5.209000);
- Light2[playerid] = 1;
- }
- else if(Light2[playerid] == 1)
- {
- SetPlayerAttachedObject(playerid,3,18657,1,5.162999,-0.976000,-4.204011,0.000000,-2.100000,106.999916,4.111006,2.611997,5.209000);
- Light2[playerid] = 2;
- }
- else if(Light2[playerid] == 2)
- {
- SetPlayerAttachedObject(playerid,3,18658,1,5.162999,-0.976000,-4.204011,0.000000,-2.100000,106.999916,4.111006,2.611997,5.209000);
- Light2[playerid] = 0;
- }
- }
- else if (newkeys & KEY_NO)
- {
- RemovePlayerAttachedObject(playerid, 3);
- Light2[playerid] = 0;
- }
- }
- }
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- if(Ovni2[playerid] == 1)
- {
- for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
- {
- if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);
- Ovni2[playerid] = 0;
- }
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp(cmdtext, "/ovni", true))
- {
- if(Ovni[playerid] == 0)
- {
- SetPlayerAttachedObject(playerid,0,3515,1,-0.609999,0.000000,-0.003999,0.000000,90.900000,0.000000,0.832001,0.818000,0.553001);
- SetPlayerAttachedObject(playerid,1,18843,1,-0.712000,0.000000,0.000000,0.000000,0.000000,0.000000,0.014000,0.015000,0.016000);
- SetPlayerAttachedObject(playerid,2,3515,1,0.133001,-0.011000,0.017000,0.000000,-90.000000,0.000000,0.818000,0.772001,0.359001);
- SetPlayerAttachedObject(playerid,3,18843,1,0.074999,-0.017000,0.026999,0.000000,0.000000,0.000000,0.019000,0.020000,0.020000);
- Ovni[playerid] = 1;
- SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
- }
- else if(Ovni[playerid] == 1)
- {
- for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
- {
- if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);
- Ovni[playerid] = 0;
- }
- }
- return 1;
- }
- if(!strcmp(cmdtext, "/ovni2", true))
- {
- if(Ovni2[playerid] == 0)
- {
- SetPlayerAttachedObject(playerid,0,3515,1,1.281999,-1.577000,-0.281000,-0.499999,90.800125,-0.599996,4.183998,4.936002,2.922001);
- SetPlayerAttachedObject(playerid,1,3515,1,5.023988,-1.466000,-0.072000,0.199999,-89.300010,8.799994,4.148001,4.529000,1.617000);
- SetPlayerAttachedObject(playerid,2,18843,1,4.163002,-1.490000,0.000000,0.000000,0.000000,0.000000,0.089000,0.117999,0.099000);
- Ovni2[playerid] = 1;
- CrearVehiculo(playerid, 520);
- }
- else if(Ovni2[playerid] == 1)
- {
- for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
- {
- if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);
- Ovni2[playerid] = 0;
- }
- }
- return 1;
- }
- return 0;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(Ovni[playerid] == 1)
- {
- for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
- {
- if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);
- }
- }
- return 1;
- }
- public HideBomb()
- {
- new Float:x, Float:y, Float:z;
- GetObjectPos(bomb, x, y, z);
- DestroyObject(bomb);
- CreateExplosion(x, y, z, 2, 200.0);
- return 1;
- }
- CrearVehiculo(playerid, modelid)
- {
- new Auto, Float:x,Float:y,Float:z,Float:angulo;
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
- {
- Auto = GetPlayerVehicleID(playerid);
- GetVehiclePos(Auto, x, y, z);
- GetVehicleZAngle(Auto, angulo);
- }
- else
- {
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, angulo);
- }
- if(SpawnAuto[playerid] != 0)DestroyVehicle(SpawnAuto[playerid]);
- SpawnAuto[playerid] = CreateVehicle(modelid,x,y,z,angulo,-1,-1,60);
- PutPlayerInVehicle(playerid,SpawnAuto[playerid],0);
- LinkVehicleToInterior(Auto, GetPlayerInterior(playerid));
- SetVehicleVirtualWorld(Auto, GetPlayerVirtualWorld(playerid));
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment