Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*=============================================================================*
- * Sistema Shark-Killer V 1.0 *
- * Autor: NullBot *
- * Versión: 1.0 *
- * Versión SA-MP: 0.3.7 *
- * Tipo de script: FilterScript *
- * Fecha: 1/10/2015 *
- *=============================================================================*/
- /*------------------------------------------------------------------------------*/
- #define Version "1.0"
- #include <a_samp>
- #define MAX_TIMEINWATER 10
- #define ROJO 0xE60000FF
- #define MAX_DEEP 10
- /*-- ANTI DESCOMPILADOR --*/
- AntiDeAMX()
- {
- new a[][] =
- {
- "Unarmed (Fist)",
- "Brass K"
- };
- #pragma unused a
- }
- /*-- Callbacks --*/
- public OnFilterScriptInit()
- {
- AntiDeAMX();
- /* TIMERS */
- SetTimer("TIMEINWATER", 968, true);
- for(new i = 0, plys = GetMaxPlayers(); i < plys; i++)
- {
- SetPVarInt(i, "Spawn", 0);
- SetPVarInt(i, "TimeSwiming", 0);
- SetPVarInt(i, "Object_Shark", -1);
- }
- print("\n");
- print(" *-----------------------*");
- printf(" # Shark-Killer v%s #", Version);
- print(" *-----------------------*");
- print("\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- SetPVarInt(playerid, "Spawn", 0);
- SetPVarInt(playerid, "TimeSwiming", 0);
- SetPVarInt(playerid, "Object_Shark", -1);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(IsPlayerNPC(playerid)) return 1;
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPVarInt(playerid, "Spawn", 0);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- SetPVarInt(playerid, "Spawn", 1);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- SetPVarInt(playerid, "Spawn", 0);
- SetPVarInt(playerid,"TimeSwiming",0);
- if(GetPVarInt(playerid, "Object_Shark") > -1 )
- DestroyObject(GetPVarInt(playerid, "Object_Shark"));
- SetPVarInt(playerid, "Object_Shark",-1);
- SetCameraBehindPlayer(playerid);
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid)
- {
- if(GetPVarInt(playerid, "Object_Shark") > -1)
- {
- SetPVarInt(playerid,"TimeSwiming",0);
- SetCameraBehindPlayer(playerid);
- DestroyObject(GetPVarInt(playerid, "Object_Shark"));
- SetPVarInt(playerid, "Object_Shark",-1);
- }
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- if(IsPlayerNPC(playerid)) return 1;
- return 1;
- }
- forward TIMEINWATER();
- public TIMEINWATER()
- {
- new Float: x, Float: y, Float: z;
- for(new i = 0, plys = GetMaxPlayers(); i < plys; i++)
- {
- if(GetPVarInt(i,"Spawn") && !IsPlayerNPC(i) )
- {
- GetPlayerPos(i,x,y,z);
- #pragma unused x
- #pragma unused y
- if(z < MAX_DEEP)
- {
- if(GetPVarInt(i, "Object_Shark") == -1)
- MakeShark(i);
- }
- if(z < 0 && GetPVarInt(i, "Object_Shark") > -1)
- {
- SetPVarInt(i,"TimeSwiming",GetPVarInt(i,"TimeSwiming") + 1);
- }
- if(z > 1.2 && GetPVarInt(i, "Object_Shark") > -1 )
- {
- SetPVarInt(i,"TimeSwiming",0);
- DestroyObject(GetPVarInt(i, "Object_Shark"));
- SetPVarInt(i, "Object_Shark",-1);
- SetCameraBehindPlayer(i);
- }
- }
- }
- }
- forward MakeShark(playerid);
- public MakeShark(playerid)
- {
- new Float: Px, Float: Py, Float: Pz;
- GetPlayerPos(playerid,Px,Py,Pz);
- SetPlayerCameraPos(playerid, Px, Py, Pz-2);
- SetPVarInt(playerid, "Object_Shark", CreateObject(1608,Px,Py,Pz-15.0,45.0,45.0,0.0,200.0));
- PlayAudioStreamForPlayer(playerid, "http://sampleswap.org/samples-ghost/INSTRUMENTS%20multisampled/PADS%20and%20STRINGS/Heavy%20Strings/2415%5Bkb%5DHeavyStringsC-02.wav.mp3");
- MoveObject( GetPVarInt(playerid,"Object_Shark"),Px,Py,Pz,3.0);
- FollowCamera(playerid);
- }
- forward FollowCamera(playerid);
- public FollowCamera(playerid)
- {
- if(GetPVarInt(playerid, "Object_Shark") > -1)
- {
- new Float: x, Float: y, Float: z;
- GetObjectPos(GetPVarInt(playerid, "Object_Shark"),x,y,z);
- GetPlayerPos(playerid,x,y,z);
- if( GetPVarInt(playerid,"TimeSwiming") < MAX_TIMEINWATER)
- SetPlayerCameraLookAt(playerid, x, y, z,2);
- else SetCameraBehindPlayer(playerid);
- return SetTimerEx("FollowCamera",795,false,"i",playerid);
- }
- else SetCameraBehindPlayer(playerid);
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- new Float: x, Float: y, Float: z;
- for(new i = 0, plys = GetMaxPlayers(); i < plys; i++)
- {
- if(GetPVarInt(i,"Object_Shark") > -1 && objectid == GetPVarInt(i,"Object_Shark") )
- {
- GetObjectPos(objectid,x,y,z);
- if (IsPlayerInRangeOfPoint(i, 2.0, x, y, z) && GetPVarInt(i,"Spawn") && GetPVarInt(i,"TimeSwiming")> 0 && !IsPlayerNPC(i) )
- {
- SendClientMessage(i, ROJO, "Killed by a Shark!");
- SetCameraBehindPlayer(i);
- SetPVarInt(i,"TimeSwiming",0);
- SetPlayerHealth(i,0.0);
- DestroyObject(GetPVarInt(i, "Object_Shark"));
- SetPVarInt(i, "Object_Shark",-1);
- }
- if(GetPVarInt(i,"Object_Shark") != -1)
- {
- GetPlayerPos(i, x, y, z);
- SetPlayerFacingAngleToPlayer(i);
- MoveObject( GetPVarInt(i,"Object_Shark"),x,y,z-1.5,4.5);
- }
- }
- }
- return 1;
- }
- stock SetPlayerFacingAngleToPlayer(playerid)
- {
- new
- Float:X1,
- Float:Y1,
- Float:X2,
- Float:Y2,
- Float:Angle;
- GetPlayerPos(playerid, X1, Y1, Angle);
- GetObjectPos(GetPVarInt(playerid,"Object_Shark"), X2, Y2,Angle);
- GetAngle(X2, Y2, X1, Y1, Angle);
- SetObjectRot(GetPVarInt(playerid,"Object_Shark"),0.0,0.0,Angle+180);
- }
- //Por Zoutdaxv
- stock GetAngle(Float:X, Float:Y, Float:CurrentX, Float:CurrentY, &Float:Angle)
- {
- Angle = atan2(Y-CurrentY, X-CurrentX);
- Angle = floatsub(Angle, 90.0);
- if(Angle < 0.0) Angle = floatadd(Angle, 360.0);
- }
- //------------------------------------------------------------------------------
- /*
- www.puramasacre.com
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement