08.08.2014, 17:31
Hello
i have problem , when i want ban players [ for days]
i write ,EX; /banex [ID :27] [ days : 3 ] [reason : test ] , is sendToclientmessageToall , another reason
Screen : 1. http://imgur.com/ngxAqZi | 2. http://imgur.com/jaScgCo
when i ban Permanent not for days normal work [ cmd :/ban ]
pwn
This KickPublic
i have problem , when i want ban players [ for days]
i write ,EX; /banex [ID :27] [ days : 3 ] [reason : test ] , is sendToclientmessageToall , another reason
Screen : 1. http://imgur.com/ngxAqZi | 2. http://imgur.com/jaScgCo
when i ban Permanent not for days normal work [ cmd :/ban ]
pwn
pawn Код:
CMD:banex(playerid,params[])
{
new name[MAX_PLAYER_NAME],id,reason,days,giveplayer[MAX_PLAYER_NAME],string[256];
if(playerVariables[playerid][pAdminLevel] >= 1)
{
if (sscanf(params, "uis[30]",id,days,reason))
{
SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/banex [playerid] [days(max 14)] [reason]");
return 1;
}
GetPlayerName(playerid, name, sizeof name);
GetPlayerName(id, giveplayer, sizeof(giveplayer));
if(playerVariables[id][pAdminLevel] >= 1) return SendClientMessage(playerid, COLOR_ASKQ, "* Nu poti da ban la un admin!");
new File:tempban = fopen("TempBans.ban", io_append);
if(tempban)
{
new year,month,day;
getdate(year, month, day);
day += days;
if (IsMonth31(month))
{
if (day > 31)
{
month += 1;
if (month > 12)
{
year += 1;
while(day > 31) day -= 31;
}
else while(day > 31) day -= 31;
}
}
else if (!IsMonth31(month))
{
if (day > 30)
{
month += 1;
if (month > 12)
{
year += 1;
while(day > 30) day -= 30;
}
else while(day > 30) day -= 30;
}
}
else if (!IsMonth31(month) && IsMonth29(year) && month == 2)
{
if (day > 29)
{
month += 1;
if (month > 12)
{
year += 1;
while(day > 29) day -= 29;
}
else while(day > 29) day -= 29;
}
}
else if (!IsMonth31(month) && !IsMonth29(year) && month == 2)
{
if (day > 28)
{
month += 1;
if (month > 12)
{
year += 1;
while(day > 28) day -= 28;
}
else while(day > 28) day -= 28;
}
}
format(string, sizeof string, "%d|%d|%d|%s\n", day, month, year, giveplayer);
fwrite(tempban, string);
fclose(tempban);
}
format(string, sizeof(string), "AdmCmd: %s was banned by Admin %s, for %d day(s), reason: %s",giveplayer, name, days, reason);
SendClientMessageToAll(COLOR_LIGHTRED, string);
SetTimerEx("KickPublic", 1000, 0, "d", id);
}
else return SendClientMessage(playerid,COLOR_WHITE,"You are not authorized to use that command");
return true;
}
stock IsMonth31(month)
{
switch (month)
{
case 1: return 1;
case 3: return 1;
case 5: return 1;
case 7: return 1;
case 8: return 1;
case 10: return 1;
case 12: return 1;
default: return 0;
}
return 0;
}
stock IsMonth29(year)
{
new y = 2000;
for(new i = 4; i < 3000; i += 4) if ((y+i) == year) return 1;
return 0;
}
pawn Код:
forward KickPublic(playerid);
public KickPublic(playerid) { Kick(playerid); }
new Text3D:vehicle3Dtext;
new
databaseConnection,
pingTick,
adTick,
vehCount,
weatherVariables[2],
gTime[3],
iGMXTimer,
iTarget,
iGMXTick,
szMediumString[64],
systemVariables[systemE],
houseVariables[MAX_HOUSES][houseE],
Text:textdrawVariables[MAX_TEXTDRAWS],
jobVariables[MAX_JOBS][jobsE],
AdminSpawnedVehicles[MAX_VEHICLES],
assetVariables[MAX_ASSETS][assetsE],
szQueryOutput[256],
szMessage[256],
szSmallString[32],
atmVariables[MAX_ATMS][atmE],
result[256],
szServerWebsite[32],
szLargeString[1024],
szPlayerName[MAX_PLAYER_NAME],
businessVariables[MAX_BUSINESSES][businessE],
vehicleVariables[MAX_VEHICLES][vehicleE],
groupVariables[MAX_GROUPS][groupE],
businessItems[MAX_BUSINESS_ITEMS][businessItemsE],
playerVariables[MAX_PLAYERS][playervEnum],
spikeVariables[MAX_SPIKES][spikeE],
scriptTimers[MAX_TIMERS];