Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function jail ( id )
- {
- local plr = FindPlayer ( id );
- if ( plr )
- {
- local jailtime = PlayerWanted( player ) * 20
- status[ plr.ID ].Jailed = true;
- plr.Pos = Vector ( 388.680, -509.527, 8.415 )
- QuerySQL( db,"UPDATE Jail SET Jailed='yes' WHERE Name='" + plr.Name +"'");
- QuerySQL( db,"UPDATE Jail SET time='" + jailtime + "' WHERE Name='" + plr.Name +"'");
- NewTimer( "unjail", jailtime ,1,plr.ID );
- }
- }
- function unjail ( id )
- {
- local plr = FindPlayer ( id );
- if ( plr )
- {
- status[ plr.ID ].Jailed = false;
- QuerySQL( db,"UPDATE Jail SET Jailed='no' WHERE Name='" + plr.Name +"'");
- QuerySQL( db,"UPDATE Jail SET time='0' WHERE Name='" + plr.Name +"'");
- QuerySQL( db,"UPDATE Jail SET wanted='0' WHERE Name='" + plr.Name +"'");
- plr.Pos = Vector ( 397.718, -471.137, 11.7534 )
- MessagePlayer ( "Free ",plr );
- }
- }
- function PlayerWanted( player )
- {
- local id = player.Name;
- local Answer = QuerySQL( db, "SELECT wanted FROM Jail WHERE Name='" + player.Name +"' COLLATE NOCASE" );
- local Wanted = GetSQLColumnData( Answer, 0 );
- return Wanted;
- FreeSQLQuery( Answer );
- }
- function PlayerJob( player )
- {
- local name = player.Name;
- local Answer = QuerySQL( db, "SELECT LastJob FROM Job WHERE Name='" + player.Name +"' COLLATE NOCASE" );
- local Job = GetSQLColumnData( Answer, 0 );
- return Job;
- FreeSQLQuery( Answer );
- }
- function IncXP( player, text )// XP system
- {
- local name = player.Name;
- local query1 = format( "UPDATE Account SET XP='" + text +"' WHERE Name='" + player.Name.tolower() +"'");
- QuerySQL( db, query1 );
- }
- // ================== cmds=========
- else if ( cmd == "arrest" )
- {
- if ( player.IsSpawned )
- {
- if(PlayerJob(player).tointeger() > 0)
- {
- if ( text )
- {
- local plr = FindPlayer( text );
- if(plr)
- {
- if(GetPlayerDistance(player,plr) <= 3)
- {
- local q = QuerySQL( db, "SELECT Jailed FROM Jail WHERE Name='" + plr.Name + "'");
- if ( GetSQLColumnData(q, 0 ) == "yes" ) ClientMessage ( "Error - You cannot cuff a jailed player.", player,255,255,0);
- else
- {
- if(PlayerWanted(plr).tointeger() > 0)
- {
- //if( status[ plr.ID ].Jailed(plr) == true ) ClientMessage ( "> "+plr.Name+" is in jail.",player,255,255,0);
- if( plr.Vehicle ) ClientMessage ( "> "+plr.Name+" is in a Vehicle.",player,255,255,0);
- else
- {
- jail (text)
- IncXP( player, 4 )// XP system
- MessagePlayer("You has arrested " + plr.Name + " Reward: 3XP and and $300");
- }
- }
- else ClientMessage ( "> "+plr.Name+" is not wanted.",player,255,255,0);
- }
- }
- else ClientMessage ( "You need to be close to "+plr.Name+" to cuff him/her.",player,255,255,0);
- }
- else ClientMessage ( "Error - Unknown player", player,255,255,0);
- }
- else ClientMessage ( "Usage: /c " + cmd + " <nick/ID>", player,255,255,0);
- }
- else ClientMessage ( "Error - You need to be a part of the police team to use that command.", player,255,255,0);
- }
- else ClientMessage ( "Error - You haven't spawned.", player,255,255,0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement