[SNIPPET] Warning System

Started by Mohamed Boubekri, Feb 01, 2018, 12:34 PM

Previous topic - Next topic

Mohamed Boubekri

Hello, I Have Made Warning System, So i Love Share it With All! ;D
First Of All Add it In Your ( OnScriptLoad )
warn <- ConnectSQL("scripts/warn.db");
QuerySQL(warn, "create table if not exists warn ( Name VARCHAR(32), Reason TEXT, Admin TEXT, Day VARCHAR(25), Month VARCHAR(25), Year VARCHAR(25), Hour VARCHAR(25), Min VARCHAR(25) )");
Now Add it In Your ( Command )
else if ( cmd == "warn" )
{
if(!text) MessagePlayer("/warn <Player> <Reason>",player);
// else if Your Admin System
else {
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) MessagePlayer( "Error: Unknow Player.", player );
{
local reason = GetTok( text, " ", 2 NumTok( text, " " ) );
if ( !reason ) MessagePlayer( "Error: Make Reason.", player );
else if ( plr.Name==player.Name ) MessagePlayer( "Error: You Can't Warn yourself.", player );
else {
local now = date();
QuerySQL( warn, "INSERT INTO warn ( Name, Reason, Admin, Day, Month, Year, Hour, Min ) VALUES ( '" + plr.Name + "', '" + reason + "', '" + player.Name + "', '" + now.day + "', '" + now.month + "', '" + now.year + "', '" + now.hour + "', '" + now.min + "' )" );
Message("Admin "+ player.Name +" Has Warned " +plr.Name+ " Reason: " +reason+ "");
}
}
}
}
else if ( cmd == "unwarn" )
{
local q = QuerySQL( warn,  "SELECT * FROM warn WHERE Name='" + text + "'" );
if(!text) MessagePlayer("/unwarn <Full-Nick>",player);
// else if Your Admin System
else if ( GetSQLColumnData( q, 0 ) != text ) MessagePlayer( "Error: " + text + " is not Warned.", player );
else {
QuerySQL( warn, "DELETE FROM warn WHERE Name='" + text + "'" );
Message("Admin "+ player.Name +" Has Unwarned " +text+ "");
}
}
else if ( cmd == "checkwarn" )
{
if(!text) MessagePlayer("/checkwarn <Full-Nick>",player);
// else if Your Admin System
else {
local q = QuerySQL( warn,  "SELECT * FROM warn WHERE Name='" + text + "'" );
if ( GetSQLColumnData( q, 0 ) != text ) MessagePlayer( "Error: " + text + " is not Warned.", player );
else
{
MessagePlayer( "Player Name Found!", player );
MessagePlayer( "Player : " + text, player );
MessagePlayer( "Warned by : " + GetSQLColumnData( q, 2 ), player );
MessagePlayer( "Reason : " + GetSQLColumnData( q, 1 ), player );
MessagePlayer( "Time Warned: Day: " + GetSQLColumnData( q, 3 ) + " Month: " + GetSQLColumnData( q, 6 ) + " Year: " + GetSQLColumnData( q, 5 ) + " Hour: " + GetSQLColumnData( q, 6 ) + " Min: " + GetSQLColumnData( q, 7 ) + "", player );
}
}
}
NOTE: Command is: /warn, /unwarn, /checkwarn.
NOTE: The System its Sample :D
NOTE: If You See Any Error, Please Report it Here.
NOTE: its Not Copie or Something, its Made By Me, Good Luck ;D
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].


Mohamed Boubekri

| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].

=RK=MarineForce

i m using Your account system..

if i type /warn marine its nothing showing any cmd where functions

umar4911

Quote from: =RK=MarineForce on Apr 24, 2018, 06:27 PMi m using Your account system..

if i type /warn marine its nothing showing any cmd where functions
hey, you are here for more than 4 months and haven't learned scripting? And to get a problem solved, dont you know that you need to be specific and give the errors that is in the console.
I am gamer, programmer and hacker. Try to find me!
xD

=RK=MarineForce

ye but i mtrying to fix it . but i can't :) okay .. i will ttry