Guest User

SQLiteVIP

a guest
Jul 14th, 2011
862
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.79 KB | None | 0 0
  1. #if defined VIP
  2. xxSPEEDYxx's V.I.P System - NEW*
  3. 3 Levels
  4. v1.0
  5. COMMANDS:
  6.  
  7. V.I.P Level 1 Commands: V.I.P Level 2 Commands: V.I.P Level 3 Commands:
  8. /mytime /vsaveskin /vkick
  9. /myweather /dontuseskin /vget
  10. /myvw /vweapons /rw
  11. /mycolor /vipgoto /maxammo
  12. /vspec /vasay + V.I.P level 1&2 CMDS
  13. /vspecoff + V.I.P level 1 CMDS
  14. /spawnme
  15. /vcmds
  16. #endif
  17. //============ [ Includes ] ============//
  18. #include < a_samp > // Main include!
  19. #include < zcmd > // Gasiti aici: http://forum.sa-mp.com/showthread.php?t=91354&highlight=zcmd
  20. #include < sscanf2 > // Gasiti aici: http://forum.sa-mp.com/showthread.php?t=120356
  21. //======================================//
  22.  
  23. #pragma tabsize 0
  24. #define VIPS_SEND_COMMAND //Pune doua din astea // in fata pentru a nu se trmite mesajul V.I.P-urilor cand un V.I.P tasteaza o comanda de V.I.P!
  25.  
  26. //============ [ Culori ] ============//
  27. #define RED 0xE60000AA
  28. #define YELLOW 0xFFFF00AA
  29. #define GREEN 0x00FF00AA
  30. #define ABLUE 0x2641FEAA
  31. #define COLOR_VIP 0xFF5500AA // Orange:P
  32. //====================================//
  33. //========== [ Dialog-uri ] ==========//
  34. /*
  35. Am pus ID-urile dialog-urilor mai mari pentru ca sa va nu inucrce
  36. sa spuneti ca nu va apare dialogu etc...
  37.  
  38. Dar asta nu inseamna ca nu puteti sa le schimbati...puteti sa le schimbati
  39. in ce numar vreti voi:P
  40. */
  41. #define MYLVL 12000
  42. #define VIPS 12001
  43. #define VIPCMDS 12002
  44. #define ONCONN 12003
  45. //====================================//
  46. //============= [ SPEC ] =============//
  47. #define ADMIN_SPEC_TYPE_NONE 0
  48. #define ADMIN_SPEC_TYPE_PLAYER 1
  49. #define ADMIN_SPEC_TYPE_VEHICLE 2
  50. /*
  51. Lasa-ti asta asa ca sa functioneze spec-ul bine
  52. */
  53. //====================================//
  54. //========== [ News&Enums ] ==========//
  55. enum pInfo
  56. {
  57. Vip,
  58. SpecID,
  59. SpecType
  60. };
  61.  
  62. new P_DATA[ MAX_PLAYERS ][ pInfo ];
  63. new DB:Database;
  64. new Float:Position[ MAX_PLAYERS ][ 4 ];
  65. //====================================//
  66. //======================================================== [ CallBacks ] ========================================================//
  67. public OnFilterScriptInit( )
  68. {
  69. Database = db_open( "Vips.db" );
  70. db_free_result( db_query( Database, "CREATE TABLE IF NOT EXISTS `Vips` \
  71. ( `Nume` varchar(35),\
  72. `VipLevel` INT,\
  73. `VSkin` INT )" ) );
  74. return 1;
  75. }
  76.  
  77. public OnFilterScriptExit( )
  78. {
  79. db_close( Database );
  80. return 1;
  81. }
  82.  
  83. public OnPlayerConnect( playerid )
  84. {
  85. new Query[ 256 ], string[ 128 ], DBResult:Result;
  86. format( Query, sizeof( Query ), "SELECT * FROM `Vips` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
  87. Result = db_query( Database, Query );
  88.  
  89. if ( db_num_rows( Result ) )
  90. {
  91. new Field[ 30 ];
  92. db_get_field_assoc( Result, "VipLevel", Field, 30 );
  93. P_DATA[ playerid ][ Vip ] = strval( Field );
  94. format( string, sizeof( string ), "\t{FF5500}Your V.I.P Level:\n\n{FF5500}You have V.I.P level {00FF00}%d\n\n{E60000}Congratulations!", P_DATA[ playerid ][ Vip ] );
  95. ShowPlayerDialog( playerid, ONCONN, DIALOG_STYLE_MSGBOX, "{00FF00}V.I.P", string, "Quit", "" );
  96. }
  97. else
  98. {
  99. ShowPlayerDialog( playerid, ONCONN+1, DIALOG_STYLE_MSGBOX, "{00FF00}V.I.P", "{E60000}This username have V.I.P level 0", "Quit", "" );
  100. }
  101. db_free_result( Result );
  102. return 1;
  103. }
  104.  
  105.  
  106. public OnPlayerDisconnect( playerid, reason )
  107. {
  108. for ( new i = 0; i < MAX_PLAYERS; i++ )
  109. {
  110. if ( GetPlayerState( i ) == PLAYER_STATE_SPECTATING && P_DATA[ i ][ SpecID ] == playerid )
  111. {
  112. AdvanceSpectate( i );
  113. }
  114. }
  115. return 1;
  116. }
  117.  
  118. public OnPlayerDeath( playerid, killerid, reason )
  119. {
  120. for ( new i = 0; i < MAX_PLAYERS; i++ )
  121. {
  122. if ( GetPlayerState( i ) == PLAYER_STATE_SPECTATING && P_DATA[ i ][ SpecID ] == playerid )
  123. {
  124. AdvanceSpectate( i );
  125. }
  126. }
  127. return 1;
  128. }
  129.  
  130. public OnPlayerInteriorChange( playerid, newinteriorid, oldinteriorid )
  131. {
  132. new i = 0;
  133. while( i != MAX_PLAYERS )
  134. {
  135. if ( IsPlayerConnected( i ) && GetPlayerState( i ) == PLAYER_STATE_SPECTATING && P_DATA[ i ][ SpecID ] == playerid && P_DATA[ i ][ SpecType ] == ADMIN_SPEC_TYPE_PLAYER )
  136. {
  137. SetPlayerInterior( i, newinteriorid );
  138. }
  139. i++;
  140. }
  141. }
  142.  
  143. public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
  144. {
  145. if ( GetPlayerState( playerid ) == PLAYER_STATE_SPECTATING && P_DATA[ playerid ][ SpecID ] != INVALID_PLAYER_ID )
  146. {
  147. if ( newkeys == KEY_JUMP ) AdvanceSpectate( playerid );
  148. else if ( newkeys == KEY_SPRINT ) ReverseSpectate( playerid );
  149. }
  150. return 1;
  151. }
  152.  
  153. public OnPlayerEnterVehicle( playerid, vehicleid )
  154. {
  155. for ( new i = 0; i < MAX_PLAYERS; i++ )
  156. {
  157. if ( GetPlayerState( i ) == PLAYER_STATE_SPECTATING && P_DATA[ i ][ SpecID ] == playerid )
  158. {
  159. TogglePlayerSpectating( i, 1 );
  160. PlayerSpectateVehicle( i, vehicleid );
  161. P_DATA[ i ][ SpecType ] = ADMIN_SPEC_TYPE_VEHICLE;
  162. }
  163. }
  164. return 1;
  165. }
  166.  
  167. public OnPlayerStateChange( playerid, newstate, oldstate )
  168. {
  169. switch( newstate )
  170. {
  171. case PLAYER_STATE_ONFOOT:
  172. {
  173. switch( oldstate )
  174. {
  175. case PLAYER_STATE_DRIVER: OnPlayerExitVehicle( playerid, 255 );
  176. case PLAYER_STATE_PASSENGER: OnPlayerExitVehicle( playerid, 255 );
  177. }
  178. }
  179. }
  180. return 1;
  181. }
  182.  
  183. public OnPlayerText( playerid, text[ ] )
  184. {
  185. new textstr[ 128 ];
  186.  
  187. if ( text[ 0 ] == '!' && P_DATA[ playerid ][ Vip ] >= 1 )
  188. {
  189. GetPlayerName( playerid, textstr, sizeof( textstr ) );
  190. format( textstr, sizeof( textstr ),"V.I.P Chat: {00FF00}%s{FF5500}: %s", textstr, text[ 1 ] );
  191. SendVipMessage( COLOR_VIP, textstr );
  192. return 0;
  193. }
  194. return 1;
  195. }
  196.  
  197. public OnPlayerExitVehicle( playerid, vehicleid )
  198. {
  199. for ( new i = 0; i < MAX_PLAYERS; i++ )
  200. {
  201. if ( GetPlayerState( i ) == PLAYER_STATE_SPECTATING && P_DATA[ i ][ SpecID ] == playerid && P_DATA[ i ][ SpecType ] == ADMIN_SPEC_TYPE_VEHICLE)
  202. {
  203. TogglePlayerSpectating( i, 1 );
  204. PlayerSpectatePlayer( i, playerid );
  205. P_DATA[ i ][ SpecType ] = ADMIN_SPEC_TYPE_PLAYER;
  206. }
  207. }
  208. return 1;
  209. }
  210. //================================================================================================================================//
  211. //======================================================== [ Comenzi ] ===========================================================//
  212. CMD:setvip( playerid, params[ ] )
  213. {
  214. new giveplayerid, level;
  215. new string[ 128 ], Query[ 256 ], DBResult:Resultat;
  216.  
  217. if ( !IsPlayerAdmin( playerid ) ) return SendClientMessage( playerid, RED, "Only RCON Administrator can use this command!" );
  218. if ( sscanf( params, "ud", giveplayerid, level ) ) return SendClientMessage( playerid, RED, "USAGE: {FFFF00}/setvip [playerid] [level]" );
  219. if ( giveplayerid == INVALID_PLAYER_ID ) return SendClientMessage( playerid, RED, "Player Is Not Connected!" );
  220. if ( level > 3 ) return SendClientMessage( playerid, RED, "Maximum V.I.P level is 3!" );
  221.  
  222. format( Query, sizeof( Query ), "SELECT * FROM `Vips` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
  223. Resultat = db_query( Database, Query );
  224. if ( !db_num_rows( Resultat ) )
  225. {
  226. P_DATA[ giveplayerid ][ Vip ] = level;
  227. format( string, sizeof( string ), "Administrator %s has set your V.I.P level to %d!", PlayerName2( playerid ), level );
  228. SendClientMessage( giveplayerid, ABLUE, string );
  229. format( Query, sizeof( Query ), "INSERT INTO `Vips` ( `Nume`,`VipLevel`,`VSkin` ) VALUES('%s','%d','-1')", PlayerName2( playerid ), level );
  230. db_free_result( db_query( Database, Query ) );
  231. } else {
  232. format( Query, sizeof( Query ), "UPDATE `Vips` SET `VipLevel` = '%d' WHERE `Nume` = '%s'", level, PlayerName2( giveplayerid ) );
  233. db_free_result( db_query( Database, Query ) );
  234. format( string, sizeof( string ), "Administrator %s has update your V.I.P level to %d", PlayerName2( playerid ), level );
  235. SendClientMessage( giveplayerid, ABLUE, string );
  236. }
  237. return 1;
  238. }
  239.  
  240. CMD:vipgoto( playerid , params[ ] )
  241. {
  242. new PID, string[ 128 ];
  243.  
  244. if ( P_DATA[ playerid ][ Vip ] <= 2 ) return SendClientMessage( playerid, RED, "You need to be V.I.P level 2 or bigest to use this command!" );
  245. if ( sscanf( params, "u", PID ) ) return SendClientMessage( playerid, RED, "USAGE: {FFFF00}/vipgoto [playerid]" );
  246.  
  247. new Float:x, Float:y, Float:z;
  248. GetPlayerPos( PID , x , y , z );
  249. SetPlayerInterior( playerid , GetPlayerInterior( PID ) );
  250. SetPlayerVirtualWorld( playerid , GetPlayerVirtualWorld( PID ) );
  251. if ( IsPlayerConnected( PID ) && PID != INVALID_PLAYER_ID && PID != playerid )
  252. {
  253. if ( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER )
  254. {
  255. SetVehiclePos( GetPlayerVehicleID( playerid ) , x+3 , y , z );
  256. LinkVehicleToInterior( GetPlayerVehicleID( playerid ), GetPlayerInterior( PID ) );
  257. SetVehicleVirtualWorld( GetPlayerVehicleID( playerid ), GetPlayerVirtualWorld( PID ) );
  258. format( string , sizeof( string ), "You have teleported to %s's location!" , PlayerName2( PID ) );
  259. SendClientMessage( playerid ,COLOR_VIP ,string );
  260. format( string, sizeof( string ), "V.I.P {00FF00}%s(%d) {FF5500}has teleported to your location!", PlayerName2( playerid ), P_DATA[ playerid ][ Vip ] );
  261. SendClientMessage( PID, COLOR_VIP, string );
  262. #if defined VIPS_SEND_COMMAND
  263. SendVipsCommand( playerid, "/vipgoto" );
  264. #endif
  265. } else {
  266. #if defined VIPS_SEND_COMMAND
  267. SendVipsCommand( playerid, "/vipgoto" );
  268. #endif
  269. SetPlayerPos( playerid , x+2 , y , z );
  270. format( string, sizeof( string ), "V.I.P {00FF00}%s(%d) {FF5500}has teleported to your location!", PlayerName2( playerid ), P_DATA[ playerid ][ Vip ] );
  271. SendClientMessage( PID, COLOR_VIP, string );
  272. format( string , sizeof( string ), "You have teleported to %s's location!" , PlayerName2( PID ) );
  273. SendClientMessage( playerid ,COLOR_VIP ,string ); }
  274. } else {
  275. SendClientMessage( playerid, RED, "Player not connected or is yourself!" ); }
  276. return 1;
  277. }
  278.  
  279. CMD:spawnme( playerid, params[ ] )
  280. {
  281. if ( P_DATA[ playerid ][ Vip ] <= 1 ) return SendClientMessage( playerid, RED, "You need to be V.I.P level 1 or bigest to use this command!" );
  282.  
  283. SpawnPlayer( playerid );
  284. SendClientMessage( playerid, COLOR_VIP, "You have been respawmed!" );
  285. #if defined VIPS_SEND_COMMAND
  286. SendVipsCommand( playerid, "/spawnme" );
  287. #endif
  288. return 1;
  289. }
  290.  
  291. CMD:vips( playerid, params[ ] )
  292. {
  293. new count = 0;
  294. new vstr[ 1048 ]; // Am pus un string mare ca poate aveti mai multi V.I.P-ii si asa daca ii mic o sa ma intrebati dc nu apar:P
  295.  
  296. for ( new i = 0; i < MAX_PLAYERS; i++ )
  297. {
  298. if ( IsPlayerConnected( i ) && P_DATA[ i ][ Vip ] >= 1 )
  299. {
  300. format( vstr, sizeof( vstr ), "{FF5500}V.I.P: {00FF00}%s {FF5500}- Level {00FF00}%d", PlayerName2( playerid ), P_DATA[ i ][ Vip ] );
  301. count++;
  302. }
  303. }
  304. if ( count == 0 )
  305. {
  306. format ( vstr, sizeof( vstr ), "\n{E60000}No V.I.Ps online at the moment!" );
  307. }
  308. return ShowPlayerDialog( playerid, VIPS, DIALOG_STYLE_MSGBOX, "{00FF00}Online V.I.Ps:", vstr, "Quit", "" );
  309. }
  310.  
  311. CMD:myweather( playerid, params[ ] )
  312. {
  313. new weather, string[ 128 ];
  314.  
  315. if ( P_DATA[ playerid ][ Vip ] <= 1 ) return SendClientMessage( playerid, RED, "You need to be level V.I.P 1 or bigest to use this command!" );
  316. if ( sscanf( params, "d", weather ) ) return SendClientMessage( playerid, RED, "USAGE: {FFFF00}/myweather [weatherid]" );
  317. if ( ( weather < 0 ) || ( weather > 52 ) ) return SendClientMessage( playerid, RED, "Only between 0 and 52 weather ids!" );
  318.  
  319. SetPlayerWeather( playerid, weather );
  320. format( string, sizeof( string ), "You have set your weather to {E60000}%d", weather );
  321. SendClientMessage( playerid, COLOR_VIP, string );
  322. #if defined VIPS_SEND_COMMAND
  323. SendVipsCommand( playerid, "/myweather" );
  324. #endif
  325. return 1;
  326. }
  327.  
  328. CMD:mytime( playerid, params[ ] )
  329. {
  330. new time, string[ 128 ];
  331.  
  332. if ( P_DATA[ playerid ][ Vip ] <= 1 ) return SendClientMessage( playerid, RED, "You need to be level V.I.P 1 or bigest to use this command!" );
  333. if ( sscanf( params, "d", time ) ) return SendClientMessage( playerid, RED, "USAGE: {FFFF00}/mytime [time]" );
  334. if ( ( time < 0 ) || ( time > 24 ) ) return SendClientMessage( playerid, RED, "Only between 0 and 24 hours you can set your time!" );
  335.  
  336. SetPlayerTime( playerid, time, 0 );
  337. format( string, sizeof( string ), "You have set your time to {E60000}%d", time );
  338. SendClientMessage( playerid, COLOR_VIP, string );
  339. #if defined VIPS_SEND_COMMAND
  340. SendVipsCommand( playerid, "/mytime" );
  341. #endif
  342. return 1;
  343. }
  344.  
  345. CMD:myvw( playerid, params[ ] )
  346. /*
  347. Cu comanda asta iti setezi Virual Wolrd-ul!
  348. VW = Virtual Wolrd:P ATENTIE!: Comanda asta se va folosi doar de laif ( sscanf( params, "s", VipMessage ) ) return SendClientMessage( playerid, RED, "USAGE: {FFFF00}/vasay [text]" ); V.I.P level 2:P
  349. Eu am pus acolo ca iti poti seta Virtual World-ul pana la 100 dar voi puteti sa schimbati in cat vreti!
  350. */
  351. {
  352. new vw, string[ 128 ];
  353.  
  354. if ( P_DATA[ playerid ][ Vip ] <= 2 ) return SendClientMessage( playerid, RED, "You need to be V.I.P level 2 or bigest to use this command!" );
  355. if ( sscanf( params, "d", vw ) ) return SendClientMessage( playerid, RED, "USAGE: {FFFF00}/myvw [virtualworld]" );
  356. if ( ( vw < 0 ) || ( vw > 100 ) ) return SendClientMessage( playerid, RED, "Only between 0 and 100 Virtual Wolrlds you can set!" );
  357. if ( vw == 0 ) return SendClientMessage( playerid, YELLOW, "You have returned back in normal world( 0 )!" );
  358.  
  359. SetPlayerVirtualWorld( playerid, vw );
  360. format( string, sizeof( string ), "You have set your Virtual World to {E60000}%d", vw );
  361. SendClientMessage( playerid, COLOR_VIP, string );
  362. #if defined VIPS_SEND_COMMAND
  363. SendVipsCommand( playerid, "/myvw" );
  364. #endif
  365. return 1;
  366. }
  367.  
  368. CMD:vasay( playerid, params[ ] )
  369. {
  370. new VipMessage[ 180 ]; // 180 de caractere poti sa scrii intr-un mesaj din asta! Puteti sa setati in cate vreti voi!
  371.  
  372. if ( P_DATA[ playerid ][ Vip ] <= 2 ) return SendClientMessage( playerid, RED, "You need to be V.I.P level 2 or bigest to use this command!" );
  373. if ( sscanf( params, "s[ 120 ]", VipMessage ) ) return SendClientMessage( playerid, RED, "USAGE: {FFFF00}/vasay [text]" );
  374.  
  375. format( VipMessage, sizeof( VipMessage ), "V.I.P - %s {FFFF00}(lvl: %d): {00FF00}%s", PlayerName2( playerid ), P_DATA[ playerid ][ Vip ], VipMessage );
  376. SendClientMessageToAll( COLOR_VIP, VipMessage );
  377. #if defined VIPS_SEND_COMMAND
  378. SendVipsCommand( playerid, "/vasay" );
  379. #endif
  380. return 1;
  381. }
  382.  
  383. CMD:maxammo( playerid, params[ ] )
  384. {
  385. if ( P_DATA[ playerid ][ Vip ] == 3 ) return SendClientMessage( playerid, RED, "ERROR: You need to be V.I.P level 3 to use this command!" );
  386.  
  387. SendPlayerMaxAmmo( playerid );
  388. SendClientMessage( playerid, COLOR_VIP, "You have added {00FF00}Max Ammo{FF5500} to your weapons!" );
  389. #if defined VIPS_SEND_COMMAND
  390. SendVipsCommand( playerid, "/MaxAmmo" );
  391. #endif
  392. return 1;
  393. }
  394.  
  395. CMD:vweapons( playerid, params[ ] )
  396. {
  397. if ( P_DATA[ playerid ][ Vip ] <= 2 ) return SendClientMessage( playerid, RED, "You need to be V.I.P level 2 or bigest to use this command!" );
  398.  
  399. GivePlayerWeapon( playerid ,28, 120); //Arma: Micro SMG || Gloante: 120 - Puteti sa schimbati numaru gloantele!
  400. GivePlayerWeapon( playerid, 31, 75); //Arma: M4 || Gloante: 75 - Puteti sa schimbati numaru gloantele!
  401. GivePlayerWeapon( playerid, 34, 15); //Arma: Sniper Rifle || Gloante: 15 - Puteti sa schimbati numaru gloantele!
  402. GivePlayerWeapon( playerid, 24, 110); //Arma: Desert Eagle || Gloante: 110 - Puteti sa schimbati numaru gloantele!
  403. GivePlayerWeapon( playerid, 26, 100); //Arma: Sawn-off Shotgun || Gloante: 100 - Puteti sa schimbati numaru gloantele!
  404. #if defined VIPS_SEND_COMMAND
  405. SendVipsCommand( playerid, "/vweapons" );
  406. #endif
  407. //De asemenea puteti sa schimbati si armlele pe care sa dea V.I.P-iilor la comanda asta!
  408. //Sursa: http://wiki.sa-mp.com/wiki/Weapons || Gasiti ID-urile armelor!
  409. return 1;
  410. }
  411.  
  412. CMD:vspec( playerid, params[ ] ) //Comenzile /vspec si /vspecoff le-am pus inainte un V pentru ca poate folositi ladmin si acolo sunt comenizile astea dar fara V!
  413. {
  414. new PID, string[ 128 ];
  415.  
  416. if ( P_DATA[ playerid ][ Vip ] <= 1 ) return SendClientMessage( playerid, RED, "ERROR: You need to be V.I.P level 1 or bigest to use this command!" );
  417. if ( sscanf( params, "u", PID ) ) return SendClientMessage( playerid, RED, "USAGE: {FFFF00}/vspec [playerid]" );
  418.  
  419. if ( IsPlayerConnected( PID ) && PID != INVALID_PLAYER_ID && PID != playerid )
  420. {
  421. if ( GetPlayerState( PID ) == PLAYER_STATE_SPECTATING && P_DATA[ PID ][ SpecID ] != INVALID_PLAYER_ID )
  422. {
  423. if ( GetPlayerState( PID ) != 1 && GetPlayerState( PID ) != 2 && GetPlayerState( PID ) != 3)
  424. {
  425. SpectatePlayer( playerid, PID );
  426. GetPlayerPos( playerid, Position[ playerid ][ 0 ], Position[ playerid ][ 1 ], Position[ playerid ][ 2 ] );
  427. GetPlayerFacingAngle( playerid, Position[ playerid ][ 3 ] );
  428. format( string, sizeof( string ), "Now you spectating %s (%d)", PlayerName2( PID ), PID );
  429. SendClientMessage( playerid, COLOR_VIP, string );
  430. #if defined VIPS_SEND_COMMAND
  431. SendVipsCommand( playerid, "/vspec" );
  432. #endif
  433. } else {
  434. SendClientMessage( playerid, RED, "ERROR: Player not spawned!" ); }
  435. } else {
  436. SendClientMessage( playerid, RED, "ERROR: Player spectating someone else!" ); }
  437. } else {
  438. SendClientMessage( playerid, RED, "ERROR: Player is not connected or is yourself!" ); }
  439. return 1;
  440. }
  441.  
  442. CMD:vspecoff( playerid, params[ ] )
  443. {
  444. if ( P_DATA[ playerid ][ Vip ] <= 1 ) return SendClientMessage( playerid , RED, "ERROR: You need to be V.I.P level 1 or bigest to use this command!" );
  445.  
  446. if ( P_DATA[ playerid ][ SpecType ] != ADMIN_SPEC_TYPE_NONE )
  447. {
  448. StopSpectate( playerid );
  449. SetTimerEx("ReturnPosition", 3000, 0, "d", playerid );
  450. SendClientMessage( playerid, COLOR_VIP, "You have stop spectating" );
  451. #if defined VIPS_SEND_COMMAND
  452. SendVipsCommand( playerid, "/vspecoff" );
  453. #endif
  454. } else {
  455. SendClientMessage( playerid, RED, "ERROR: You are not spectating" ); }
  456. return 1;
  457. }
  458.  
  459. CMD:vsaveskin( playerid, params[ ] ) //De asemenea am pus si aici un V inainte! (V de la V.I.P :P)
  460. {
  461. new SkinID, string[ 128 ], Query[ 256 ];
  462.  
  463. if ( P_DATA[ playerid ][ Vip ] <= 2 ) return SendClientMessage( playerid , RED, "ERROR: You need to be V.I.P level 2 or bigest to use this command!" );
  464.  
  465. SkinID = GetPlayerSkin( playerid );
  466. format( Query, sizeof( Query ), "UPDATE `Vips` SET `VSkin` = '%d' WHERE `Nume` = '%s' ", SkinID, PlayerName2( playerid ) );
  467. db_free_result( db_query( Database, Query ) );
  468. format( string, sizeof( string ), "You have successfully saved this skin (ID: %d)", SkinID );
  469. SendClientMessage( playerid, COLOR_VIP, string );
  470. SendClientMessage( playerid, COLOR_VIP, "Type /dontuseskin for don't save again this skin!" );
  471. #if defined VIPS_SEND_COMMAND
  472. SendVipsCommand( playerid, "/vsaveskin" );
  473. #endif
  474. return 1;
  475. }
  476.  
  477. CMD:dontuseskin( playerid, params[ ] )
  478. {
  479. new Query[ 256 ];
  480.  
  481. if ( P_DATA[ playerid ][ Vip ] <= 2 ) return SendClientMessage( playerid , RED, "ERROR: You need to be V.I.P level 2 or bigest to use this command!" );
  482.  
  483. format( Query, sizeof( Query ), "UPDATE `Vips` SET `VSkin` = '-1' WHERE `Nume` = '%s' ", PlayerName2( playerid ) );
  484. db_free_result( db_query( Database, Query ) );
  485. #if defined VIPS_SEND_COMMAND
  486. SendVipsCommand( playerid, "/dontuseskin" );
  487. #endif
  488. SendClientMessage( playerid, COLOR_VIP, "Your saved skin is never been used!" );
  489. return 1;
  490. }
  491.  
  492. CMD:mycolor( playerid, params[ ] )
  493. {
  494. new Colour, colour[ 24 ];
  495.  
  496. if ( P_DATA[ playerid ][ Vip ] <= 1 ) return SendClientMessage( playerid , RED, "ERROR: You need to be V.I.P level 2 or bigest to use this command!" );
  497. if ( sscanf( params, "d", Colour ) ) return Send2Clients( playerid, "/mycolor [color]", "0 = Black | 1 = White | 2 = Red | 3 = Orange | 4 = Yellow | 5 = Green | 6 = Blue | 7 = Purple | 8 = Brown" );
  498. if ( Colour > 8 ) return SendClientMessage( playerid, RED, "Colours: 0 = Black | 1 = White | 2 = Red | 3 = Orange | 4 = Yellow | 5 = Green | 6 = Blue | 7 = Purple | 8 = Brown" );
  499.  
  500. switch ( Colour ) {
  501. case 0: { SetPlayerColor( playerid, 0x000000AA ); colour = "Black"; }
  502. case 1: { SetPlayerColor( playerid, 0xFFFFFFAA ); colour = "White"; }
  503. case 2: { SetPlayerColor( playerid, 0xE60000AA ); colour = "Red"; }
  504. case 3: { SetPlayerColor( playerid, 0xFF5500AA ); colour = "Orange"; }
  505. case 4: { SetPlayerColor( playerid, 0xFFFF00AA ); colour = "Yellow"; }
  506. case 5: { SetPlayerColor( playerid, 0x00FF00AA ); colour = "Green"; }
  507. case 6: { SetPlayerColor( playerid, 0x0000BBAA ); colour = "Blue"; }
  508. case 7: { SetPlayerColor( playerid, 0x800080AA ); colour = "Purple"; }
  509. case 8: { SetPlayerColor( playerid, 0xA52A2AAA ); colour = "Brown"; } }
  510. #if defined VIPS_SEND_COMMAND
  511. SendVipsCommand( playerid, "/mycolor" );
  512. #endif
  513. return 1;
  514. }
  515.  
  516. CMD:vcmds( playerid, params[ ] )
  517. {
  518. new string[ 1024 ];
  519.  
  520. if ( P_DATA[ playerid ][ Vip ] <= 1 ) return ShowPlayerDialog( playerid, VIPCMDS+1, DIALOG_STYLE_MSGBOX, "{E60000}Not Allowed", "{E60000}You need to bee V.I.P level 1 or biggest to use this command!", "Quit", "" );
  521.  
  522. strcat( string, "{FF5500}V.I.P Level {00FF00}1 {FF5500}Commands:\t{FF5500}V.I.P Level {00FF00}2 {FF5500}Commands:\t{FF5500}V.I.P Level {00FF00}3 {FF5500}Commands:\n\n" );
  523. strcat( string, "{FFFF00}/mytime\t\t\t/vsaveskin\t\t\t/vkick\n" );
  524. strcat( string, "/myweather\t\t\t/dontuseskin\t\t\t/vget\n" );
  525. strcat( string, "/myvw\t\t\t\t/vweapons\t\t\t/vannounce\n" );
  526. strcat( string, "/mycolor\t\t\t/vipgoto\t\t\t/rw\n" );
  527. strcat( string, "/vspec\t\t\t\t/vasay\t\t\t\t/maxammo\n" );
  528. strcat( string, "/vspecoff\t\t\t+V.I.P level 1 CMDS\t\t+ V.I.P level 1&2 CMDS\n" );
  529. strcat( string, "/spawnme\n/vcmds\n\n" );
  530. strcat( string, "{FF5500}Use simbol {00FF00}! {FF5500}in front of your text to speak in V.I.P Chat\n" );
  531. ShowPlayerDialog( playerid, VIPCMDS, DIALOG_STYLE_MSGBOX, "V.I.P Commands:", string, "Quit", "" );
  532. #if defined VIPS_SEND_COMMAND
  533. SendVipsCommand( playerid, "/vcmds" );
  534. #endif
  535. return 1;
  536. }
  537.  
  538. CMD:vget( playerid, params[ ] )
  539. {
  540. new PID, string[ 256 ];
  541. new Float:x, Float:y, Float:z;
  542.  
  543. if ( P_DATA[ playerid ][ Vip ] == 3 ) return SendClientMessage( playerid , RED, "ERROR: You need to be V.I.P level 3 to use this command!" );
  544. if ( sscanf( params, "u", PID ) ) return SendClientMessage( playerid, RED, "USAGE: {FFFF00}/vget [playerid]" );
  545.  
  546. if ( IsPlayerConnected( PID ) && PID != INVALID_PLAYER_ID && PID != playerid )
  547. {
  548. GetPlayerPos( playerid, x, y, z );
  549. SetPlayerInterior( PID, GetPlayerInterior( playerid ) );
  550. SetPlayerVirtualWorld( PID, GetPlayerVirtualWorld( playerid ) );
  551. if ( GetPlayerState( PID ) == 2 )
  552. {
  553. new VehicleID = GetPlayerVehicleID( PID );
  554. SetVehiclePos( VehicleID, x+3, y, z);
  555. LinkVehicleToInterior( VehicleID, GetPlayerInterior( PID ) );
  556. SetVehicleVirtualWorld( GetPlayerVehicleID( PID ), GetPlayerVirtualWorld( PID ) );
  557. format( string, sizeof( string ),"You have been teleported to V.I.P {00FF00}%s's {FF5500}location", PlayerName2( playerid ) );
  558. SendClientMessage( PID, COLOR_VIP, string );
  559. format( string, sizeof( string ),"You have teleported {00FF00}%s {FF5500}to your location", PlayerName2( PID ) );
  560. SendClientMessage( playerid, COLOR_VIP, string );
  561. #if defined VIPS_SEND_COMMAND
  562. SendVipsCommand( playerid, "/vget" );
  563. #endif
  564. } else {
  565. SetPlayerPos( PID, x+2, y, z );
  566. #if defined VIPS_SEND_COMMAND
  567. SendVipsCommand( playerid, "/vget" );
  568. #endif
  569. format( string, sizeof( string ),"You have been teleported to V.I.P {00FF00}%s's {FF5500}location", PlayerName2( playerid ) );
  570. SendClientMessage( PID, COLOR_VIP, string );
  571. format( string, sizeof( string ),"You have teleported {00FF00}%s {FF5500}to your location", PlayerName2( PID ) );
  572. SendClientMessage( playerid, COLOR_VIP, string ); }
  573. } else {
  574. SendClientMessage( playerid, RED, "Player is not connected or is yourself!" ); }
  575. return 1;
  576. }
  577.  
  578. CMD:vkick( playerid, params[ ] )
  579. {
  580. new string[ 20 ], PID, reason;
  581.  
  582. if ( P_DATA[ playerid ][ Vip ] == 3 ) return SendClientMessage( playerid , RED, "ERROR: You need to be V.I.P level 3 to use this command!" );
  583. if ( sscanf( params, "us[20]", PID, reason ) ) return SendClientMessage( playerid, RED, "USAGE: {FFFF00}/vkick [playerid] [reason]" );
  584.  
  585. if ( IsPlayerConnected( PID ) && PID != INVALID_PLAYER_ID && PID != playerid )
  586. {
  587. if ( !strlen( params[ 1 ] ) )
  588. {
  589. format( string, sizeof( string ), "%s {FF5500}has been kicked by V.I.P {00FF00}%s {FF5500}[no reason given]!",PlayerName2( PID ), PlayerName2( playerid ) );
  590. SendClientMessageToAll( GREEN, string );
  591. #if defined VIPS_SEND_COMMAND
  592. SendVipsCommand( playerid, "/vkick" );
  593. #endif
  594. } else {
  595. #if defined VIPS_SEND_COMMAND
  596. SendVipsCommand( playerid, "/vkick" );
  597. #endif
  598. format( string, sizeof( string ), "%s {FF5500}has been kicked by V.I.P {00FF00}%s {FF5500}[reason: {00FF00%s{FF5500}] ", PlayerName2( PID ), PlayerName2( playerid ), reason);
  599. SendClientMessageToAll( GREEN, string ); }
  600. } else {
  601. SendClientMessage( playerid, RED, "Player is not connected or is yourself!" ); }
  602. return 1;
  603. }
  604.  
  605. CMD:rw( playerid, params[ ] )
  606. {
  607. if ( P_DATA[ playerid ][ Vip ] == 3 ) return SendClientMessage( playerid, RED, "ERROR: You need to be V.I.P level 3 to use this command!" );
  608.  
  609. GivePlayerWeapon( playerid, 4, 1); //Knife
  610. GivePlayerWeapon( playerid, 28, 1000); // Micro - SMG
  611. GivePlayerWeapon( playerid, 26, 100); // Sawn-off Shotgun
  612. GivePlayerWeapon( playerid, 22, 500); // 9mm Pistol
  613. //Source: http://wiki.sa-mp.com/wiki/Weapons !
  614. SendClientMessage( playerid, COLOR_VIP, "You got an Runing Weapons package!" );
  615. #if defined VIPS_SEND_COMMAND
  616. SendVipsCommand( playerid, "/vkick" );
  617. #endif
  618. return 1;
  619. }
  620.  
  621. forward SendVipMessage( color, const string[ ] );
  622. public SendVipMessage( color, const string[ ] )
  623. {
  624. for ( new i = 0; i < MAX_PLAYERS; i++ )
  625. {
  626. if ( IsPlayerConnected( i ) )
  627. {
  628. if ( P_DATA[ i ][ Vip ] >= 1 )
  629. {
  630. SendClientMessage( i, color, string );
  631. }
  632. }
  633. }
  634. return 1;
  635. }
  636.  
  637. forward ReturnPosition( playerid );
  638. public ReturnPosition( playerid )
  639. {
  640. SetPlayerPos( playerid, Position[ playerid ][ 0 ], Position[ playerid ][ 1 ], Position[ playerid ][ 2 ] );
  641. SetPlayerFacingAngle( playerid, Position[ playerid ][ 3 ] );
  642. }
  643. //============================================= [ Stocks ] =======================================================//
  644. stock PlayerName2( i ){
  645. new n[ 24 ];
  646. GetPlayerName( i, n, 24 );
  647. return n;
  648. }
  649. stock SpectatePlayer( playerid, PID )
  650. {
  651. new string[ 100 ], Float:health, Float:armour;
  652.  
  653. for(new i = 0; i < MAX_PLAYERS; i++ )
  654. {
  655. if ( GetPlayerState( i ) == PLAYER_STATE_SPECTATING && P_DATA[ i ][ SpecID ] == playerid )
  656. {
  657. AdvanceSpectate( i );
  658. }
  659. }
  660. SetPlayerInterior( playerid, GetPlayerInterior( PID ) );
  661. TogglePlayerSpectating( playerid, 1 );
  662. if ( IsPlayerInAnyVehicle( PID ) )
  663. {
  664. PlayerSpectateVehicle( playerid, GetPlayerVehicleID( PID ) );
  665. P_DATA[ playerid ][ SpecID ] = PID;
  666. P_DATA[ playerid ][ SpecType ] = ADMIN_SPEC_TYPE_VEHICLE;
  667. } else {
  668. PlayerSpectatePlayer( playerid, PID );
  669. P_DATA[ playerid ][ SpecID ] = PID;
  670. P_DATA[ playerid ][ SpecType ] = ADMIN_SPEC_TYPE_PLAYER;
  671. }
  672. GetPlayerName( PID, string, sizeof( string ) );
  673. GetPlayerHealth( PID, health );
  674. GetPlayerArmour( PID, armour );
  675. format( string, sizeof( string ),"~n~~n~~n~~n~~n~~n~~n~n~~w~%s - id:%d~n~< sprint - jump >~n~~r~Health:%0.1f ~b~Armour:%0.1f~n~~g~$%d~n~~g~%d", string, PID, health, armour, GetPlayerMoney( PID ), GetPlayerScore( PID ) );
  676. GameTextForPlayer( playerid, string, 25000, 3 );
  677. return 1;
  678. }
  679. stock StopSpectate( playerid )
  680. {
  681. TogglePlayerSpectating( playerid, 0 );
  682. P_DATA[ playerid ][ SpecID ] = INVALID_PLAYER_ID;
  683. P_DATA[ playerid ][ SpecType ] = ADMIN_SPEC_TYPE_NONE;
  684. GameTextForPlayer( playerid,"~n~~n~~n~~w~Spectate mode ended", 1000, 3 );
  685. return 1;
  686. }
  687. stock AdvanceSpectate( playerid )
  688. {
  689. if ( ConnectedPlayers( ) == 2 )
  690. {
  691. StopSpectate( playerid );
  692. return 1;
  693. }
  694. if ( GetPlayerState( playerid ) == PLAYER_STATE_SPECTATING && P_DATA[ playerid ][ SpecID ] != INVALID_PLAYER_ID )
  695. {
  696. for ( new i = P_DATA[ playerid ][ SpecID] +1; i <= MAX_PLAYERS; i++ )
  697. {
  698. if ( i == MAX_PLAYERS ) i = 0;
  699. if ( IsPlayerConnected( i ) && i != playerid )
  700. {
  701. if ( GetPlayerState( i ) == PLAYER_STATE_SPECTATING && P_DATA[ i ][ SpecID ] != INVALID_PLAYER_ID || ( GetPlayerState( i ) != 1 && GetPlayerState( i ) != 2 && GetPlayerState( i ) != 3 ) )
  702. {
  703. continue;
  704. } else {
  705. SpectatePlayer( playerid, i );
  706. break;
  707. }
  708. }
  709. }
  710. }
  711. return 1;
  712. }
  713. stock ConnectedPlayers( )
  714. {
  715. new Connected;
  716. for ( new i = 0; i < MAX_PLAYERS; i++ ) if ( IsPlayerConnected( i ) ) Connected++;
  717. return Connected;
  718. }
  719. stock Send2Clients( playerid, Client1[ ], Client2[ ] )
  720. {
  721. new Str[ 256 ];
  722. format( Str, sizeof( Str ), "Usage: {FFFF00} %s", Client1 );
  723. SendClientMessage( playerid, RED, Str );
  724. format( Str, sizeof( Str ), "Colours: {00FF00} %s", Client2 );
  725. SendClientMessage( playerid, RED, Str );
  726. return 1;
  727. }
  728. #if defined VIPS_SEND_COMMAND
  729. stock SendVipsCommand( playerid, cmdtext[ ] )
  730. {
  731. new string[128];
  732. GetPlayerName( playerid, string, sizeof( string ) );
  733. format( string, sizeof( string ),"[V.I.P] {00FF00}%s(%d) {FF5500}has used command {00FF00}%s", string, playerid, cmdtext );
  734. return SendVipMessage( COLOR_VIP, string );
  735. }
  736. #endif
  737. stock ReverseSpectate( playerid )
  738. {
  739. if ( ConnectedPlayers( ) == 2 )
  740. {
  741. StopSpectate( playerid );
  742. return 1;
  743. }
  744. if ( GetPlayerState( playerid ) == PLAYER_STATE_SPECTATING && P_DATA[ playerid ][ SpecID ] != INVALID_PLAYER_ID )
  745. {
  746. for ( new i = P_DATA[ playerid ][ SpecID ]-1; i >= 0; i-- )
  747. {
  748. if ( i == 0 ) i = MAX_PLAYERS;
  749. if ( IsPlayerConnected( i ) && i != playerid )
  750. {
  751. if ( GetPlayerState( i ) == PLAYER_STATE_SPECTATING && P_DATA[ i ][ SpecID ] != INVALID_PLAYER_ID || ( GetPlayerState( i ) != 1 && GetPlayerState( i ) != 2 && GetPlayerState( i ) != 3 ) )
  752. {
  753. continue;
  754. } else {
  755. SpectatePlayer( playerid, i );
  756. break;
  757. }
  758. }
  759. }
  760. }
  761. return 1;
  762. }
  763. stock SendPlayerMaxAmmo( playerid )
  764. {
  765. new slot, weap, ammo;
  766.  
  767. for ( slot = 0; slot < 14; slot++ )
  768. {
  769. GetPlayerWeaponData( playerid, slot, weap, ammo );
  770. if ( IsValidWeapon( weap ) )
  771. {
  772. GivePlayerWeapon( playerid, weap, 99999 );
  773. }
  774. }
  775. return 1;
  776. }
  777. stock IsValidWeapon( weaponid )
  778. {
  779. if ( weaponid > 0 && weaponid < 19 || weaponid > 21 && weaponid < 47 ) return 1;
  780. return 0;
  781. }
Advertisement
Add Comment
Please, Sign In to add comment