Make a "Disconnected" troll
#6

Quote:
Originally Posted by Wizzard2H
Посмотреть сообщение
Код:
 //top of script
 #include <a_samp>
 #include <zcmd>
 #include <sscanf>
new Mute[MAX_PLAYERS];

CMD:fakekick(playerid, params[])
{
        new ID, targetid;
        if (sscanf(params, "us[90]", ID)) return SendClientMessage(playerid, 0x1F36E0FF, "USAGE: /fakekick [Playerid/Name]");
        if (!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xF50A0AFF, "NOTICE: Player not found.");
        new string[128];
        format(string,sizeof(string),"%s has been kicked by %s for ****** Hacks", PlayerName(ID), PlayerName(playerid));
        SendClientMessageToAll(0xAA3333AA, string);
        SendClientMessage(ID, 0xAA3333AA, "Server closed the connection.");
        SendDeathMessage(INVALID_PLAYER_ID, playerid, 201);
        SetPlayerVirtualWorld(playerid, 2);
        Mute[targetid] =  1;
        return 1;
        }
public OnPlayerText(playerid, text[])
{
                if(Mute[playerid] >= 1)
	{
		return 0;
	}
    return 1;
}
PlayerName(playerid)
{
	new CName[24];
	GetPlayerName(playerid, CName, 24);
 	return CName;
}
Haven't tested the code because wrote in 2 mins but should work.
You shouldn't post code written under 2 minutes and untested:

You're not using targetid:
PHP код:
new IDtargetid
What is the 's' specifier doing there? How did you even get to 90 cells for it?
PHP код:
if (sscanf(params"us[90]"ID)) 
You don't need 128 cells for that string. The maximum size of the formatted string is 85 characters.
PHP код:
new string[128]; 
This shouldn't be inside cmd_fakekick:
PHP код:
OnPlayerText(playeridtext[])
{
                if(
Mute[playerid] >= 1)
    {
        return 
0
    } 
For the sake of convenience (while it doesn't matter), you could declare mute as a boolean variable:
PHP код:
new bool:Mute[playerid
And then use it as so:
PHP код:
Mute[playerid] = true
PHP код:
Mute[playerid] = false
From true to false and false to true:
PHP код:
Mute[playerid] = !Mute[playerid]; 
PHP код:
if(Mute[playerid]) // Player is muted 
PHP код:
if(!Mute[playerid]) // Player is not muted 
Reply


Messages In This Thread
Make a "Disconnected" troll - by BurnZ - 04.04.2016, 13:03
Re: Make a "Disconnected" troll - by AndySedeyn - 04.04.2016, 13:06
Re: Make a "Disconnected" troll - by BurnZ - 04.04.2016, 13:09
Re: Make a "Disconnected" troll - by Crystallize - 04.04.2016, 13:14
Re: Make a "Disconnected" troll - by Harty - 04.04.2016, 13:17
Re: Make a "Disconnected" troll - by AndySedeyn - 04.04.2016, 13:23
Re: Make a "Disconnected" troll - by Crystallize - 04.04.2016, 13:28
Re: Make a "Disconnected" troll - by AndySedeyn - 04.04.2016, 13:34

Forum Jump:


Users browsing this thread: 1 Guest(s)