Ban Problem
#5

Is there even point for wasting so many textdraw slots for simple ban message, because with those slots you can build some good interface systems like cool inventory system, stats etc.
And first you don't need to try to build some badass roleplay server, but start from something simpler
PHP код:
#define scm SendClientMessage
#define func%0(%1) forward%0(%1); public%0(%1)
enum PlayerEnum{
    
pSid,
    
pAdmin,
    
pName[24],
    
bool:pLogged
};
CMD:ban(pidp[]){ //Ban a Player
    
new id,s[300];
    if(
pInfo[pid][pAdmin] < 1)return scm(pid,-1,"ERROR: You are not authorized to use this command.");
    if(
sscanf(p,"us[120]",id,p))return scm(pid,-1,"USAGE: /ban (Username/ID) (Reason)");
    if(!
IsPlayerConnected(id) || !pInfo[pid][pLogged])return scm(pid,-1,"ERROR: Wrong ID or that player is not connected.");
    
//just simple mysql request, you don't need to change enum info because he will be kicked anyway...
    
mysql_format(Database,s,sizeof(s),"UPDATE players SET banned='1',banstart=UNIX_TIMESTAMP(),bannersid='%d',banreason='%e' where sqlid='%d'",
    
pInfo[pid][pSid],p,pInfo[id][pSid]);
    
//mysql_query(Database, query); is used for threaded inline querys
    
mysql_tquery(Database,s);
    
format(s,sizeof(s),"{33CCFF}[BAN] %s {FFFFFF}has been banned from the server by {33CCFF}%s (%s)."pInfo[id][pName],pInfo[pid][pName],p);
    
SendClientMessageToAll(-1,s);
    
//first you set the value
    //i think player knows his name
    //format(s, sizeof(s), "Player Name: %s", pInfo[pID][pName]);
    //PlayerTextDrawSetString(id, PlayerName[id], s);
    
format(ssizeof(s), "Admin Name: %s"pInfo[pid][pName]);
    
PlayerTextDrawSetString(idAdminName[id], s);
    
format(ssizeof(s), "Reason: %s"p);
    
PlayerTextDrawSetString(idBanReason[id], s);
    
//no point for that when he knows todays date waste of information
    //format(s, sizeof(s), "Date: %d/%d/%d", pInfo[pID][pBanD], pInfo[pID][pBanM], pInfo[pID][pBanY]);
    //PlayerTextDrawSetString(id, BanDate[id], s);
    
    //then you show textdraw
    
TextDrawShowForPlayer(idBanBox1);
    
TextDrawShowForPlayer(idBanBox2);
    
TextDrawShowForPlayer(idBanOverview);
    
TextDrawShowForPlayer(idBanAppeal);
    
TextDrawShowForPlayer(idBanBox3);
    
//PlayerTextDrawShow(id, PlayerName[id]);
    
PlayerTextDrawShow(idAdminName[id]);
    
PlayerTextDrawShow(idBanReason[id]);
    
//PlayerTextDrawShow(id, BanDate[id]);
    
    //then you freeze
    
TogglePlayerControllable(id0);
    
    
//kick
    //little delay must be there, because information can then reace to player
    
SetTimerEx("KickPlayer",250,false,"d",id);    
    return 
1;
}
func KickPlayer(pid)return Kick(pid); 
Reply


Messages In This Thread
Ban Problem - by NoteND - 27.04.2018, 09:45
Re: Ban Problem - by UFF - 27.04.2018, 10:18
Re: Ban Problem - by kovac - 27.04.2018, 11:44
Re: Ban Problem - by jasperschellekens - 27.04.2018, 11:53
Re: Ban Problem - by CodeStyle175 - 27.04.2018, 12:09
Re: Ban Problem - by jasperschellekens - 27.04.2018, 12:19
Re: Ban Problem - by CodeStyle175 - 27.04.2018, 12:21

Forum Jump:


Users browsing this thread: 1 Guest(s)