Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.64 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 name[MAX_PLAYER_NAME], gname[20];
  166. GetPlayerName(playerid,name,sizeof(name));
  167. GetPVarString(lid,"gname",gname,sizeof(gname));
  168. format(string,sizeof(string),"[%s] %s(%d) Has Left The Group",gname,name,playerid);
  169. groupmessage(GetPVarInt(lid,"groupid"),string);
  170. if(GetPVarInt(playerid,"groupjid") == 0)
  171. {
  172. GetPlayerName(lid,name,sizeof(name));
  173. format(string,sizeof(string),"[%s] %s(%d) Is The New Group Leader",gname,name,lid);
  174. groupmessage(GetPVarInt(lid,"groupid"),string);
  175. DeletePVar(lid,"groupjid");
  176. }
  177. }
  178. }
  179.  
  180. public OnPlayerDeath(playerid, killerid, reason)
  181. {
  182. return 1;
  183. }
  184.  
  185. public OnVehicleSpawn(vehicleid)
  186. {
  187. return 1;
  188. }
  189.  
  190. public OnVehicleDeath(vehicleid, killerid)
  191. {
  192. return 1;
  193. }
  194.  
  195. public OnPlayerText(playerid, text[])
  196. {
  197. return 1;
  198. }
  199.  
  200. public OnPlayerCommandText(playerid, cmdtext[])
  201. {
  202. CMD:groupcreate(playerid,params[])
  203. {
  204. if(GetPVarInt(playerid,"groupid") != 0) return SendClientMessage(playerid,RED,"You Need To Leave Your Current Group Before Creating A New One");
  205. new gid=1, gname[20],string[128];
  206. if(sscanf(params,"s[20]",gname)) return SendClientMessage(playerid,RED,"USAGE: /groupcreate [name]");
  207. if(!validtext(gname)) return SendClientMessage(playerid,RED,"Error Invalid Group Name");
  208. if(groupexists(gname)) return SendClientMessage(playerid,RED,"A Group Under That Name Already Exists");
  209. for(new i=0;i<=MAX_PLAYERS;i++)
  210. {
  211. if(IsPlayerConnected(i))
  212. {
  213. if(GetPVarInt(i,"groupid") != 0)
  214. {
  215. if(GetPVarInt(i,"groupid") == gid) gid++;
  216. }
  217. }
  218. }
  219. SetPVarInt(playerid,"groupjid",0);
  220. SetPVarString(playerid,"gname",gname);
  221. SetPVarInt(playerid,"groupid",gid);
  222. format(string,sizeof(string),"You Have Created The Group %s. Use /groupinvite [id] To Invite People",gname);
  223. return SendClientMessage(playerid,PURPLE,string);
  224. }
  225. CMD:groupleave(playerid,params[])
  226. {
  227. if(GetPVarInt(playerid,"groupid") == 0) return SendClientMessage(playerid,RED,"You Are Not In A Group");
  228. new gid=999, lid;
  229. for(new i=0;i<=MAX_PLAYERS;i++)
  230. {
  231. if(IsPlayerConnected(i))
  232. {
  233. if(GetPVarInt(i,"groupid") == GetPVarInt(playerid,"groupid") && i != playerid)
  234. {
  235. if(GetPVarInt(i,"groupjid") < gid)
  236. {
  237. gid = GetPVarInt(i,"groupjid");
  238. lid = i;
  239. }
  240. }
  241. }
  242. }
  243. DeletePVar(playerid,"gname");
  244. DeletePVar(playerid,"groupid");
  245. if(gid != 999)
  246. {
  247. new name[MAX_PLAYER_NAME], gname[20], string[128];
  248. GetPlayerName(playerid,name,sizeof(name));
  249. GetPVarString(lid,"gname",gname,sizeof(gname));
  250. format(string,sizeof(string),"[%s] %s(%d) Has Left The Group",gname,name,playerid);
  251. groupmessage(GetPVarInt(lid,"groupid"),string);
  252. if(GetPVarInt(playerid,"groupjid") == 0)
  253. {
  254. GetPlayerName(lid,name,sizeof(name));
  255. format(string,sizeof(string),"[%s] %s(%d) Is The New Group Leader",gname,name,lid);
  256. groupmessage(GetPVarInt(lid,"groupid"),string);
  257. DeletePVar(lid,"groupid");
  258. }
  259. }
  260. return SendClientMessage(playerid,PURPLE,"You Have Left Your Group");
  261. }
  262. CMD:groupjoin(playerid,params[])
  263. {
  264. if(GetPVarInt(playerid,"groupid") != 0) return SendClientMessage(playerid,RED,"You Are Already In A Group");
  265. new gid, gname[20], string[128];
  266. if(sscanf(params,"s[20]",gname)) return SendClientMessage(playerid,RED,"USAGE: /groupjoin [name]");
  267. if(!getgroupid(gname)) return SendClientMessage(playerid,RED,"Invalid Group Name");
  268. gid = getgroupid(gname);
  269. if(GetPVarInt(playerid,"groupinv") != gid)
  270. {
  271. for(new i=0;i<=MAX_PLAYERS;i++)
  272. {
  273. if(IsPlayerConnected(i))
  274. {
  275. if(GetPVarInt(i,"groupid") != 0 && GetPVarInt(i,"groupjid") == 0)
  276. {
  277. format(string,sizeof(string),"%s Has Asked To Join Your Group");
  278. SendClientMessage(i,PURPLE,string);
  279. SetPVarInt(playerid,"groupask",gid);
  280. }
  281. }
  282. }
  283. format(string,sizeof(string),"You Have Asked To Join The Group \"%s\"",getgroupname(gid));
  284. return SendClientMessage(playerid,PURPLE,string);
  285. }
  286. SetPVarInt(playerid,"groupid",gid);
  287. SetPVarString(playerid,"gname",getgroupname(gid));
  288. return 1;
  289. }
  290. CMD:groupinvite(playerid,params[])
  291. {
  292. if(GetPVarInt(playerid,"groupid") == 0) return SendClientMessage(playerid,RED,"You Are Not In A Group");
  293. if(GetPVarInt(playerid,"groupjid") != 0) return SendClientMessage(playerid,RED,"You Are Not Group Leader");
  294. new id, string[128], name[MAX_PLAYER_NAME];
  295. if(sscanf(params,"u",id)) return SendClientMessage(playerid,RED,"USAGE: /groupinvite [id]");
  296. if(!IsPlayerConnected(id))
  297. {
  298. new idx;
  299. format(string,sizeof(string),"%s",strtok(params, idx));
  300. format(string,sizeof(string),"Player %s Is Not Connected",string);
  301. return SendClientMessage(playerid,RED,string);
  302. }
  303. if(playerid == id) return SendClientMessage(playerid,RED,"You Cannot Invite Yourself");
  304. new gname[20];
  305. GetPVarString(playerid,"gname",gname,sizeof(gname));
  306. if(GetPVarInt(id,"groupask") != GetPVarInt(playerid,"groupid"))
  307. {
  308. GetPlayerName(playerid,name,sizeof(name));
  309. format(string,sizeof(string),"%s Has Invited You To Join Their Group \"%s\"",name,gname);
  310. SendClientMessage(id,PURPLE,string);
  311. SetPVarInt(id,"groupinv",GetPVarInt(playerid,"groupid"));
  312. GetPlayerName(id,name,sizeof(name));
  313. format(string,sizeof(string),"You Have Invited %s To Join Your Group",name);
  314. return SendClientMessage(playerid,PURPLE,string);
  315. }
  316. GetPlayerName(id,name,sizeof(name));
  317. format(string,sizeof(string),"%s Has Joined %s",name,gname);
  318. SetPVarInt(id,"groupid",GetPVarInt(playerid,"groupid"));
  319. SetPVarString(id,"gname",name);
  320. return 1;
  321. }
  322.  
  323. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  324. {
  325. return 1;
  326. }
  327.  
  328. public OnPlayerExitVehicle(playerid, vehicleid)
  329. {
  330. return 1;
  331. }
  332.  
  333. public OnPlayerStateChange(playerid, newstate, oldstate)
  334. {
  335. return 1;
  336. }
  337.  
  338. public OnPlayerEnterCheckpoint(playerid)
  339. {
  340. return 1;
  341. }
  342.  
  343. public OnPlayerLeaveCheckpoint(playerid)
  344. {
  345. return 1;
  346. }
  347.  
  348. public OnPlayerEnterRaceCheckpoint(playerid)
  349. {
  350. return 1;
  351. }
  352.  
  353. public OnPlayerLeaveRaceCheckpoint(playerid)
  354. {
  355. return 1;
  356. }
  357.  
  358. public OnRconCommand(cmd[])
  359. {
  360. return 1;
  361. }
  362.  
  363. public OnPlayerRequestSpawn(playerid)
  364. {
  365. return 1;
  366. }
  367.  
  368. public OnObjectMoved(objectid)
  369. {
  370. return 1;
  371. }
  372.  
  373. public OnPlayerObjectMoved(playerid, objectid)
  374. {
  375. return 1;
  376. }
  377.  
  378. public OnPlayerPickUpPickup(playerid, pickupid)
  379. {
  380. return 1;
  381. }
  382.  
  383. public OnVehicleMod(playerid, vehicleid, componentid)
  384. {
  385. return 1;
  386. }
  387.  
  388. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  389. {
  390. return 1;
  391. }
  392.  
  393. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  394. {
  395. return 1;
  396. }
  397.  
  398. public OnPlayerSelectedMenuRow(playerid, row)
  399. {
  400. return 1;
  401. }
  402.  
  403. public OnPlayerExitedMenu(playerid)
  404. {
  405. return 1;
  406. }
  407.  
  408. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  409. {
  410. return 1;
  411. }
  412.  
  413. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  414. {
  415. return 1;
  416. }
  417.  
  418. public OnRconLoginAttempt(ip[], password[], success)
  419. {
  420. return 1;
  421. }
  422.  
  423. public OnPlayerUpdate(playerid)
  424. {
  425. return 1;
  426. }
  427.  
  428. public OnPlayerStreamIn(playerid, forplayerid)
  429. {
  430. return 1;
  431. }
  432.  
  433. public OnPlayerStreamOut(playerid, forplayerid)
  434. {
  435. return 1;
  436. }
  437.  
  438. public OnVehicleStreamIn(vehicleid, forplayerid)
  439. {
  440. return 1;
  441. }
  442.  
  443. public OnVehicleStreamOut(vehicleid, forplayerid)
  444. {
  445. return 1;
  446. }
  447.  
  448. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  449. {
  450. return 1;
  451. }
  452.  
  453. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  454. {
  455. return 1;
  456. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement