[Include] Extra.inc - Kick, Ban, Mute, Freeze With Message (Hooked version) (My first include)
#1

Hello guys this is my first include and hope you like it

this is a simple include to Kick, Ban/Unban, Mute/Unmute, Freeze/Unfreeze with function

new version v2.1 fixed bugs and add SendMessage

to use this include, add the #include <Extra> in your script, exemple:

pawn Код:
#include <a_samp>
#include <Extra>
#include <core>
#include <sscanf2>
#include <float>
#include <zcmd>
//....
Function

pawn Код:
native Extra_Kick(playerid, reason[]);
native Extra_Ban(playerid, reason[]);
native Extra_UnBan(playername);
native Extra_Mute(playerid, reason[]);
native Extra_UnMute(playerid, reason[]);
native Extra_Freeze(playerid, reason[]);
native Extra_UnFreeze(playerid, reason[]);
Download

Extra.inc v2.1 Pastebin
Extra.inc Pastebin

Exemple script

pawn Код:
/****************
    Exemple script
******************/


#include <a_samp>
#include <sscanf2>
#include <zcmd>
#include <extra>

CMD:ban(playerid, params[])
{
    new id,reasontext[100];
    if(sscanf(params,"us[100]",id,reasontext)) return SendClientMessage(playerid,-1,"USAGE: /ban [playerid] [reason]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"That player is not connected to server");
    Extra_Ban(id,reasontext);
    return 1;
}
Credits:
Код:
Dracoblue
_Emmet - show me the bugs
Me (WazzUp)
Reply
#2

Wow! Is really nice!

+Rep
Reply
#3

Good Job .





reputeishon .
Reply
#4

It's largely copied from DINI. Shame on you at not giving any credits to Dracoblue and also modifying the function names.
Reply
#5

sr forgot the credit
Reply
#6

Good!

2reps
Reply
#7

Good work.
Reply
#8

It's example not exemple.
Reply
#9

pawn Код:
stock Extra_Ban(playerid, reason[])
{
        SendClientMessage(playerid,-1,reason);
        Banned[playerid] = 1;
        new file[200];
        format(file,sizeof(file),"Extra/%s.ini",GetName(playerid));
        Extra_IntSet(file,"Ban",1);
        SetTimer("KickPlayer",3000,false);
        return 1;
}
Why are you using 200 cells for something that would only need about ~35 cells?

pawn Код:
stock Extra_UnBan(playername[])
{
        new file[200]
        format(file,sizeof(file),"Extra/%s.ini",playername);
        Extra_IntSet(file,"Ban",0);
        return 1;
}
 
stock Extra_Mute(playerid, reason[])
{
        new file[200]
        format(file,sizeof(file),"Extra/%s.ini",GetName(playerid));
        Extra_IntSet(file,"Mute",1);
        Muted[playerid] = 1;
        return 1;
}
 
stock Extra_UnMute(playerid, reason[])
{
        new file[200]
        format(file,sizeof(file),"Extra/%s.ini",GetName(playerid));
        Extra_IntSet(file,"Mute",0);
        Muted[playerid] = 0;
        return 1;
}
 
stock Extra_Freeze(playerid, reason[])
{
        new file[200]
        format(file,sizeof(file),"Extra/%s.ini",GetName(playerid));
        Extra_IntSet(file,"Freeze",1);
        Freezed[playerid] = 1;
        TogglePlayerControlLabel(playerid,0);
        return 1;
}
 
stock Extra_UnFreeze(playerid, reason[])
{
        new file[200]
        format(file,sizeof(file),"Extra/%s.ini",GetName(playerid));
        Extra_IntSet(file,"Freeze",0);
        Freezed[playerid] = 0;
        TogglePlayerControlLabel(playerid,1);
        return 1;
}
Those functions won't even compile.
Reply
#10

good job, boy.
Reply
#11

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
pawn Код:
stock Extra_Ban(playerid, reason[])
{
        SendClientMessage(playerid,-1,reason);
        Banned[playerid] = 1;
        new file[200];
        format(file,sizeof(file),"Extra/%s.ini",GetName(playerid));
        Extra_IntSet(file,"Ban",1);
        SetTimer("KickPlayer",3000,false);
        return 1;
}
Why are you using 200 cells for something that would only need about ~35 cells?

pawn Код:
stock Extra_UnBan(playername[])
{
        new file[200]
        format(file,sizeof(file),"Extra/%s.ini",playername);
        Extra_IntSet(file,"Ban",0);
        return 1;
}
 
stock Extra_Mute(playerid, reason[])
{
        new file[200]
        format(file,sizeof(file),"Extra/%s.ini",GetName(playerid));
        Extra_IntSet(file,"Mute",1);
        Muted[playerid] = 1;
        return 1;
}
 
stock Extra_UnMute(playerid, reason[])
{
        new file[200]
        format(file,sizeof(file),"Extra/%s.ini",GetName(playerid));
        Extra_IntSet(file,"Mute",0);
        Muted[playerid] = 0;
        return 1;
}
 
stock Extra_Freeze(playerid, reason[])
{
        new file[200]
        format(file,sizeof(file),"Extra/%s.ini",GetName(playerid));
        Extra_IntSet(file,"Freeze",1);
        Freezed[playerid] = 1;
        TogglePlayerControlLabel(playerid,0);
        return 1;
}
 
stock Extra_UnFreeze(playerid, reason[])
{
        new file[200]
        format(file,sizeof(file),"Extra/%s.ini",GetName(playerid));
        Extra_IntSet(file,"Freeze",0);
        Freezed[playerid] = 0;
        TogglePlayerControlLabel(playerid,1);
        return 1;
}
Those functions won't even compile.
Fixed. And thanks everyone
Reply
#12

Not bad.
Reply
#13

Thanks .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)