View difference between Paste ID: UWFNqMSi and DM7bffBv
SHOW: | | - or go back to the newest paste.
1-
// I am not a PRO in scripting, So if you find any bugs, inform me kindly and I'll check it out.
1+
2-
// Catch me @ Facebook : www.facebook.com/pmanoj.pandu || Twitter : @L0V3R30Y ||
2+
#define FILTERSCRIPT
3-
// Follow me @Instagram : mjay768
3+
4-
// My website  : https://www.techngaming.co.in
4+
5-
// This is not yet finished, Still trying to make it better. So If you have any suggestions, I'm happy to hear from you. 
5+
6-
// E-Mail me your suggestions at [email protected]
6+
#include <YSI\y_ini>
7
//#include <dini>
8
#pragma tabsize 0
9
#define PATH "/MJDM/%s.ini"
10-
#include <streamer>
10+
11-
//#pragma tabsize 0
11+
12-
new message[301];
12+
new Float:x1,Float:y1,Float:z1;
13
new weapdat[13][2];
14
new cn;
15
new skin;
16-
new health;
16+
//new kills[MAX_PLAYERS];
17-
new weapon;
17+
//new deaths[MAX_PLAYERS];
18-
new armour;
18+
19
   {-2491.8706,-237.2221,39.3019,295.0867},
20
   {-2482.0308,-283.6506,40.5421,180.7190},
21
   {-2444.0479,-271.4679,35.6237,258.4264},
22
   {-2490.9055,-298.6101,35.8574,172.5956},
23
   {-2525.5771,-313.8878,39.0723,327.6012},
24
   {-2554.4729,-291.1451,25.9594,118.0751}
25
};
26
27
new weaps[][] = {
28
   {22},
29
   {23},
30
   {24},
31
   {25},
32
   {26},
33
   {27},
34
   {28},
35
   {29},
36
   {30},
37
   {31},
38
   {32}
39
};
40
41
enum pInfo
42
{
43
  pKills,
44
  pDeaths
45
}
46
47
new PlayerInfo[MAX_PLAYERS][pInfo];
48
49
forward LoadUser_data(playerid,name[],value[]);
50
public LoadUser_data(playerid,name[],value[])
51
{
52-
COMMAND:dm(playerid,params[])
52+
  INI_Int("Kills", PlayerInfo[playerid][pKills]);
53
  INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
54-
 if(InDM[playerid] ==0)
54+
  return 1;
55-
 {
55+
56-
   InDM[playerid] =1;
56+
57-
   cn++;
57+
stock UserPath(playerid)
58-
   ResetPlayerWeapons(playerid);
58+
59-
   new r = random(50);
59+
  new string[128], pName[MAX_PLAYER_NAME];
60-
   SetPlayerSkin(playerid, r);
60+
  GetPlayerName(playerid, pName,sizeof(pName));
61-
   new Random = random(sizeof(Spawns));
61+
  format(string,sizeof(string),PATH,pName);
62-
   SetPlayerPos(playerid, Spawns[Random][0],Spawns[Random][1],Spawns[Random][2]);
62+
  return string;
63-
   SetPlayerFacingAngle(playerid, Spawns[Random][3]);
63+
64-
   new Random1 = random(sizeof(weaps));
64+
65-
   GivePlayerWeapon(playerid, weaps[Random1][0], 150);
65+
#define COLOR_RED 0xFF3300
66-
   
66+
67-
 }
67+
public OnFilterScriptInit()
68
{
69
	print("\n--------------------------------------");
70
	print(" DM[Minigame] by DuskXtremeX");
71
	print("--------------------------------------\n");
72-
	SendDeathMessage(killerid, playerid, reason);
72+
73-
	if(InDM[playerid] == 1)
73+
74
75-
	  new kill[256];
75+
public OnFilterScriptExit()
76-
   	  format(kill, sizeof(kill),"%s killed %s in DM",killerid,playerid);
76+
77
	return 1;
78-
	cn -=1;
78+
79-
	if(cn ==1)
79+
80
81-
	 new winner[50];
81+
public OnPlayerRequestClass(playerid, classid)
82-
	 GetPlayerName(playerid, winner,MAX_PLAYER_NAME); //To store the last player name
82+
83-
	 new fwinner[100]; //string to announce winner
83+
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
84-
	 format(fwinner, sizeof(fwinner)," %s has won the DM[Minigame]",winner);
84+
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
85
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
86
	return 1;
87
}
88
89-
public OnPlayerPickUpPickup(playerid, pickupid)
89+
90
{
91-
	if(pickupid == health)
91+
	if(fexist(UserPath(playerid)))
92
	{
93-
	  new Float:phealth;
93+
	 INI_ParseFile(UserPath(playerid), "LoadUser_%s",.bExtra =true, .extra =playerid);
94-
	  GetPlayerHealth(playerid, phealth);
94+
95-
	  SetPlayerHealth(playerid, phealth+70);
95+
	else if(!fexist(UserPath(playerid)))
96
	{
97-
	else if(pickupid == weapon)
97+
	  new INI:File = INI_Open(UserPath(playerid));
98
	  INI_SetTag(File,"PlayerInfo");
99-
	  new ammo;
99+
	  INI_WriteInt(File,"Kills",0);
100-
	  GetPlayerAmmo(ammo);
100+
	  INI_WriteInt(File,"Deaths",0);
101-
	  if(ammo<150)
101+
	  INI_Close(File);
102
	}
103-
       GivePlayerWeapon(playerid, 29, 150);
103+
	
104-
      }
104+
105
    return 1;
106-
	else if(pickupid == armour)
106+
107
108-
	  new Float:pArmour;
108+
109-
	  GetPlayerArmour(playerid, pArmour);
109+
110-
	  SetPlayerArmour(playerid, pArmour+50);
110+
	new INI:File = INI_Open(UserPath(playerid));
111
	INI_SetTag(File,"PlayerInfo");
112
	INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
113
	INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
114
    INI_Close(File);
115
	InDM[playerid] =0;
116
	CheckWin();
117
  	return 1;
118
}
119
120
public OnPlayerSpawn(playerid)
121
{
122
    
123
	GivePlayerWeapon(playerid,26,300);
124
	GivePlayerWeapon(playerid,32,300);
125
	GivePlayerWeapon(playerid,34,100);
126
	GivePlayerWeapon(playerid,27,50);
127
	GetPlayerSkin(skin);
128
	return 1;
129
}
130
131
public OnPlayerDeath(playerid, killerid, reason)
132
{
133
    if(InDM[playerid] ==1)
134
    {
135
	  InDM[playerid] =0;
136
	  cn--;
137
	  new str[100];
138
	  new pName[MAX_PLAYER_NAME],kName[MAX_PLAYER_NAME];
139
	  GetPlayerName(killerid,kName,MAX_PLAYER_NAME);
140
	  GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
141
	  format(str, sizeof(str),"%s(%d) has been killed by %s(%d) in Deathmatch Minigame",pName,kName);
142
      PlayerInfo[killerid][pKills]++;
143
	  PlayerInfo[playerid][pDeaths]++;
144
	  CheckWin();
145
   	}
146
	return 1;
147
}
148
149
COMMAND:deathmatch(playerid, params[])
150
{
151
  
152
   if(InDM[playerid] ==0)
153
	  {
154
	  	InDM[playerid] =1;
155
	    cn++;
156
        new p;
157
	    for(p=0;p<13;p++)
158
	    {
159
	     GetPlayerWeaponData(playerid,p,weapdat[p][0],weapdat[p][1]);
160
	    }
161
	    ResetPlayerWeapons(playerid);
162
 	    new string[100];
163
	    new pName[MAX_PLAYER_NAME];
164
	    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
165
	    format(string, sizeof(string), "%s(%d) has joined DM",pName,playerid);
166
	    GetPlayerPos(playerid, x1, y1, z1);
167
	    new Random = random(sizeof(Spawns));
168
        SetPlayerPos(playerid, Spawns[Random][0],Spawns[Random][1],Spawns[Random][2]);
169
        SetPlayerFacingAngle(playerid, Spawns[Random][3]);
170
        new randomskin = random(50);
171
        SetPlayerSkin(playerid, randomskin);
172
	    new Random1 = random(sizeof(weaps));
173
        GivePlayerWeapon(playerid, weaps[Random1][0], 150);
174
	  }
175
   else if(InDM[playerid] ==1)
176
   {
177
     SendClientMessage(playerid, COLOR_RED,"You're already in DM");
178
   }
179
   return 1;
180
	} 
181
182
183
COMMAND:leavedm(playerid,params[])
184
{
185
  if(InDM[playerid] ==1)
186
	  {
187
		InDM[playerid] =0;
188
		cn--;
189
		SetPlayerPos(playerid,x1,y1,z1);
190
		SetPlayerSkin(playerid,skin);
191
		ResetPlayerWeapons(playerid);
192
		for(new p=0;p<13;p++)
193
		{
194
		  GivePlayerWeapon(playerid,weapdat[p][0],weapdat[p][1]);
195
		}
196
	  }
197
      else if(InDM[playerid] ==0) return SendClientMessage(playerid, COLOR_RED, "You're not in DM");
198
      return 1;
199
} 
200
forward CheckWin();
201
public CheckWin()
202
{
203
  if(cn ==1)
204
  {
205
	for(new i=0;i<MAX_PLAYERS;i++)
206
	{
207
	  if(InDM[i] ==1)
208
	  {
209
		new string[128], winner[MAX_PLAYER_NAME];
210
		GetPlayerName(i,winner,MAX_PLAYER_NAME);
211
		format(string,sizeof(string),"%s(%d) Has won the DeathMatch[Minigame]",winner,i);
212
	  }
213
    }
214
  }
215
}