Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.68 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. //#define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6.  
  7. #if defined FILTERSCRIPT
  8.  
  9. #define PURPLE 0xB360FDFF //group colours
  10.  
  11.  
  12.  
  13. stock groupexists(groupname[])
  14. {
  15. new gname[20];
  16. for(new i=0;i<=MAX_PLAYERS;i++)
  17. {
  18. if(IsPlayerConnected(i))
  19. {
  20. if(GetPVarInt(i,"groupid") != 0)
  21. {
  22. GetPVarString(i, "gname", gname,sizeof(gname));
  23. if(!strcmp(groupname,gname,true)) return 1;
  24. }
  25. }
  26. }
  27. return 0;
  28. }
  29. stock getgroupid(groupname[])
  30. {
  31. new gname[20], gid=0;
  32. for(new i=0;i<=MAX_PLAYERS;i++)
  33. {
  34. if(IsPlayerConnected(i))
  35. {
  36. if(GetPVarInt(i,"groupid") != 0)
  37. {
  38. GetPVarString(i,"gname",gname,sizeof(gname));
  39. if(!strcmp(groupname,gname,true)) return GetPVarInt(i,"groupid");
  40. if(strfind(gname,groupname) != -1) gid = GetPVarInt(i,"groupid");
  41. }
  42. }
  43. }
  44. return gid;
  45. }
  46. stock getgroupname(groupid)
  47. {
  48. new gname[20];
  49. for(new i=0;i<=MAX_PLAYERS;i++)
  50. {
  51. if(IsPlayerConnected(i))
  52. {
  53. if(GetPVarInt(i,"groupid") == groupid)
  54. {
  55. GetPVarString(i,"gname",gname,sizeof(gname));
  56. return gname;
  57. }
  58. }
  59. }
  60. return gname;
  61. }
  62.  
  63.  
  64.  
  65. stock groupchat(playerid,text[])
  66. {
  67. new string[128], name[MAX_PLAYER_NAME];
  68. new gid = GetPVarInt(playerid,"groupid");
  69. GetPlayerName(playerid,name,sizeof(name));
  70. format(string,sizeof(string),"%s(%d): %s",name,playerid,text);
  71. for(new i=0;i<=MAX_PLAYERS;i++)
  72. {
  73. if(GetPVarInt(i,"groupid") == gid) SendClientMessage(i,PURPLE,string);
  74. if(GetPVarInt(i,"groupid") != gid && GetPVarInt(i,"level") != 0) SendClientMessage(i,PURPLE,string);
  75. }
  76. }
  77. stock groupmessage(gid,text[])
  78. {
  79. for(new i=0;i<=MAX_PLAYERS;i++)
  80. {
  81. if(GetPVarInt(i,"groupid") == gid) SendClientMessage(i,PURPLE,text);
  82. if(GetPVarInt(i,"groupid") != gid && GetPVarInt(i,"level") != 0) SendClientMessage(i,PURPLE,text);
  83. }
  84. }
  85.  
  86.  
  87. public OnFilterScriptInit()
  88. {
  89. print("\n--------------------------------------");
  90. print(" Blank Filterscript by your name here");
  91. print("--------------------------------------\n");
  92. return 1;
  93. }
  94.  
  95. public OnFilterScriptExit()
  96. {
  97. return 1;
  98. }
  99.  
  100. #else
  101.  
  102. main()
  103. {
  104. print("\n----------------------------------");
  105. print(" Blank Gamemode by your name here");
  106. print("----------------------------------\n");
  107. }
  108.  
  109. #endif
  110.  
  111. public OnGameModeInit()
  112. {
  113. // Don't use these lines if it's a filterscript
  114. SetGameModeText("Blank Script");
  115. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  116. return 1;
  117. }
  118.  
  119. public OnGameModeExit()
  120. {
  121. return 1;
  122. }
  123.  
  124. public OnPlayerRequestClass(playerid, classid)
  125. {
  126. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  127. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  128. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  129. return 1;
  130. }
  131.  
  132. public OnPlayerConnect(playerid)
  133. {
  134. return 1;
  135. }
  136.  
  137. public OnPlayerDisconnect(playerid, reason)
  138. {
  139. return 1;
  140. }
  141.  
  142. public OnPlayerSpawn(playerid)
  143. {
  144. if(GetPVarInt(playerid,"groupid") != 0)
  145. {
  146. new gid=999, lid;
  147. for(new i=0;i<=MAX_PLAYERS;i++)
  148. {
  149. if(IsPlayerConnected(i))
  150. {
  151. if(GetPVarInt(i,"groupid") == GetPVarInt(playerid,"groupid") && i != playerid)
  152. {
  153. if(GetPVarInt(i,"groupjid") < gid)
  154. {
  155. gid = GetPVarInt(i,"groupjid");
  156. lid = i;
  157. }
  158. }
  159. }
  160. }
  161. DeletePVar(playerid,"gname");
  162. DeletePVar(playerid,"groupid");
  163. if(gid != 999)
  164. {
  165. new string[80];
  166. new name[MAX_PLAYER_NAME], gname[20];
  167. GetPlayerName(playerid,name,sizeof(name));
  168. GetPVarString(lid,"gname",gname,sizeof(gname));
  169. format(string,sizeof(string),"[%s] %s(%d) Has Left The Group",gname,name,playerid);
  170. groupmessage(GetPVarInt(lid,"groupid"),string);
  171. if(GetPVarInt(playerid,"groupjid") == 0)
  172. {
  173. GetPlayerName(lid,name,sizeof(name));
  174. format(string,sizeof(string),"[%s] %s(%d) Is The New Group Leader",gname,name,lid);
  175. groupmessage(GetPVarInt(lid,"groupid"),string);
  176. DeletePVar(lid,"groupjid");
  177. }
  178. }
  179. }
  180.  
  181. public OnPlayerDeath(playerid, killerid, reason)
  182. {
  183. return 1;
  184. }
  185.  
  186. public OnVehicleSpawn(vehicleid)
  187. {
  188. return 1;
  189. }
  190.  
  191. public OnVehicleDeath(vehicleid, killerid)
  192. {
  193. return 1;
  194. }
  195.  
  196. public OnPlayerText(playerid, text[])
  197. {
  198. return 1;
  199. }
  200.  
  201. public OnPlayerCommandText(playerid, cmdtext[])
  202. {
  203. CMD:groupcreate(playerid,params[])
  204. {
  205. if(GetPVarInt(playerid,"groupid") != 0) return SendClientMessage(playerid,RED,"You Need To Leave Your Current Group Before Creating A New One");
  206. new gid=1, gname[20],string[128];
  207. if(sscanf(params,"s[20]",gname)) return SendClientMessage(playerid,RED,"USAGE: /groupcreate [name]");
  208. if(!validtext(gname)) return SendClientMessage(playerid,RED,"Error Invalid Group Name");
  209. if(groupexists(gname)) return SendClientMessage(playerid,RED,"A Group Under That Name Already Exists");
  210. for(new i=0;i<=MAX_PLAYERS;i++)
  211. {
  212. if(IsPlayerConnected(i))
  213. {
  214. if(GetPVarInt(i,"groupid") != 0)
  215. {
  216. if(GetPVarInt(i,"groupid") == gid) gid++;
  217. }
  218. }
  219. }
  220. SetPVarInt(playerid,"groupjid",0);
  221. SetPVarString(playerid,"gname",gname);
  222. SetPVarInt(playerid,"groupid",gid);
  223. format(string,sizeof(string),"You Have Created The Group %s. Use /groupinvite [id] To Invite People",gname);
  224. return SendClientMessage(playerid,PURPLE,string);
  225. }
  226. CMD:groupleave(playerid,params[])
  227. {
  228. if(GetPVarInt(playerid,"groupid") == 0) return SendClientMessage(playerid,RED,"You Are Not In A Group");
  229. new gid=999, lid;
  230. for(new i=0;i<=MAX_PLAYERS;i++)
  231. {
  232. if(IsPlayerConnected(i))
  233. {
  234. if(GetPVarInt(i,"groupid") == GetPVarInt(playerid,"groupid") && i != playerid)
  235. {
  236. if(GetPVarInt(i,"groupjid") < gid)
  237. {
  238. gid = GetPVarInt(i,"groupjid");
  239. lid = i;
  240. }
  241. }
  242. }
  243. }
  244. DeletePVar(playerid,"gname");
  245. DeletePVar(playerid,"groupid");
  246. if(gid != 999)
  247. {
  248. new name[MAX_PLAYER_NAME], gname[20], string[128];
  249. GetPlayerName(playerid,name,sizeof(name));
  250. GetPVarString(lid,"gname",gname,sizeof(gname));
  251. format(string,sizeof(string),"[%s] %s(%d) Has Left The Group",gname,name,playerid);
  252. groupmessage(GetPVarInt(lid,"groupid"),string);
  253. if(GetPVarInt(playerid,"groupjid") == 0)
  254. {
  255. GetPlayerName(lid,name,sizeof(name));
  256. format(string,sizeof(string),"[%s] %s(%d) Is The New Group Leader",gname,name,lid);
  257. groupmessage(GetPVarInt(lid,"groupid"),string);
  258. DeletePVar(lid,"groupid");
  259. }
  260. }
  261. return SendClientMessage(playerid,PURPLE,"You Have Left Your Group");
  262. }
  263. CMD:groupjoin(playerid,params[])
  264. {
  265. if(GetPVarInt(playerid,"groupid") != 0) return SendClientMessage(playerid,RED,"You Are Already In A Group");
  266. new gid, gname[20], string[128];
  267. if(sscanf(params,"s[20]",gname)) return SendClientMessage(playerid,RED,"USAGE: /groupjoin [name]");
  268. if(!getgroupid(gname)) return SendClientMessage(playerid,RED,"Invalid Group Name");
  269. gid = getgroupid(gname);
  270. if(GetPVarInt(playerid,"groupinv") != gid)
  271. {
  272. for(new i=0;i<=MAX_PLAYERS;i++)
  273. {
  274. if(IsPlayerConnected(i))
  275. {
  276. if(GetPVarInt(i,"groupid") != 0 && GetPVarInt(i,"groupjid") == 0)
  277. {
  278. format(string,sizeof(string),"%s Has Asked To Join Your Group");
  279. SendClientMessage(i,PURPLE,string);
  280. SetPVarInt(playerid,"groupask",gid);
  281. }
  282. }
  283. }
  284. format(string,sizeof(string),"You Have Asked To Join The Group \"%s\"",getgroupname(gid));
  285. return SendClientMessage(playerid,PURPLE,string);
  286. }
  287. SetPVarInt(playerid,"groupid",gid);
  288. SetPVarString(playerid,"gname",getgroupname(gid));
  289. return 1;
  290. }
  291. CMD:groupinvite(playerid,params[])
  292. {
  293. if(GetPVarInt(playerid,"groupid") == 0) return SendClientMessage(playerid,RED,"You Are Not In A Group");
  294. if(GetPVarInt(playerid,"groupjid") != 0) return SendClientMessage(playerid,RED,"You Are Not Group Leader");
  295. new id, string[128], name[MAX_PLAYER_NAME];
  296. if(sscanf(params,"u",id)) return SendClientMessage(playerid,RED,"USAGE: /groupinvite [id]");
  297. if(!IsPlayerConnected(id))
  298. {
  299. new idx;
  300. format(string,sizeof(string),"%s",strtok(params, idx));
  301. format(string,sizeof(string),"Player %s Is Not Connected",string);
  302. return SendClientMessage(playerid,RED,string);
  303. }
  304. if(playerid == id) return SendClientMessage(playerid,RED,"You Cannot Invite Yourself");
  305. new gname[20];
  306. GetPVarString(playerid,"gname",gname,sizeof(gname));
  307. if(GetPVarInt(id,"groupask") != GetPVarInt(playerid,"groupid"))
  308. {
  309. GetPlayerName(playerid,name,sizeof(name));
  310. format(string,sizeof(string),"%s Has Invited You To Join Their Group \"%s\"",name,gname);
  311. SendClientMessage(id,PURPLE,string);
  312. SetPVarInt(id,"groupinv",GetPVarInt(playerid,"groupid"));
  313. GetPlayerName(id,name,sizeof(name));
  314. format(string,sizeof(string),"You Have Invited %s To Join Your Group",name);
  315. return SendClientMessage(playerid,PURPLE,string);
  316. }
  317. GetPlayerName(id,name,sizeof(name));
  318. format(string,sizeof(string),"%s Has Joined %s",name,gname);
  319. SetPVarInt(id,"groupid",GetPVarInt(playerid,"groupid"));
  320. SetPVarString(id,"gname",name);
  321. return 1;
  322. }
  323.  
  324. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  325. {
  326. return 1;
  327. }
  328.  
  329. public OnPlayerExitVehicle(playerid, vehicleid)
  330. {
  331. return 1;
  332. }
  333.  
  334. public OnPlayerStateChange(playerid, newstate, oldstate)
  335. {
  336. return 1;
  337. }
  338.  
  339. public OnPlayerEnterCheckpoint(playerid)
  340. {
  341. return 1;
  342. }
  343.  
  344. public OnPlayerLeaveCheckpoint(playerid)
  345. {
  346. return 1;
  347. }
  348.  
  349. public OnPlayerEnterRaceCheckpoint(playerid)
  350. {
  351. return 1;
  352. }
  353.  
  354. public OnPlayerLeaveRaceCheckpoint(playerid)
  355. {
  356. return 1;
  357. }
  358.  
  359. public OnRconCommand(cmd[])
  360. {
  361. return 1;
  362. }
  363.  
  364. public OnPlayerRequestSpawn(playerid)
  365. {
  366. return 1;
  367. }
  368.  
  369. public OnObjectMoved(objectid)
  370. {
  371. return 1;
  372. }
  373.  
  374. public OnPlayerObjectMoved(playerid, objectid)
  375. {
  376. return 1;
  377. }
  378.  
  379. public OnPlayerPickUpPickup(playerid, pickupid)
  380. {
  381. return 1;
  382. }
  383.  
  384. public OnVehicleMod(playerid, vehicleid, componentid)
  385. {
  386. return 1;
  387. }
  388.  
  389. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  390. {
  391. return 1;
  392. }
  393.  
  394. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  395. {
  396. return 1;
  397. }
  398.  
  399. public OnPlayerSelectedMenuRow(playerid, row)
  400. {
  401. return 1;
  402. }
  403.  
  404. public OnPlayerExitedMenu(playerid)
  405. {
  406. return 1;
  407. }
  408.  
  409. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  410. {
  411. return 1;
  412. }
  413.  
  414. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  415. {
  416. return 1;
  417. }
  418.  
  419. public OnRconLoginAttempt(ip[], password[], success)
  420. {
  421. return 1;
  422. }
  423.  
  424. public OnPlayerUpdate(playerid)
  425. {
  426. return 1;
  427. }
  428.  
  429. public OnPlayerStreamIn(playerid, forplayerid)
  430. {
  431. return 1;
  432. }
  433.  
  434. public OnPlayerStreamOut(playerid, forplayerid)
  435. {
  436. return 1;
  437. }
  438.  
  439. public OnVehicleStreamIn(vehicleid, forplayerid)
  440. {
  441. return 1;
  442. }
  443.  
  444. public OnVehicleStreamOut(vehicleid, forplayerid)
  445. {
  446. return 1;
  447. }
  448.  
  449. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  450. {
  451. return 1;
  452. }
  453.  
  454. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  455. {
  456. return 1;
  457. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement