SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 28/03/2012, 09:55 PM   #1
Dokins
High-roller
 
Dokins's Avatar
 
Join Date: Jun 2010
Posts: 1,049
Reputation: 20
Default Temp Ban, not returning correct time.

Hello, the server, I know is + 1 GMT. Alright? My time is GMT 00:00. But I banned myself from the server for 2 hours, at 22:45 and it says. I'll be un banned at 11:45? Although I clearly wrote 2 hours. Could it be that the clocks just went forward in this country?

command is here:

pawn Code:
CMD:tban(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");

    new reason[128], giveplayerid, string[256],hours1,days;
    if(AdminLevel[playerid] < 1) return SendClientMessage(playerid, COLOUR_GREY, "You are not authorized to use this command.");
    if(sscanf(params, "uD(0)D(0)s[128]", giveplayerid,hours1,days, reason)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /tban [player id] [hours] [days] [reason]");
    if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOUR_GREY, "That player is not connected.");
    if(days < 0 || days > 7) return SendClientMessage(playerid, COLOUR_GREY, "Day's must be between 1 and 10.");
    if(hours1 < 0 || hours1 > 23) return SendClientMessage(playerid, COLOUR_GREY, "Hour's must be between 1 and 23.");
    if(hours1 >= 1 && days >= 1) return SendClientMessage(playerid, COLOUR_GREY, "You can only select either Hours OR Days - Not both.");

    PlayerSQLID[giveplayerid] = MySQL_GetValue(PlayerSQLID[giveplayerid], "id", "accounts");
    if(days > 0)
    {

        BanTime[giveplayerid]= Time[giveplayerid] + 86400 * days;
        MySQL_SetInteger(PlayerSQLID[giveplayerid], "BanTime" , BanTime[giveplayerid], "accounts");
        format(string, sizeof(string), "Admin %s Banned %s until %s - %d Day(s) [Reason: %s]", GetNameEx(playerid), GetNameEx(giveplayerid),date(BanTime[giveplayerid],4), days, reason);
        SendClientMessageToAll(COLOUR_REALRED, string);
        format(string,sizeof(string), "You have been {FF0000}BANNED{FFFFFF} from Bone County Roleplay until {FF0000}%s", date(BanTime[giveplayerid],4));
        SendClientMessage(giveplayerid, COLOUR_WHITE, string);
        format(string, sizeof(string),"Reason: {FF0000}%s", reason);
        SendClientMessage(giveplayerid, COLOUR_WHITE, string);
        SendClientMessage(giveplayerid, COLOUR_REALRED, "{FFFFFF}PLEASE DO {FF0000}NOT{FFFFFF} POST A {FF0000}BAN APPEAL {FFFFFF}as this is a Temporary Ban.");
    }
    if(hours1 > 0)
    {
        BanTime[giveplayerid]= Time[giveplayerid] + 3600 * hours1;
        MySQL_SetInteger(PlayerSQLID[giveplayerid], "BanTime" , BanTime[giveplayerid], "accounts");
        format(string, sizeof(string), "Admin %s Banned %s for %d Hour(s) [Reason: %s]", GetNameEx(playerid), GetNameEx(giveplayerid), hours1, reason);
        SendClientMessageToAll(COLOUR_REALRED, string);
        format(string,sizeof(string), "You have been {FF0000}BANNED{FFFFFF} from Bone County Roleplay for {FF0000}%d{FFFFFF} Hours.", hours1);
        SendClientMessage(giveplayerid, COLOUR_WHITE, string);
        format(string, sizeof(string),"Reason: {FF0000}%s", reason);
        SendClientMessage(giveplayerid, COLOUR_WHITE, string);
        SendClientMessage(giveplayerid, COLOUR_REALRED, "{FFFFFF}PLEASE DO {FF0000}NOT{FFFFFF} POST A {FF0000}BAN APPEAL {FFFFFF}as this is a Temporary Ban.");
    }
    MySQL_SetInteger(PlayerSQLID[giveplayerid], "Banned" , 1, "accounts");

    Kick(giveplayerid);
    return 1;
}
Dokins is offline   Reply With Quote
Old 29/03/2012, 01:11 AM   #2
Tigerkiller
Gangsta
 
Tigerkiller's Avatar
 
Join Date: May 2010
Posts: 757
Reputation: 25
Default AW: Temp Ban, not returning correct time.

hmm use gettime(); and mktime function

this will use the time of the server and not from yours!
Tigerkiller is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help | Temp Ban . TeRmi[N]aTor Help Archive 1 28/07/2011 02:32 PM
[MAKE] Temp ban and Temp mute. Larsey123IsMe Help Archive 12 20/02/2011 03:43 AM
GetVehicleHealth isn't returning the correct value Miguel Bug Reports 10 07/02/2011 12:06 PM
Timer not starting at correct time everytime? (.Aztec); Help Archive 0 16/08/2010 08:35 PM
Reaction Test dont tells the correct Response Time! [WSM]Deadly_Evil Help Archive 4 18/06/2010 10:56 AM


All times are GMT. The time now is 09:30 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.