View difference between Paste ID: tjnhrNut and EUmEMjF0
SHOW: | | - or go back to the newest paste.
1
/*
2
3
	Inspired by Hiddos's filterscript http://forum.sa-mp.com/showthread.php?t=235383
4
5
	This shows the true strength of boredom
6
7
	Hopefully this one is fixed!
8
*/
9
10
#include <a_samp>
11
12
enum PlayerI
13
{
14
	PTimeMin,
15
	PTimeHour
16
}
17
18
new PlayerInfo[MAX_PLAYERS][PlayerI];
19
20
//Variables
21
22
new ScaryCow;
23
new ScaredPlayer;
24
new player =-1;
25
new timers[2];
26
//Forwards
27
28
forward ScarePlayer();
29
forward Destroy();
30
31
//Functions
32
33
GetPlayerID() {
34
35
    new Prandom = random(MAX_PLAYERS);
36
    if(IsPlayerConnected(Prandom)) return 1;
37-
    return 0;
37+
    return -0;
38
}
39
40
GetXYInFrontOfPlayer(playerid, &Float:XP, &Float:YP, Float:distance)
41
{	// Created by Y_Less
42
43
	new Float:a;
44
45
	GetPlayerPos(playerid, XP, YP, a);
46
	GetPlayerFacingAngle(playerid, a);
47
48
	if (GetPlayerVehicleID(playerid)) {
49
	    GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
50
	}
51
52
	XP += (distance * floatsin(-a, degrees));
53
	YP += (distance * floatcos(-a, degrees));
54
}
55
56
//------------------------------------------------
57
58
public OnFilterScriptInit()
59
{
60
	print("Welcome to the most useless filterscript you will ever see.");
61
	print("Why did you even download this crap?");
62
	
63
	ScaryCow = CreateObject(16442, 0, 0, 0, 0, 0, 0);
64
	
65
	timers[0] = SetTimer("ScarePlayer", 30000, true);
66
	
67
	return 1;
68
}
69
70
//------------------------------------------------
71
72
public OnFilterScriptExit()
73
{
74
	KillTimer(timers[0]);
75
	KillTimer(timers[1]);
76
	
77
	return 1;
78
}
79
80
//------------------------------------------------
81
82
public OnPlayerDisconnect(playerid, reason)
83
{
84
	if(playerid == ScaredPlayer) ScarePlayer();
85
	
86
	return 1;
87
}
88
89
//------------------------------------------------
90
91
public ScarePlayer()
92
{
93
	player = GetPlayerID();
94
	new Float:pos[4], Hour, Min;
95
	
96-
	if(player == 0) {}
96+
	if(player == -1) {}
97
	
98
	
99
	if(IsPlayerInAnyVehicle(player)) GetVehiclePos(GetPlayerVehicleID(player), pos[0], pos[1], pos[2]);
100
	else GetPlayerPos(player, pos[0], pos[1], pos[2]);
101
	
102
	GetPlayerFacingAngle(player, pos[3]);
103
 	GetXYInFrontOfPlayer(player, pos[0], pos[1], 3);
104
 	
105
 	PlayAudioStreamForPlayer(player, "http://sf-cnr.co.uk/lul.mp3");
106
 	
107
  	SetObjectPos(ScaryCow, pos[0], pos[1], pos[2]);
108
   	SetObjectRot(ScaryCow, 0, 0, pos[3]-90);
109
   	
110
   	GetPlayerTime(player, Hour, Min);
111
    PlayerInfo[player][PTimeHour] = Hour;
112
   	PlayerInfo[player][PTimeMin] = Min;
113
   	
114
   	SetPlayerTime(player,0,0);
115
   	SetPlayerWeather(player, 8);
116
   	
117
    timers[1] = SetTimer("Destroy", 4000, false);
118
    
119
   	return 1;
120
}
121
122
//------------------------------------------------
123
124
public Destroy()
125
{
126
	SetObjectPos(ScaryCow, 0, 0, 0);
127
	PlayAudioStreamForPlayer(player, "stap");
128
	SetPlayerTime(player,PlayerInfo[player][PTimeHour],PlayerInfo[player][PTimeMin]);
129
   	SetPlayerWeather(player, 0);
130
}