Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-*/
- /* Shark FilterScript V1 by iPLEOMAX, 2011 */
- /* */
- /* This System is based on my upcoming include: */
- /* PlayerSpectateObject (Alternative way/idea) */
- /* */
- /* NOTE: */
- /* Give/Keep the Credits if you use anything from here! */
- /*-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-*/
- #include <a_samp>
- new
- Shark[MAX_PLAYERS][3],
- Float:SharkSPD[MAX_PLAYERS],
- bool:SharkMoving[MAX_PLAYERS],
- bool:SharkEnabled[MAX_PLAYERS]
- ;
- public OnFilterScriptInit()
- {
- print(" TheShark by iPLEOMAX.");
- return true;
- }
- public OnFilterScriptExit()
- {
- return true;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- DisableShark(playerid, false);
- return true;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- DisableShark(playerid, false);
- return true;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if (newkeys & KEY_FIRE && SharkEnabled[playerid])
- {
- if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 594) { SharkSPD[playerid] = 1.0; }
- } else if (newkeys == 0) { SharkSPD[playerid] = 0.3; }
- if (newkeys & KEY_CROUCH && SharkEnabled[playerid])
- {
- if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 594)
- {
- new Float:P[3];
- GetVehiclePos(GetPlayerVehicleID(playerid), P[0], P[1], P[2]);
- if(P[2] < -0.1)
- {
- GetVehicleVelocity(GetPlayerVehicleID(playerid), P[0], P[1], P[2]);
- SetVehicleVelocity(GetPlayerVehicleID(playerid), P[0], P[1], 0.3);
- }
- }
- }
- if (newkeys & 8 && !SharkMoving[playerid] && SharkEnabled[playerid])
- {
- if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 594)
- {
- SharkMoving[playerid] = true;
- Shark[playerid][2] = SetTimerEx("MoveShark", 300, true, "d", playerid);
- }
- } else if (newkeys == 0) { KillTimer(Shark[playerid][2]); SharkMoving[playerid] = false; }
- return true;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp(cmdtext, "/shark", true, 6))
- {
- if(GetPlayerAnimationIndex(playerid))
- {
- new animlib[32], animname[32];
- GetAnimationName(GetPlayerAnimationIndex(playerid), animlib, sizeof animlib , animname, sizeof animname);
- if(strcmp(animlib, "SWIM", true)) return SendClientMessage(playerid, 0xFF0000FF, "You need to be on water to use this command.");
- }
- if(SharkEnabled[playerid])
- {
- DisableShark(playerid, true);
- } else {
- new Float:P[4];
- GetPlayerPos(playerid, P[0], P[1], P[2]);
- SetPlayerPos(playerid, P[0], P[1], 0.30);
- GetPlayerFacingAngle(playerid, P[3]);
- Shark[playerid][0] = CreateVehicle(594, P[0], P[1], P[2], P[3], -1, -1, 0);
- LinkVehicleToInterior(Shark[playerid][0], 10);
- PutPlayerInVehicle(playerid, Shark[playerid][0], 0);
- Shark[playerid][1] = CreateObject(1608,0,0,0,0,0,0,80);
- AttachObjectToVehicle(Shark[playerid][1], GetPlayerVehicleID(playerid),0,0,0.7,8,0,0);
- SetPlayerHealth(playerid, 0x107FFF);
- SetVehicleHealth(playerid, 0x107FFF);
- SharkEnabled[playerid] = true;
- SendClientMessage(playerid, 0x00FFFFFF, ".:: Shark by iPLEOMAX ::.");
- SendClientMessage(playerid, 0xFFFFFFFF, "- Hold 'UP' arrow key to move shark forward.");
- SendClientMessage(playerid, 0xFFFFFFFF, "- Hold 'DOWN' arrow key to do nothing, do sharks move backward? o_O");
- SendClientMessage(playerid, 0xFFFFFFFF, "- Hold 'Handbrake' while going Left/Right to make accurate turns.");
- SendClientMessage(playerid, 0xFFFFFFFF, "- Hold 'Fire Key' to move faster.");
- SendClientMessage(playerid, 0xFFFFFFFF, "- Press the 'Horn' Key to Jump.");
- }
- return true;
- }
- return false;
- }
- forward MoveShark(playerid);
- public MoveShark(playerid)
- {
- new Float:P[4];
- GetVehicleVelocity(GetPlayerVehicleID(playerid), P[0], P[1], P[2]);
- GetVehicleZAngle(GetPlayerVehicleID(playerid), P[3]);
- SetVehicleVelocity(GetPlayerVehicleID(playerid), floatsin(-P[3], degrees)
- * SharkSPD[playerid], floatcos(P[3], degrees)
- * SharkSPD[playerid] , P[2]+0.02);
- return true;
- }
- forward DisableShark(playerid, bool:other);
- public DisableShark(playerid, bool:other)
- {
- SharkSPD[playerid] = 0.3;
- DestroyObject(Shark[playerid][1]);
- DestroyVehicle(Shark[playerid][0]);
- KillTimer(Shark[playerid][2]);
- SharkEnabled[playerid] = false;
- SharkMoving[playerid] = false;
- if(other)
- {
- new Float:P[3];
- GetPlayerPos(playerid, P[0], P[1], P[2]);
- SetPlayerPos(playerid, P[0], P[1], P[2]+3);
- SetPlayerHealth(playerid, 100.0);
- }
- return true;
- }
- /* -=-=-=-=-=-=-=- End of code! -=-=-=-=-=-=-=- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement