29.01.2014, 10:19
I have this code in Ban/Functions.inc.
This in Ban/Defines.inc.
This in Ban/Variables.inc.
This in Query.inc.
This in Message.inc.
And when i try to compile gamemode pawno stop working.
Код:
stock BanBannedNameGet(P)
{
return BanBannedName[P];
}
stock BanBannedNameSet(P,BannedNameBan[])
{
format(BanBannedName[P],BanBannedNameMaximal,BannedNameBan);
return BanBannedName[P];
}
stock BanBannedIpGet(P)
{
return BanBannedIp[P];
}
stock BanBannedIpSet(P,BannedIpBan[])
{
format(BanBannedIp[P],BanBannedIpMaximal,BannedIpBan);
return BanBannedIp[P];
}
stock BanBannerNameGet(P)
{
return BanBannerName[P];
}
stock BanBannerNameSet(P,BannerNameBan[])
{
format(BanBannerName[P],BanBannerNameMaximal,BannerNameBan);
return BanBannerName[P];
}
stock BanTimeGet(P)
{
return BanTime[P];
}
stock BanTimeSet(P,TimeBan)
{
BanTime[P] = TimeBan;
if(BanTime[P] < BanTimeMinimal)
{
BanTime[P] = BanTimeMinimal;
}
if(BanTime[P] > BanTimeMaximal)
{
BanTime[P] = BanTimeMaximal;
}
return BanTime[P];
}
stock BanTimeGive(P,TimeBan)
{
BanTime[P] += TimeBan;
if(BanTime[P] < BanTimeMinimal)
{
BanTime[P] = BanTimeMinimal;
}
if(BanTime[P] > BanTimeMaximal)
{
BanTime[P] = BanTimeMaximal;
}
return BanTime[P];
}
stock BanReasonGet(P)
{
return BanReason[P];
}
stock BanReasonSet(P,ReasonBan[])
{
format(BanReason[P],BanReasonMaximal,ReasonBan);
return BanReason[P];
}
stock BanDateImpositionGet(P)
{
return BanDateImposition[P];
}
stock BanDateImpositionSet(P,DateImpositionBan[])
{
format(BanDateImposition[P],BanDateImpositionMaximal,DateImpositionBan);
return BanDateImposition[P];
}
stock BanPlayerById(IdBanned,IdBanner,TimeBan,ReasonBan[])
{
new Year;
new Month;
new Day;
getdate(Year,Month,Day);
new Hour;
new Minute;
new Second;
gettime(Hour,Minute,Second);
format(ServerString,ServerStringMaximal,BanMessageOne,Day,Month,Year,Hour,Minute,Second);
if(IsPlayerConnected(IdBanner))
{
format(ServerString,ServerStringMaximal,BanQueryOne,PlayerNameGet(IdBanned),PlayerIpGet(IdBanned),PlayerNameGet(IdBanner),TimeBan * 24 * 60 * 60 + gettime(),ReasonBan,ServerString);
mysql_query(ServerString);
if(PlayerGenderGet(IdBanned) == PlayerGenderMinimal)
{
format(ServerString,ServerStringMaximal,BanMessageTwo,PlayerRangGet(IdBanned),PlayerNameGet(IdBanned),IdBanned,PlayerRangGet(IdBanner),PlayerNameGet(IdBanner),IdBanner,TimeBan,ReasonBan);
}
if(PlayerGenderGet(IdBanned) == PlayerGenderMaximal)
{
format(ServerString,ServerStringMaximal,BanMessageThree,PlayerRangGet(IdBanned),PlayerNameGet(IdBanned),IdBanned,PlayerRangGet(IdBanner),PlayerNameGet(IdBanner),IdBanner,TimeBan,ReasonBan);
}
}
if(!IsPlayerConnected(IdBanner))
{
format(ServerString,ServerStringMaximal,BanQueryTwo,PlayerNameGet(IdBanned),PlayerIpGet(IdBanned),TimeBan * 24 * 60 * 60 + gettime(),ReasonBan,ServerString);
mysql_query(ServerString);
if(PlayerGenderGet(IdBanned) == PlayerGenderMinimal)
{
format(ServerString,ServerStringMaximal,BanMessageFour,PlayerRangGet(IdBanned),PlayerNameGet(IdBanned),IdBanned,TimeBan,ReasonBan);
}
if(PlayerGenderGet(IdBanned) == PlayerGenderMaximal)
{
format(ServerString,ServerStringMaximal,BanMessageFive,PlayerRangGet(IdBanned),PlayerNameGet(IdBanned),IdBanned,TimeBan,ReasonBan);
}
}
SendClientMessageToAll(ColorWhite,ServerString);
PlayerBanTimer[IdBanned] = SetTimerEx("BanPlayer",1000,0,"i",IdBanned);
return 1;
}
stock BanPlayerByName(NameBan[],IdBanner,TimeBan,ReasonBan[])
{
new Year;
new Month;
new Day;
getdate(Year,Month,Day);
new Hour;
new Minute;
new Second;
gettime(Hour,Minute,Second);
format(ServerString,ServerStringMaximal,BanMessageOne,Day,Month,Year,Hour,Minute,Second);
if(IsPlayerConnected(IdBanner))
{
format(ServerString,ServerStringMaximal,BanQueryThree,NameBan,PlayerNameGet(IdBanner),TimeBan * 24 * 60 * 60 + gettime(),ReasonBan,ServerString);
mysql_query(ServerString);
format(ServerString,ServerStringMaximal,BanMessageSix,NameBan,PlayerRangGet(IdBanner),PlayerNameGet(IdBanner),IdBanner,TimeBan,ReasonBan);
}
if(!IsPlayerConnected(IdBanner))
{
format(ServerString,ServerStringMaximal,BanQueryFour,NameBan,TimeBan * 24 * 60 * 60 + gettime(),ReasonBan,ServerString);
mysql_query(ServerString);
format(ServerString,ServerStringMaximal,BanMessageSeven,NameBan,TimeBan,ReasonBan);
}
SendClientMessageToAll(ColorWhite,ServerString);
return 1;
}
stock BanPlayerByIp(IpBan[],IdBanner,TimeBan,ReasonBan[])
{
new Year;
new Month;
new Day;
getdate(Year,Month,Day);
new Hour;
new Minute;
new Second;
gettime(Hour,Minute,Second);
format(ServerString,ServerStringMaximal,BanMessageOne,Day,Month,Year,Hour,Minute,Second);
if(IsPlayerConnected(IdBanner))
{
format(ServerString,ServerStringMaximal,BanQueryFive,IpBan,PlayerNameGet(IdBanner),TimeBan * 24 * 60 * 60 + gettime(),ReasonBan,ServerString);
mysql_query(ServerString);
format(ServerString,ServerStringMaximal,BanMessageEight,IpBan,PlayerRangGet(IdBanner),PlayerNameGet(IdBanner),IdBanner,TimeBan,ReasonBan);
}
if(!IsPlayerConnected(IdBanner))
{
format(ServerString,ServerStringMaximal,BanQuerySix,IpBan,TimeBan * 24 * 60 * 60 + gettime(),ReasonBan,ServerString);
mysql_query(ServerString);
format(ServerString,ServerStringMaximal,BanMessageNine,IpBan,TimeBan,ReasonBan);
}
SendClientMessageToAll(ColorWhite,ServerString);
return 1;
}
stock BanUnByName(NameUnBan[],IdUnBanner)
{
format(ServerString,ServerStringMaximal,BanQuerySeven,NameUnBan);
mysql_query(ServerString);
if(IsPlayerConnected(IdUnBanner))
{
format(ServerString,ServerStringMaximal,BanMessageTen,NameUnBan,PlayerRangGet(IdUnBanner),PlayerNameGet(IdUnBanner),IdUnBanner);
}
if(!IsPlayerConnected(IdUnBanner))
{
format(ServerString,ServerStringMaximal,BanMessageEleven,NameUnBan);
}
SendClientMessageToAll(ColorWhite,ServerString);
return 1;
}
stock BanUnByIp(IpUnBan[],IdUnBanner)
{
format(ServerString,ServerStringMaximal,BanQueryEight,IpUnBan);
mysql_query(ServerString);
if(IsPlayerConnected(IdUnBanner))
{
format(ServerString,ServerStringMaximal,BanMessageTwelve,IpUnBan,PlayerRangGet(IdUnBanner),PlayerNameGet(IdUnBanner),IdUnBanner);
}
if(!IsPlayerConnected(IdUnBanner))
{
format(ServerString,ServerStringMaximal,BanMessageThirTeen,IpUnBan);
}
SendClientMessageToAll(ColorWhite,ServerString);
return 1;
}
Код:
#define BanBannedNameMinimal 0 #define BanBannedNameMaximal 30 #define BanBannedIpMinimal 0 #define BanBannedIpMaximal 30 #define BanBannerNameMinimal 0 #define BanBannerNameMaximal 30 #define BanTimeMinimal 0 #define BanTimeMaxiaml 9999999999 #define BanReasonMinimal 0 #define BanReasonMaximal 100 #define BanDateImpositionMinimal 0 #define BanDateImpositionMaximal 30
Код:
new BanBannedName[ServerPlayersMaximal][BanBannedNameMaximal]; new BanBannedIp[ServerPlayersMaximal][BanBannedIpMaximal]; new BanBannerName[ServerPlayersMaximal][BanBannerNameMaximal]; new BanTime[ServerPlayersMaximal]; new BanReason[ServerPlayersMaximal][BanReasonMaximal]; new BanDateImposition[ServerPlayersMaximal][BanDateImpositionMaximal];
Код:
#define BanQueryOne "INSERT INTO Bans (BannedName,BannedIp,BannerName,Time,Reason,DateRegister) VALUES ('%s','%s','%s','%d','%s','%s')"
#define BanQueryTwo "INSERT INTO Bans (BannedName,BannedIp,BannerName,Time,Reason,DateRegister) VALUES ('%s','%s','Serwer','%d','%s','%s')"
#define BanQueryThree "INSERT INTO Bans (BannedName,BannedIp,BannerName,Time,Reason,DateRegister) VALUES ('%s','Nieznany','%s','%d','%s','%s')"
#define BanQueryFour "INSERT INTO Bans (BannedName,BannedIp,BannerName,Time,Reason,DateRegister) VALUES ('%s','Nieznany','Serwer','%d','%s','%s')"
#define BanQueryFive "INSERT INTO Bans (BannedName,BannedIp,BannerName,Time,Reason,DateRegister) VALUES ('Nieznana','%s','%s','%d','%s','%s')"
#define BanQuerySix "INSERT INTO Bans (BannedName,BannedIp,BannerName,Time,Reason,DateRegister) VALUES ('Nieznana','%s','Serwer','%d','%s','%s')"
#define BanQuerySeven "DELETE FROM Bans WHERE BannedName = '%s'"
#define BanQueryEight "DELETE FROM Bans WHERE BannedIp = '%s'"
Код:
#define BanMessageOne " " #define BanMessageTwo " " #define BanMessageThree " " #define BanMessageFour " " #define BanMessageFive " " #define BanMessageSix " " #define BanMessageSeven " " #define BanMessageEight " " #define BanMessageNine " " #define BanMessageTen " " #define BanMessageEleven " " #define BanMessageTwelve " " #define BanMessageThirTeen " "
And when i try to compile gamemode pawno stop working.
Код:
#include <a_samp>
#include <a_mysql>
#include <sscanf2>
#include <streamer>
#include <Color>
#include <Message>
#include <Query>
#include <Ban/Defines>
#include <Ban/Variables>
#include <Ban/Functions>
public OnPlayerConnect(playerid)
{
BanPlayerById(playerid,-1,7,"Test");
BanPlayerByName("Ranshand",-1,7,"Test");
BanPlayerByIp("127.0.0.1",-1,7,"Test");
BanUnByName("Ranshand",-1);
BanUnByIp("127.0.0.1",-1);
return 1;
}

