Advertisement
KingOfVC

tjrjrtj

Oct 21st, 2014
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1. function jail ( id )
  2. {
  3. local plr = FindPlayer ( id );
  4. if ( plr )
  5. {
  6. local jailtime = PlayerWanted( player ) * 20
  7. status[ plr.ID ].Jailed = true;
  8. plr.Pos = Vector ( 388.680, -509.527, 8.415 )
  9. QuerySQL( db,"UPDATE Jail SET Jailed='yes' WHERE Name='" + plr.Name +"'");
  10. QuerySQL( db,"UPDATE Jail SET time='" + jailtime + "' WHERE Name='" + plr.Name +"'");
  11. NewTimer( "unjail", jailtime ,1,plr.ID );
  12. }
  13. }
  14.  
  15. function unjail ( id )
  16. {
  17. local plr = FindPlayer ( id );
  18. if ( plr )
  19. {
  20.  
  21. status[ plr.ID ].Jailed = false;
  22. QuerySQL( db,"UPDATE Jail SET Jailed='no' WHERE Name='" + plr.Name +"'");
  23. QuerySQL( db,"UPDATE Jail SET time='0' WHERE Name='" + plr.Name +"'");
  24. QuerySQL( db,"UPDATE Jail SET wanted='0' WHERE Name='" + plr.Name +"'");
  25. plr.Pos = Vector ( 397.718, -471.137, 11.7534 )
  26. MessagePlayer ( "Free ",plr );
  27. }
  28. }
  29. function PlayerWanted( player )
  30. {
  31. local id = player.Name;
  32. local Answer = QuerySQL( db, "SELECT wanted FROM Jail WHERE Name='" + player.Name +"' COLLATE NOCASE" );
  33. local Wanted = GetSQLColumnData( Answer, 0 );
  34. return Wanted;
  35. FreeSQLQuery( Answer );
  36. }
  37. function PlayerJob( player )
  38. {
  39. local name = player.Name;
  40. local Answer = QuerySQL( db, "SELECT LastJob FROM Job WHERE Name='" + player.Name +"' COLLATE NOCASE" );
  41. local Job = GetSQLColumnData( Answer, 0 );
  42. return Job;
  43. FreeSQLQuery( Answer );
  44. }
  45. function IncXP( player, text )// XP system
  46. {
  47. local name = player.Name;
  48. local query1 = format( "UPDATE Account SET XP='" + text +"' WHERE Name='" + player.Name.tolower() +"'");
  49. QuerySQL( db, query1 );
  50. }
  51. // ================== cmds=========
  52. else if ( cmd == "arrest" )
  53. {
  54. if ( player.IsSpawned )
  55. {
  56. if(PlayerJob(player).tointeger() > 0)
  57. {
  58. if ( text )
  59. {
  60. local plr = FindPlayer( text );
  61. if(plr)
  62. {
  63. if(GetPlayerDistance(player,plr) <= 3)
  64. {
  65. local q = QuerySQL( db, "SELECT Jailed FROM Jail WHERE Name='" + plr.Name + "'");
  66. if ( GetSQLColumnData(q, 0 ) == "yes" ) ClientMessage ( "Error - You cannot cuff a jailed player.", player,255,255,0);
  67. else
  68. {
  69. if(PlayerWanted(plr).tointeger() > 0)
  70. {
  71. //if( status[ plr.ID ].Jailed(plr) == true ) ClientMessage ( "> "+plr.Name+" is in jail.",player,255,255,0);
  72. if( plr.Vehicle ) ClientMessage ( "> "+plr.Name+" is in a Vehicle.",player,255,255,0);
  73. else
  74. {
  75. jail (text)
  76. IncXP( player, 4 )// XP system
  77. MessagePlayer("You has arrested " + plr.Name + " Reward: 3XP and and $300");
  78. }
  79. }
  80. else ClientMessage ( "> "+plr.Name+" is not wanted.",player,255,255,0);
  81. }
  82. }
  83. else ClientMessage ( "You need to be close to "+plr.Name+" to cuff him/her.",player,255,255,0);
  84. }
  85. else ClientMessage ( "Error - Unknown player", player,255,255,0);
  86. }
  87. else ClientMessage ( "Usage: /c " + cmd + " <nick/ID>", player,255,255,0);
  88. }
  89. else ClientMessage ( "Error - You need to be a part of the police team to use that command.", player,255,255,0);
  90. }
  91. else ClientMessage ( "Error - You haven't spawned.", player,255,255,0);
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement