[POMOC]Ban...

Započeo [GP]Brain, Jul 01, 2013, 14:09:22 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.

Skripta koju koristim: geforce
Detaljan opis problema: Jel moze komanda u strcmp za ban account samo acc ono CreateBanFile tako nesto jer imam vec komandu /ban bana acc i ip a acc doda u scriptfiles/Banovi  i komandu imam /banip samo za ip sad bi tio komandu samo za acc ban
Dio skripte: /
Neke slike/video za lakse dobivanje pomoci(neobavezno): /
public OnPlayerConnect(playerid)
{
Ban(playerid);
return 1;
}



Valjda ovo trazis if(strcmp(cmd, "/ban", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
    tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 2)
{
    if(IsPlayerConnected(giveplayerid))
    {
        if(giveplayerid != INVALID_PLAYER_ID)
        {
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [id igraca/deo nicka] [razlog]");
return 1;
}
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s je iskljucen od Admina %s zbog sledeceg razloga: %s (datum: %d-%d-%d)", giveplayer, sendername, (result),month,day,year);
BanLog(string);
format(string, sizeof(string), "AdmCmd: %s je iskljucen od Admina %s, zbog sledeceg razloga: %s", giveplayer, sendername, (result));
SendClientMessageToAll(COLOR_LIGHTRED, string);
PlayerInfo[giveplayerid][pAdmin] = PlayerInfo[giveplayerid][pLevel];
PlayerInfo[giveplayerid][pLevel] = -999;
Ban(giveplayerid);
return 1;
}
}//not connected
}
else
{
format(string, sizeof(string), "   Igrac %d nije aktivan.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
Edit: Predlazem ti da radis komande u zcmd ili yini jel ti je strcmp proces komandi mnogo spor :)
Poslednja Izmena: Jul 01, 2013, 14:32:22 POSLE PODNE od |RCG| Boca A.k.A Bocilinjo

Imam komandu /BANIP za banat ip i komandu /BAN za banat IP I ACCOUNT  trebam komandu npr /banacc za banat SAMO ACCOUNT da ip ostane netaknut ti si mi dao za ip banovat znaci kad /banacc da mu napravi ono sranje u scriptfiles/Banovi da mu tu doda ime acc-a i da  je acc banovan evo ti komanda /ban za acc i ip:
if(strcmp(cmd, "/ban", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
    tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "KORISTENJE: /ban [Playerid/DioImena] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 2)
{
    if(IsPlayerConnected(giveplayerid))
    {
        if(giveplayerid != INVALID_PLAYER_ID)
        {
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "KORISTENJE: /ban [Playerid/DioImena] [reason]");
return 1;
}
if (!GetPVarInt(giveplayerid, "gPlayerLogged"))
{
    SendClientMessage(playerid, COLOR_RED, "Taj igrac nije logiran.");
return 1;
}
                        new playersip[128];
new year, month, day;
new hours, minutes, seconds;
GetPlayerIp(giveplayerid,playersip,sizeof(playersip));
getdate(year, month, day);
gettime(hours, minutes, seconds);
ServerInfo[sBans]++;
format(string, sizeof(string), "[GP:RPG]: %s [IP: %s] je dobio ban od admina %s.  Razlog: %s (%d-%d-%d)", giveplayer, playersip, sendername, (result),day,month,year);
BanLog(string);
format(string, sizeof(string), "[GP:RPG]: %s je dobio ban od admina %s.  Razlog: %s", giveplayer, sendername, (result));
SendClientMessageToAll(COLOR_LIGHTRED, string);
                        ClearChatBox(giveplayerid);
                        SendClientMessage(giveplayerid, COLOR_RED,"[GP:RPG]: Dobili ste ban.");
                        SendClientMessage(giveplayerid, COLOR_RED,"[GP:RPG]: Vas Account i Vasa IP adresa su banovani.");
                        format(string, sizeof(string), " - Admin: %s", sendername);
                        SendClientMessage(giveplayerid, COLOR_WHITE, string);
                        format(string, sizeof(string), " - Razlog: %s", (result));
                        SendClientMessage(giveplayerid, COLOR_WHITE, string);
            format(string, sizeof(string), " - Vasa IP adresa: %s", playersip);
                SendClientMessage(giveplayerid, COLOR_WHITE, string);
            format(string, sizeof(string), " - Datum: %d/%d/%d | %d:%d:%d", day,month,year,hours,minutes,seconds);
                SendClientMessage(giveplayerid, COLOR_WHITE, string);
                SendClientMessage(giveplayerid, COLOR_RED,"[GP:RPG]: Ako mislite da niste zasluzili ban molimo vas da se obratite na forum.");
                        CreateBanFile(giveplayer);
SetTimerEx("BanIgraca", 500, 0, "d", giveplayerid);
return 1;
}
}
}
else
SendClientMessage(playerid, COLOR_RED, "Taj igrac nije online!");
}
return 1;
}

to je ovo CreateBanFile(giveplayer); ja msm i tako
public OnPlayerConnect(playerid)
{
Ban(playerid);
return 1;
}



if(strcmp(cmdtext, "/ban", true) == 0)
{
if(!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, 0xFF0000FF, "Nisi admin.");
return 1;
}

new idplayer,
razlog[256],
banovanod[MAX_PLAYER_NAME],
banovan[MAX_PLAYER_NAME],
forplayersban[256],
savetofilestr[256],
godina,
mjesec,
dan,
sat,
minuta,
sekunda,
banip[16];

if(sscanf(cmdtext, "ds", idplayer, razlog))
{
SendClientMessage(playerid, 0xFF0000FF, "Koristi: /ban id razlog");
return 1;
}
if(!IsPlayerConnected(idplayer))
{
SendClientMessage(playerid, 0xFF0000FF, "Invalid ID");
return 1;
}
GetPlayerName(playerid, banovanod, sizeof(banovanod));
GetPlayerName(idplayer, banovan, sizeof(banovan));
GetPlayerIp(idplayer, banip, sizeof(banip));
format(forplayersban, sizeof(forplayersban), "%s (%d)je banovan od %s. razlog: %s.", banovan, idplayer, banovanod, razlog);
SendClientMessageToAll(0xFF0000FF, forplayersban);
baningpe = fopen("ban.log", io_append);
getdate(godina, mjesec, dan);
gettime(sat, minuta, sekunda);
format(savetofilestr, sizeof(savetofilestr), "[%02d:%02d:%02d | %02d/%02d/%d] %s IP: %s\n",sat, minuta, sekunda, dan, mjesec, godina, forplayersban, banip);
fwrite(baningpe, savetofilestr);
fclose(baningpe);
return 1;
}
Poslednja Izmena: Jul 01, 2013, 15:27:40 POSLE PODNE od C++
69