NorbiNorbi
Wiek: 29 Na forum: 3204 dni Posty: 3
Nick w MP: NorbiTTT
Cze??, mam problem z pewn? komend?.. ./zpA/zpB i /zbC prosz? pom??cie, gdy wpisze komendy zeby zabrac prawo jazdy jakiejs kategori to nawet po zabraniu nadal mozna wsiadac i jezdzic
addCommandHandler ( "zpA" , function( plr , cmd , cel , time , rodzaj ,...)
if getAdmin ( plr , 4 ) or getAdmin ( plr , 3 ) or getAdmin ( plr , 2 ) or getAdmin ( plr , 1 ) then
local reason = table . concat ({...}, " " )
if not cel or not tonumber ( time ) or not rodzaj or not reason then
outputChatBox ( "U?ycie: /zpA <nick/ID> <czas> <jednostka: m/h/d/w> <pow?d>" , plr )
return
end
local target = exports [ "ogrpg-core" ]: findPlayer ( plr , cel )
if not target then
outputChatBox ( "Nie znaleziono podanego gracza." , plr , 255 , 0 , 0 )
return
end
local query = string . format ( "SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1" , "A" , getPlayerSerial ( target ))
local result = exports [ "ogrpg-db" ]: pobierzWyniki ( query )
if ( result ) then
return exports [ "1" ]: outputNotificationBox ( plr , "#cc0000Gracz Posiada zawieszone prawo jazdy do #00cccc" .. result [ "time" ].. ", #cc0000za: #00cccc" .. result [ "reason" ])
else
exports [ "ogrpg-db" ]: dbSet ( "DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?" , "A" , getPlayerSerial ( plr ))
end
if isPedInVehicle ( target ) then
removePedFromVehicle ( target )
end
if tonumber ( time ) <= 0 then return end
local result = "DATE()"
if rodzaj == "m" then
result = string . format ( 'DATE_ADD(NOW(), INTERVAL %d MINUTE)' , time )
elseif rodzaj == "h" then
result = string . format ( 'DATE_ADD(NOW(), INTERVAL %d HOUR)' , time )
elseif rodzaj == "d" then
result = string . format ( 'DATE_ADD(NOW(), INTERVAL %d DAY)' , time )
elseif rodzaj == "w" then
result = string . format ( 'DATE_ADD(NOW(), INTERVAL %d WEEK)' , time )
end
reason = reason .. " |od " .. getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ).. "|"
triggerClientEvent ( root , "admin:rendering" , root , "* " .. getPlayerName ( target ): gsub ( "#%x%x%x%x%x%x" , "" ).. "(" .. getElementData ( target , "id" ).. ") otrzyma?(a) zakaz prowadzenia pojazd?w (kat. A) " .. reason .. "(" .. time .. rodzaj .. ")" )
local query = string . format ( "INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES ('%s','%s',%s,'%s')" , getPlayerSerial ( target ), reason , result , "A" )
exports [ "ogrpg-db" ]: dbSet ( query )
triggerEvent ( "save:player" , root , target )
end
end )
addCommandHandler ( "zpB" , function( plr , cmd , cel , time , rodzaj ,...)
if getAdmin ( plr , 4 ) or getAdmin ( plr , 3 ) or getAdmin ( plr , 2 ) or getAdmin ( plr , 1 ) then
local reason = table . concat ({...}, " " )
if not cel or not tonumber ( time ) or not rodzaj or not reason then
outputChatBox ( "U?ycie: /zpB <nick/ID> <czas> <jednostka: m/h/d/w> <pow?d>" , plr )
return
end
local target = exports [ "ogrpg-core" ]: findPlayer ( plr , cel )
if not target then
outputChatBox ( "Nie znaleziono podanego gracza." , plr , 255 , 0 , 0 )
return
end
local query = string . format ( "SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1" , "B" , getPlayerSerial ( target ))
local result = exports [ "ogrpg-db" ]: pobierzWyniki ( query )
if ( result ) then
return exports [ "1" ]: outputNotificationBox ( plr , "#cc0000Gracz Posiada zawieszone prawo jazdy do #00cccc" .. result [ "time" ].. ", #cc0000za: #00cccc" .. result [ "reason" ])
else
exports [ "ogrpg-db" ]: dbSet ( "DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?" , "B" , getPlayerSerial ( plr ))
end
if isPedInVehicle ( target ) then
removePedFromVehicle ( target )
end
if tonumber ( time ) <= 0 then return end
local result = "DATE()"
if rodzaj == "m" then
result = string . format ( 'DATE_ADD(NOW(), INTERVAL %d MINUTE)' , time )
elseif rodzaj == "h" then
result = string . format ( 'DATE_ADD(NOW(), INTERVAL %d HOUR)' , time )
elseif rodzaj == "d" then
result = string . format ( 'DATE_ADD(NOW(), INTERVAL %d DAY)' , time )
elseif rodzaj == "w" then
result = string . format ( 'DATE_ADD(NOW(), INTERVAL %d WEEK)' , time )
end
reason = reason .. " |od " .. getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ).. "|"
triggerClientEvent ( root , "admin:rendering" , root , "* " .. getPlayerName ( target ): gsub ( "#%x%x%x%x%x%x" , "" ).. "(" .. getElementData ( target , "id" ).. ") otrzyma?(a) zakaz prowadzenia pojazd?w (kat. B) " .. reason .. "(" .. time .. rodzaj .. ")" )
local query = string . format ( "INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES ('%s','%s',%s,'%s')" , getPlayerSerial ( target ), reason , result , "B" )
exports [ "ogrpg-db" ]: dbSet ( query )
triggerEvent ( "save:player" , root , target )
end
end )
addCommandHandler ( "zpC" , function( plr , cmd , cel , time , rodzaj ,...)
if getAdmin ( plr , 4 ) or getAdmin ( plr , 3 ) or getAdmin ( plr , 2 ) or getAdmin ( plr , 1 ) then
local reason = table . concat ({...}, " " )
if not cel or not tonumber ( time ) or not rodzaj or not reason then
outputChatBox ( "U?ycie: /zpC <nick/ID> <czas> <jednostka: m/h/d/w> <pow?d>" , plr )
return
end
local target = exports [ "ogrpg-core" ]: findPlayer ( plr , cel )
if not target then
outputChatBox ( "Nie znaleziono podanego gracza." , plr , 255 , 0 , 0 )
return
end
local query = string . format ( "SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1" , "C" , getPlayerSerial ( target ))
local result = exports [ "ogrpg-db" ]: pobierzWyniki ( query )
if ( result ) then
return exports [ "1" ]: outputNotificationBox ( plr , "#cc0000Gracz Posiada zawieszone prawo jazdy do #00cccc" .. result [ "time" ].. ", #cc0000za: #00cccc" .. result [ "reason" ])
else
exports [ "ogrpg-db" ]: dbSet ( "DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?" , "C" , getPlayerSerial ( plr ))
end
if isPedInVehicle ( target ) then
removePedFromVehicle ( target )
end
if tonumber ( time ) <= 0 then return end
local result = "DATE()"
if rodzaj == "m" then
result = string . format ( 'DATE_ADD(NOW(), INTERVAL %d MINUTE)' , time )
elseif rodzaj == "h" then
result = string . format ( 'DATE_ADD(NOW(), INTERVAL %d HOUR)' , time )
elseif rodzaj == "d" then
result = string . format ( 'DATE_ADD(NOW(), INTERVAL %d DAY)' , time )
elseif rodzaj == "w" then
result = string . format ( 'DATE_ADD(NOW(), INTERVAL %d WEEK)' , time )
end
reason = reason .. " |od " .. getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ).. "|"
triggerClientEvent ( root , "admin:rendering" , root , "* " .. getPlayerName ( target ): gsub ( "#%x%x%x%x%x%x" , "" ).. "(" .. getElementData ( target , "id" ).. ") otrzyma?(a) zakaz prowadzenia pojazd?w (kat. C) " .. reason .. "(" .. time .. rodzaj .. ")" )
local query = string . format ( "INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES ('%s','%s',%s,'%s')" , getPlayerSerial ( target ), reason , result , "C" )
exports [ "ogrpg-db" ]: dbSet ( query )
triggerEvent ( "save:player" , root , target )
end
end )
Ostatnio zmieniony przez _Haze 2017-11-25, 14:11, w całości zmieniany 1 raz