Jump to content
  • 0

Cum se rezolva bugul de la kick si ban pe 0.3x?


EmiNEm

Question

salut, dupa cum spune si numele topicului as vrea sa rezolv si eu problema cu kick si ban.... m-am chinuit vreo 2 ore si tot nu am reusit....

va rog explicati-mi detaliat...

comanda mea de /kick:

if(strcmp(cmd, "/kick", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /kick [playerid/PartOfName] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pAgent] >= 1)
			{
				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: /kick [playerid/PartOfName] [reason]");
							return 1;
						}
						if(kicktime[playerid] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "Wait 10 seconds!");
						new year, month,day;
						getdate(year, month, day);
						format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						KickLog(string);
						format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s", giveplayer, sendername, (result));
						Kick(giveplayerid);
						return 1;
					}
				}
			}
			else
			{
				format(string, sizeof(string), "   %d nu este online.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
cica asta e rezolvarea:
//In order to display a message (eg. reason) for the player before the connection is closed you have to use a delay:

forward KickPublic(playerid);
public KickPublic(playerid) { Kick(playerid); }

stock KickWithMessage(playerid, message[])
{
    SendClientMessage(playerid, 0xFF4444FF, message);
    SetTimerEx("KickPublic", 1000, 0, "d", playerid); 	//Delay of 1 second before kicking the player so he recieves the message
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/kickme", true) == 0)
    {
        //Kicks the player who the executed this command
        KickWithMessage(playerid, "You have been kicked.");
        return 1;
    }
    return 0;
}
//by Kye

am incercat si cu asta dar nu reusesc

index.php?Name=Indecen3T
Link to comment
Share on other sites

10 answers to this question

Recommended Posts

Trebuie sa folosesti un timer:

forward KickPublic(playerid);
public KickPublic(playerid) { Kick(playerid); }

KickWithMessage(playerid, message[])
{
    SendClientMessage(playerid, 0xFF4444FF, message);
    SetTimerEx("KickPublic", 1000, 0, "d", playerid);
}

Codul de mai sus il apartine lui Kalcor, el a explicat ca Kick, cand este chemat, sterge toate pachetele(mesaje,dialoguri) trimise catre server. Cica chestia asta a fost pusa pentru motive de securitate...

Fara reclama in semnatura!

Link to comment
Share on other sites

am incercat dar nu reusesc nicicum

Amice, tu ce ai vrea mai exact ? Daca vrei sa iti apara motivul, foloseste functia BanEx.Daca vrei sa iti apara motivul "in alt mod", fa ca atunci cand jucatorul se logheaza, sa verifice daca este "banned", iar daca "banned" este pozitiv (true/1/2/3 etc.) sa ii apara un mesaj/textdraw cum ca acesta este banat, sa ii apara motivul si etc.Cred ca asta te va ajuta.

Link to comment
Share on other sites

Amice, tu ce ai vrea mai exact ? Daca vrei sa iti apara motivul, foloseste functia BanEx.Daca vrei sa iti apara motivul "in alt mod", fa ca atunci cand jucatorul se logheaza, sa verifice daca este "banned", iar daca "banned" este pozitiv (true/1/2/3 etc.) sa ii apara un mesaj/textdraw cum ca acesta este banat, sa ii apara motivul si etc.Cred ca asta te va ajuta.

Nu intelegi, nici eu am inteles din prima :))

Lui nu-i apare mesajul in chat, motivul pentru care X a luat ban xD

Fara reclama in semnatura!

Link to comment
Share on other sites

Amice, tu ce ai vrea mai exact ? Daca vrei sa iti apara motivul, foloseste functia BanEx.Daca vrei sa iti apara motivul "in alt mod", fa ca atunci cand jucatorul se logheaza, sa verifice daca este "banned", iar daca "banned" este pozitiv (true/1/2/3 etc.) sa ii apara un mesaj/textdraw cum ca acesta este banat, sa ii apara motivul si etc.Cred ca asta te va ajuta.

nu la asta ma refeream

Ba laasta te referi.

 

1859311972_BANNER-GIREADAcopy-min.thumb.png.48e5e420ae2185dce5b244965a1d2601.png

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.