Advertisement
Guest User

Untitled

a guest
Dec 11th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.55 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4. #include <cstrike>
  5. #include <fakemeta_util>
  6. #include <hamsandwich>
  7. #include <sqlx>
  8.  
  9.  
  10.  
  11. enum Color
  12. {
  13. NORMAL = 1, // Culoarea care o are jucatorul setata in cvar-ul scr_concolor.
  14. GREEN, // Culoare Verde.
  15. TEAM_COLOR, // Culoare Rosu, Albastru, Gri.
  16. GREY, // Culoarea Gri.
  17. RED, // Culoarea Rosu.
  18. BLUE, // Culoarea Albastru.
  19. };
  20.  
  21. new TeamName[ ][ ] =
  22. {
  23. "",
  24. "TERRORIST",
  25. "CT",
  26. "SPECTATOR"
  27. };
  28. #define SCOREATTRIB_NONE 0
  29. #define SCOREATTRIB_DEAD ( 1 << 0 )
  30. #define SCOREATTRIB_BOMB ( 1 << 1 )
  31. #define SCOREATTRIB_VIP ( 1 << 2 )
  32.  
  33. #define Host "localhost"
  34. #define User "root"
  35. #define Pass ""
  36. #define Db "MariaDB"
  37.  
  38. new Handle:g_SqlTuple;
  39. new g_Error[512];
  40.  
  41. new bool: is_user_vip[33];
  42.  
  43. new const szTag [] = "[VIP]";
  44.  
  45. new jumpnum[33] = 0;
  46. new bool:dojump[33] = false;
  47.  
  48. new const g_szBeginning[ ] = "Membrii VIP"
  49. new g_szMessage[ 256 ];
  50.  
  51. new SyncHudMessage;
  52.  
  53. new Round[33];
  54.  
  55. new cvar_vip_maxap, cvar_vip_maxhp, cvar_vip_showC, cvar_vip_showH, cvar_vip_in_out, cvar_start_hp, cvar_start_ap, cvar_start_money, cvar_vip_jump, cvar_hp_kill, cvar_ap_kill;
  56.  
  57. public plugin_init()
  58. {
  59. register_plugin("VIP Sql","1.0","Truth");
  60.  
  61. register_clcmd("say /vip", "vip_info");
  62.  
  63. register_clcmd("say", "handle_say");
  64. register_clcmd("say_team", "handle_say");
  65.  
  66. RegisterHam(Ham_Spawn, "player", "Spawn", true);
  67. register_event("DeathMsg", "eDeathMsg", "a");
  68.  
  69. set_task( 1.0, "TaskDisplayVips", _, _, _, "b", 0 );
  70. register_message(get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib");
  71. SyncHudMessage = CreateHudSyncObj( );
  72.  
  73. cvar_start_hp = register_cvar("amx_start_hp", "150");
  74. cvar_start_ap = register_cvar("amx_start_ap", "180");
  75. cvar_start_money = register_cvar("amx_start_money", "8000");
  76. cvar_vip_jump = register_cvar("amx_vip_jump", "1" );
  77. cvar_hp_kill = register_cvar("amx_vip_addhp", "10");
  78. cvar_ap_kill = register_cvar("amx_vip_addap", "10");
  79. cvar_vip_in_out = register_cvar("amx_vip_in_out", "1");
  80. cvar_vip_showC = register_cvar("amx_vip_show_chat", "1");
  81. cvar_vip_showH = register_cvar("amx_vip_show_hud", "1");
  82. cvar_vip_maxhp = register_cvar("amx_vip_maxhp", "180");
  83. cvar_vip_maxap = register_cvar("amx_vip_maxap", "200");
  84.  
  85. set_task(120.0, "mesaj_info", _, _, _, "b");
  86.  
  87.  
  88. // -- || MySql Config || -- //
  89. g_SqlTuple = SQL_MakeDbTuple(Host,User,Pass,Db);
  90.  
  91. new ErrorCode,Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511);
  92. if(SqlConnection == Empty_Handle)
  93. set_fail_state(g_Error);
  94.  
  95. new Handle:Queries;
  96. Queries = SQL_PrepareQuery(SqlConnection,"CREATE TABLE IF NOT EXISTS test (name VARCHAR(100),data DATE)");
  97.  
  98.  
  99. if(!SQL_Execute(Queries))
  100. {
  101. SQL_QueryError(Queries,g_Error,511);
  102. set_fail_state(g_Error);
  103. }
  104. SQL_FreeHandle(Queries);
  105.  
  106. SQL_FreeHandle(SqlConnection);
  107. // -- || End MySql Config || -- //
  108.  
  109. }
  110.  
  111. public client_connect(id) Load(id);
  112.  
  113. public vip_info(id) show_motd(id, "/addons/amxmodx/configs/vip_info.html");
  114.  
  115. public mesaj_info() ColorChat(0, GREEN, "^4%s ^1Tastati in chat ^4/vip ^1pentru a vedea beneficiile si pretul vip-ului.", szTag);
  116.  
  117. public client_putinserver(id)
  118. {
  119. set_task(2.0, "in", id);
  120. if(is_user_vip[id])
  121. {
  122. jumpnum[id] = 0
  123. dojump[id] = false
  124. Round[id] = 0;
  125. }
  126. }
  127.  
  128. public client_disconnected(id)
  129. {
  130. set_task(2.0, "out", id);
  131. if(is_user_vip[id])
  132. {
  133. jumpnum[id] = 0;
  134. dojump[id] = false;
  135. Round[id] = 0;
  136. }
  137. }
  138.  
  139. public in(id)
  140. {
  141. if(get_pcvar_num(cvar_vip_in_out))
  142. {
  143. if(is_user_vip[id]) {
  144. new name[33];
  145. get_user_name(id, name, sizeof(name) - 1);
  146. ColorChat(0, GREEN, "^4%s ^1VIP: ^4%s ^1s-a conectat.", szTag, name);
  147. }
  148. }
  149. return 1;
  150. }
  151.  
  152. public out(id)
  153. {
  154. if(get_pcvar_num(cvar_vip_in_out))
  155. {
  156. if(is_user_vip[id]) {
  157. new name[33];
  158. get_user_name(id, name, sizeof(name) - 1);
  159. ColorChat(0, GREEN, "^4%s ^1VIP: ^4%s ^1s-a deconectat.", szTag, name);
  160. }
  161. }
  162. return 1;
  163. }
  164.  
  165. public Spawn(id) {
  166. if(is_user_vip[id]) {
  167. Round[id]++;
  168. if(Round[id]>=6) VipMenu(id);
  169. }
  170. new MapName[32]; get_mapname(MapName, sizeof(MapName));
  171. if(equali(MapName, "35hp") || equali(MapName, "35hp_2") || equali(MapName, "31hp") || equali(MapName, "1hp") || equali(MapName, "100hp") ) {
  172. is_user_vip[id]=false;
  173. }
  174.  
  175. if(is_user_vip[id] && is_user_alive(id))
  176. {
  177. switch(get_user_team(id))
  178. {
  179. case 1:
  180. {
  181. fm_set_user_health(id, get_pcvar_num(cvar_start_hp));
  182. fm_set_user_armor(id, get_pcvar_num(cvar_start_ap));
  183. cs_set_user_money(id, cs_get_user_money(id) + get_pcvar_num(cvar_start_money));
  184. }
  185. case 2:
  186. {
  187. fm_set_user_health(id, get_pcvar_num( cvar_start_hp ));
  188. fm_set_user_armor(id, get_pcvar_num( cvar_start_ap ));
  189. cs_set_user_money(id, cs_get_user_money(id) + get_pcvar_num(cvar_start_money));
  190. }
  191. }
  192. }
  193. }
  194.  
  195. public VipMenu(id) {
  196. new ShopMenu = menu_create("\y[\rVIP Classic\y] \wMeniu \yVIP", "give_items");
  197. switch(get_user_team(id)) {
  198. case 1: {
  199. menu_additem(ShopMenu, "Ak47+Deagle+Set grenazi", "1");
  200. menu_additem(ShopMenu, "Galil+Deagle+Set grenazi", "2");
  201. }
  202. case 2:
  203. {
  204. menu_additem(ShopMenu, "M4a1+Deagle+Set grenazi", "1");
  205. menu_additem(ShopMenu, "Famas+Deagle+Set grenazi", "2");
  206. }
  207. }
  208. menu_additem(ShopMenu, "Awp+Deagle+Set grenazi", "3");
  209.  
  210. menu_setprop(ShopMenu, MPROP_EXIT, MEXIT_ALL);
  211. menu_display(id, ShopMenu, 0);
  212. return 1;
  213. }
  214.  
  215. public give_items(id, ShopMenu, item) {
  216. if(item == MENU_EXIT) {
  217. menu_destroy(ShopMenu);
  218. return 1;
  219. }
  220. switch(get_user_team(id)) {
  221. case 1: {
  222. switch(item)
  223. {
  224. case 0:
  225. {
  226. fm_strip_user_weapons(id);
  227. fm_give_item(id, "weapon_knife");
  228. fm_give_item(id, "weapon_ak47");
  229. fm_give_item(id, "weapon_deagle");
  230. fm_give_item(id, "weapon_hegrenade");
  231. fm_give_item(id, "weapon_flashbang");
  232. cs_set_user_bpammo(id, CSW_HEGRENADE, 1);
  233. cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
  234. cs_set_user_bpammo(id, CSW_AK47, 90);
  235. cs_set_user_bpammo(id, CSW_DEAGLE, 35);
  236. ColorChat(id,GREEN,"^4%s ^1Ai ales ^4Ak47^1+^4Deagle^1+^4Set grenazi^1.", szTag);
  237.  
  238. }
  239. case 1:
  240. {
  241. fm_strip_user_weapons(id);
  242. fm_give_item(id, "weapon_knife");
  243. fm_give_item(id, "weapon_galil");
  244. fm_give_item(id, "weapon_deagle");
  245. fm_give_item(id, "weapon_hegrenade");
  246. fm_give_item(id, "weapon_flashbang");
  247. cs_set_user_bpammo(id, CSW_HEGRENADE, 1);
  248. cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
  249. cs_set_user_bpammo(id, CSW_GALIL, 90);
  250. cs_set_user_bpammo(id, CSW_DEAGLE, 35);
  251. ColorChat(id,GREEN,"^4%s ^1Ai ales ^4Galil^1+^4Deagle^1+^4Set grenazi^1.", szTag);
  252. }
  253. case 2:
  254. {
  255. fm_strip_user_weapons(id);
  256. fm_give_item(id, "weapon_knife");
  257. fm_give_item(id, "weapon_awp");
  258. fm_give_item(id, "weapon_deagle");
  259. fm_give_item(id, "weapon_hegrenade");
  260. fm_give_item(id, "weapon_flashbang");
  261. cs_set_user_bpammo(id, CSW_HEGRENADE, 1);
  262. cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
  263. cs_set_user_bpammo(id, CSW_AWP, 30);
  264. cs_set_user_bpammo(id, CSW_DEAGLE, 35);
  265. ColorChat(id,GREEN,"^4%s ^1Ai ales ^4Awp^1+^4Deagle^1+^4Set grenazi^1.", szTag);
  266. }
  267. }
  268. }
  269. case 2: {
  270. switch(item)
  271. {
  272. case 0:
  273. {
  274. fm_strip_user_weapons(id);
  275. fm_give_item(id, "weapon_knife");
  276. fm_give_item(id, "weapon_m4a1");
  277. fm_give_item(id, "weapon_deagle");
  278. fm_give_item(id, "weapon_hegrenade");
  279. fm_give_item(id, "weapon_flashbang");
  280. cs_set_user_bpammo(id, CSW_HEGRENADE, 1);
  281. cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
  282. cs_set_user_bpammo(id, CSW_M4A1, 90);
  283. cs_set_user_bpammo(id, CSW_DEAGLE, 35);
  284. ColorChat(id,GREEN,"^4%s ^1Ai ales ^4M4A1^1+^4Deagle^1+^4Set grenazi^1.", szTag);
  285.  
  286. }
  287. case 1:
  288. {
  289. fm_strip_user_weapons(id);
  290. fm_give_item(id, "weapon_knife");
  291. fm_give_item(id, "weapon_famas");
  292. fm_give_item(id, "weapon_deagle");
  293. fm_give_item(id, "weapon_hegrenade");
  294. fm_give_item(id, "weapon_flashbang");
  295. cs_set_user_bpammo(id, CSW_HEGRENADE, 1);
  296. cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
  297. cs_set_user_bpammo(id, CSW_FAMAS, 90);
  298. cs_set_user_bpammo(id, CSW_DEAGLE, 35);
  299. ColorChat(id,GREEN,"^4%s ^1Ai ales ^4Famas^1+^4Deagle^1+^4Set grenazi^1.", szTag);
  300.  
  301. }
  302. case 2:
  303. {
  304. fm_strip_user_weapons(id);
  305. fm_give_item(id, "weapon_knife");
  306. fm_give_item(id, "weapon_awp");
  307. fm_give_item(id, "weapon_deagle");
  308. fm_give_item(id, "weapon_hegrenade");
  309. fm_give_item(id, "weapon_flashbang");
  310. cs_set_user_bpammo(id, CSW_HEGRENADE, 1);
  311. cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
  312. cs_set_user_bpammo(id, CSW_AWP, 30);
  313. cs_set_user_bpammo(id, CSW_DEAGLE, 35);
  314. ColorChat(id,GREEN,"^4%s ^1Ai ales ^4Awp^1+^4Deagle^1+^4Set grenazi^1.", szTag);
  315. }
  316. }
  317. }
  318. }
  319. menu_destroy(ShopMenu);
  320. return 1;
  321. }
  322.  
  323. public client_PreThink(id)
  324. {
  325. if(!is_user_alive(id)) return PLUGIN_CONTINUE
  326. if(!is_user_vip[id]) return PLUGIN_CONTINUE
  327. new nbut = get_user_button(id)
  328. new obut = get_user_oldbutton(id)
  329. if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
  330. {
  331. if(jumpnum[id] < get_pcvar_num(cvar_vip_jump))
  332. {
  333. dojump[id] = true
  334. jumpnum[id]++
  335. return PLUGIN_CONTINUE
  336. }
  337. }
  338. if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
  339. {
  340. jumpnum[id] = 0
  341. return PLUGIN_CONTINUE
  342. }
  343. return PLUGIN_CONTINUE
  344. }
  345.  
  346. public client_PostThink(id)
  347. {
  348. if(!is_user_alive(id)) return PLUGIN_CONTINUE
  349. if(!is_user_vip[id]) return PLUGIN_CONTINUE
  350. if(dojump[id] == true)
  351. {
  352. new Float:velocity[3]
  353. entity_get_vector(id,EV_VEC_velocity,velocity)
  354. velocity[2] = random_float(265.0,285.0)
  355. entity_set_vector(id,EV_VEC_velocity,velocity)
  356. dojump[id] = false
  357. return PLUGIN_CONTINUE
  358. }
  359. return PLUGIN_CONTINUE
  360. }
  361.  
  362. public eDeathMsg()
  363. {
  364. new iKiller = read_data( 1 );
  365. new VIP_MAXHP = get_pcvar_num(cvar_vip_maxhp);
  366. new VIP_MAX_HP = get_user_health(iKiller);
  367. new VIP_MAXAP = get_pcvar_num(cvar_vip_maxap);
  368. new VIP_MAX_AP = get_user_armor(iKiller);
  369.  
  370. if(is_user_alive(iKiller))
  371. {
  372. if(is_user_vip[iKiller])
  373. {
  374. fm_set_user_health(iKiller, get_user_health(iKiller) + get_pcvar_num(cvar_hp_kill));
  375. fm_set_user_armor(iKiller, get_user_armor(iKiller) + get_pcvar_num(cvar_ap_kill));
  376. }
  377. }
  378.  
  379. if(VIP_MAX_HP >= VIP_MAXHP)
  380. {
  381. fm_set_user_health(iKiller, get_pcvar_num(cvar_vip_maxhp));
  382. return 1;
  383. }
  384.  
  385. if(VIP_MAX_AP >= VIP_MAXAP)
  386. {
  387. fm_set_user_armor(iKiller, get_pcvar_num(cvar_vip_maxap));
  388. return 1;
  389. }
  390.  
  391. return 1;
  392. }
  393.  
  394. public MessageScoreAttrib(iMsgID, iDest, iReceiver) {
  395. new iPlayer = get_msg_arg_int(1);
  396. if(is_user_connected( iPlayer ) && is_user_vip[ iPlayer ]) {
  397. set_msg_arg_int(2, ARG_BYTE, is_user_alive(iPlayer) ? SCOREATTRIB_VIP : SCOREATTRIB_DEAD);
  398. }
  399. }
  400.  
  401. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  402. // VIP's Online by sDs*Argon |
  403. //==========================================================================================================
  404. public print_adminlist(user) {
  405. if(get_pcvar_num(cvar_vip_showC))
  406. {
  407. new adminnames[33][32];
  408. new message[256];
  409. new id, count, x, len;
  410.  
  411. for(id = 1 ; id <= get_maxplayers() ; id++)
  412. if(is_user_connected(id))
  413. if(is_user_vip[id])
  414. get_user_name(id, adminnames[count++], 31);
  415.  
  416. len = format(message, 255, "^x04 VIP ONLINE: ");
  417. if(count > 0) {
  418. for(x = 0 ; x < count ; x++) {
  419. len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ", ":"");
  420. if(len > 96) {
  421. print_message(user, message);
  422. len = format(message, 255, "^x04 ");
  423. }
  424. }
  425. print_message(user, message);
  426. }
  427. else {
  428. len += format(message[len], 255-len, "No VIP online.");
  429. print_message(user, message);
  430. }
  431. }
  432. }
  433. stock print_message(id, msg[]) {
  434. message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, id);
  435. write_byte(id);
  436. write_string(msg);
  437. message_end();
  438. }
  439.  
  440. public handle_say(id) {
  441. new said[192];
  442. read_args(said,192);
  443. if(contain(said, "/vips") != -1)
  444. set_task(0.1,"print_adminlist",id);
  445. return PLUGIN_CONTINUE;
  446. }
  447.  
  448. public TaskDisplayVips( )
  449. {
  450. if(get_pcvar_num(cvar_vip_showH)) {
  451. static iPlayers[ 32 ];
  452. static iPlayersNum;
  453.  
  454. get_players( iPlayers, iPlayersNum, "ch" );
  455. if( !iPlayersNum )
  456. return;
  457.  
  458. static iVipsConnected, szVipsNames[ 128 ], szName[ 32 ];
  459. formatex( szVipsNames, sizeof ( szVipsNames ) -1, "" ); // Is this needed ?
  460. iVipsConnected = 0;
  461.  
  462. static id, i;
  463. for( i = 0; i < iPlayersNum; i++ )
  464. {
  465. id = iPlayers[ i ];
  466. if( is_user_vip[id] )
  467. {
  468. get_user_name( id, szName, sizeof ( szName ) -1 );
  469.  
  470. add( szVipsNames, sizeof ( szVipsNames ) -1, szName );
  471. add( szVipsNames, sizeof ( szVipsNames ) -1, "^n" );
  472.  
  473. iVipsConnected++;
  474. }
  475. }
  476.  
  477. formatex( g_szMessage, sizeof ( g_szMessage ) -1, "%s ( %i )^n%s",
  478. g_szBeginning, iVipsConnected, szVipsNames );
  479.  
  480. set_hudmessage( 25, 255, 25, 0.01, 0.25, 0, 0.0, 1.0, 0.1, 0.1, -1 );
  481. ShowSyncHudMsg( 0, SyncHudMessage, g_szMessage );
  482. }
  483.  
  484. }
  485.  
  486. public Load(id)
  487. {
  488. new ErrorCode,Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
  489. if(SqlConnection == Empty_Handle)
  490. set_fail_state(g_Error);
  491.  
  492. new Handle:Query = SQL_PrepareQuery(SqlConnection,"SELECT * FROM `test` WHERE `data` >= CURRENT_DATE");
  493.  
  494. if( !SQL_Execute(Query) )
  495. {
  496. SQL_QueryError(Query,g_Error,511);
  497. log_amx("[ZM VIP] SQL error: can't load VIPs: '%s'", g_Error);
  498. set_fail_state(g_Error);
  499. }
  500. else if (!SQL_NumResults(Query))
  501. {
  502. log_amx("[ZM VIP] Empty table!" )
  503. }
  504. else
  505. {
  506. new qcolName = SQL_FieldNameToNum(Query, "name");
  507.  
  508. new Name[44];
  509. new szName[33];
  510. get_user_name(id, szName, 32);
  511.  
  512. new num;
  513.  
  514. while (SQL_MoreResults(Query))
  515. {
  516. Name[0] = EOS;
  517.  
  518. SQL_ReadResult(Query, qcolName, Name, sizeof(Name)-1);
  519.  
  520. if(equali(Name, szName)) {
  521. is_user_vip[id] = true;
  522. }
  523. else
  524. {
  525. is_user_vip[id] = false;
  526. }
  527.  
  528. num++
  529.  
  530. SQL_NextRow(Query)
  531. }
  532.  
  533. if( num )log_amx("[ZM VIP] Loaded %d VIPs from database.", num );
  534. else log_amx("[ZM VIP] VIPs not found!");
  535. }
  536.  
  537. SQL_FreeHandle(Query);
  538. SQL_FreeHandle(SqlConnection);
  539. }
  540.  
  541. stock ColorChat( id, Color:iType, const msg[ ], { Float, Sql, Result, _}:... )
  542. {
  543.  
  544. // Daca nu se afla nici un jucator pe server oprim TOT. Altfel dam de erori..
  545. if( !get_playersnum( ) ) return;
  546.  
  547. new szMessage[ 256 ];
  548.  
  549. switch( iType )
  550. {
  551. // Culoarea care o are jucatorul setata in cvar-ul scr_concolor.
  552. case NORMAL: szMessage[ 0 ] = 0x01;
  553.  
  554. // Culoare Verde.
  555. case GREEN: szMessage[ 0 ] = 0x04;
  556.  
  557. // Alb, Rosu, Albastru.
  558. default: szMessage[ 0 ] = 0x03;
  559. }
  560.  
  561. vformat( szMessage[ 1 ], 251, msg, 4 );
  562.  
  563. // Ne asiguram ca mesajul nu este mai lung de 192 de caractere.Altfel pica server-ul.
  564. szMessage[ 192 ] = '^0';
  565.  
  566.  
  567. new iTeam, iColorChange, iPlayerIndex, MSG_Type;
  568.  
  569. if( id )
  570. {
  571. MSG_Type = MSG_ONE_UNRELIABLE;
  572. iPlayerIndex = id;
  573. }
  574. else
  575. {
  576. iPlayerIndex = CC_FindPlayer( );
  577. MSG_Type = MSG_ALL;
  578. }
  579.  
  580. iTeam = get_user_team( iPlayerIndex );
  581. iColorChange = CC_ColorSelection( iPlayerIndex, MSG_Type, iType);
  582.  
  583. CC_ShowColorMessage( iPlayerIndex, MSG_Type, szMessage );
  584.  
  585. if( iColorChange ) CC_Team_Info( iPlayerIndex, MSG_Type, TeamName[ iTeam ] );
  586.  
  587. }
  588.  
  589. stock CC_ShowColorMessage( id, const iType, const szMessage[ ] )
  590. {
  591.  
  592. static bool:bSayTextUsed;
  593. static iMsgSayText;
  594.  
  595. if( !bSayTextUsed )
  596. {
  597. iMsgSayText = get_user_msgid( "SayText" );
  598. bSayTextUsed = true;
  599. }
  600.  
  601. message_begin( iType, iMsgSayText, _, id );
  602. write_byte( id )
  603. write_string( szMessage );
  604. message_end( );
  605. }
  606.  
  607. stock CC_Team_Info( id, const iType, const szTeam[ ] )
  608. {
  609. static bool:bTeamInfoUsed;
  610. static iMsgTeamInfo;
  611. if( !bTeamInfoUsed )
  612. {
  613. iMsgTeamInfo = get_user_msgid( "TeamInfo" );
  614. bTeamInfoUsed = true;
  615. }
  616.  
  617. message_begin( iType, iMsgTeamInfo, _, id );
  618. write_byte( id );
  619. write_string( szTeam );
  620. message_end( );
  621.  
  622. return 1;
  623. }
  624.  
  625. stock CC_ColorSelection( id, const iType, Color:iColorType)
  626. {
  627. switch( iColorType )
  628. {
  629.  
  630. case RED: return CC_Team_Info( id, iType, TeamName[ 1 ] );
  631. case BLUE: return CC_Team_Info( id, iType, TeamName[ 2 ] );
  632. case GREY: return CC_Team_Info( id, iType, TeamName[ 0 ] );
  633.  
  634. }
  635.  
  636. return 0;
  637. }
  638.  
  639. stock CC_FindPlayer( )
  640. {
  641. new iMaxPlayers = get_maxplayers( );
  642.  
  643. for( new i = 1; i <= iMaxPlayers; i++ )
  644. if( is_user_connected( i ) )
  645. return i;
  646.  
  647. return -1;
  648. }
  649.  
  650. public plugin_end()
  651. SQL_FreeHandle(g_SqlTuple);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement