SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 12/02/2018, 09:10 PM   #1
1fret
Banned
 
Join Date: Feb 2014
Posts: 619
Reputation: 7
Default Quick question

I'm making this new feature to my server where an admin level 9 is an anonymous level so if me (a level 9 admin) makes a ban to a player it will only show, "Player A has been banned from the server. [Reason: Aimbot]", and if the admin which makes the ban level is lower than 9 their name will show like this,"Player A has been banned from the server by Admin Player B.[Reason: Aimbot]". or something along that line but the problem is i don't know how to do that or is its even possible.

PHP Code:
CMD:ban(playeridparams[])
{
    if (!
IsPlayerAdmin(playerid) && playerData[playerid][pd_AdminRank] < 2) return SendScreenMessage(playeridLOCALE_MESSAGE_NOTAUTHORIZEDCOMMAND);
    
    new 
targetidReason[MAX_STRING_REASON];
    if (
sscanf(params"us["#MAX_STRING_REASON"]", targetid, Reason)) return SendClientMessage(playerid, COLOR_SYNTAX, "[SYNTAX] /ban <player> <reason>");
    
if (targetid == playerid) return SendClientMessage(playeridCOLOR_SYNTAX"[ERROR] You can't ban yourself");
    if (!
IsPlayerInGame(targetid)) return SendScreenMessage(playeridLOCALE_MESSAGE_INVALIDPLAYER);
    if (
playerData[playerid][pd_AdminRank] <= playerData[targetid][pd_AdminRank]&& IsPlayerAdmin(targetid)) SendScreenMessage(playeridLOCALE_MESSAGE_CANTUSECOMMANDONTHATPLAYER);

    new 
y,m,d,hour,mint,sec;
    
getdate(y,m,d);
    
gettime(hour,mint,sec);

    
    new 
string[256];
    
format(stringsizeof string"[SERVER] %s(%i) has been banned by %s %s(%i), reason: %s"ReturnPlayerName(targetid), targetidGetStaffClassName(playerid), ReturnPlayerName(playerid), playeridReason);
    
SendClientMessageToAll(0x7E08EDFF/*COLOR_SERVER*/string);
    new 
message[128];
    
format(message128"You have been banned from ~n~"SERVER_NAME"");
    
ShowInfoBox(targetid"Banned"message);
    
PlayerPlaySound(targetidSOUND_NOTIFICATION0.00.00.0);
    
mysql_format(gGameConnectionstringsizeof string"INSERT IGNORE INTO `closed_accounts` (`account_id`, `reason`, `ip`, `by_account_id`) VALUES (%i, '%e', '%s', %i);"playerData[targetid][pd_AccountId], ReasonGetPlayerIP(targetid), playerData[playerid][pd_AccountId]);
    
mysql_tquery(gGameConnectionstring);
    
format(stringsizeof string"UPDATE `accounts` SET `total_bans` = `total_bans` + 1 WHERE `id` = %i;"playerData[targetid][pd_AccountId]);
    
mysql_tquery(gGameConnectionstring);

    
SendClientMessage(targetidCOLOR_NOTIFY"You have been banned and kicked from "SERVER_NAME"");
    
SendClientMessage(targetidCOLOR_NOTIFY"================"SERVER_NAME"==================");
    
format(stringsizeof(string), "Your Name: %s || Account ID: %d"ReturnPlayerName(targetid),playerData[targetid][pd_AccountId]);
    
SendClientMessage(targetid, -1string);
    
format(stringsizeof(string), "IP Address: %s || Reason: %s"GetPlayerIP(targetid),Reason);
    
SendClientMessage(targetid, -1string);
    
format(stringsizeof(string), "Admin Position: %s || Admin Name: %s"GetStaffClassName(playerid), ReturnPlayerName(playerid));
    
SendClientMessage(targetid, -1string);
    
format(messagesizeof(message),"Date: %d/%d/%d || Time: %02d:%02d:%02d",d,m,y,hour,mint,sec );
    
SendClientMessage(targetid,-1,message);
    
SendClientMessage(targetidCOLOR_NOTIFY"===============================================");
    
SendClientMessage(targetidCOLOR_NOTIFY"A Screenshot(F8) of the information above will be needed to make a ban appeal.");
    
SendClientMessage(targetidCOLOR_HINT"You may make a ban appeal on our forums: " SERVER_URL);
    
GameTextForPlayer(targetid"~r~Banned"30000);
    
SetTimerEx("KickEx"TIMER_KICKfalse"i"targetid);
    return 
1;

1fret is offline   Reply With Quote
Old 12/02/2018, 09:18 PM   #2
Mugala
Gangsta
 
Mugala's Avatar
 
Join Date: Nov 2012
Location: behind u
Posts: 646
Reputation: 30
Default Re: Quick question

yeah it's possible, to dont change the script u can simply add a variable which detects admin name.
for example:
PHP Code:
    new string[256],aname[64];
    if(
playerData[playerid][pd_AdminRank] < 9format(aname,sizeof(aname),"%s %s(%i)",GetStaffClassName(playerid), ReturnPlayerName(playerid), playerid);
    else 
aname "Admin";
    
format(stringsizeof string"[SERVER] %s(%i) has been banned by %s, reason: %s"ReturnPlayerName(targetid), targetidanameReason); 
    
SendClientMessageToAll(0x7E08EDFF/*COLOR_SERVER*/string); 
PHP Code:
    format(stringsizeof(string), "Admin Position: %s || Admin Name: %s"GetStaffClassName(playerid),aname); 
    
SendClientMessage(targetid, -1string); 
__________________
here to help
Mugala is offline   Reply With Quote
Old 12/02/2018, 10:45 PM   #3
1fret
Banned
 
Join Date: Feb 2014
Posts: 619
Reputation: 7
Default Re: Quick question

Quote:
Originally Posted by Mugala View Post
yeah it's possible, to dont change the script u can simply add a variable which detects admin name.
for example:
PHP Code:
    new string[256],aname[64];
    if(
playerData[playerid][pd_AdminRank] < 9format(aname,sizeof(aname),"%s %s(%i)",GetStaffClassName(playerid), ReturnPlayerName(playerid), playerid);
    else 
aname "Admin";
    
format(stringsizeof string"[SERVER] %s(%i) has been banned by %s, reason: %s"ReturnPlayerName(targetid), targetidanameReason); 
    
SendClientMessageToAll(0x7E08EDFF/*COLOR_SERVER*/string); 
PHP Code:
    format(stringsizeof(string), "Admin Position: %s || Admin Name: %s"GetStaffClassName(playerid),aname); 
    
SendClientMessage(targetid, -1string); 
Thanks Rep+
1fret is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NPC Quick Question jakejohnsonusa Scripting Help 1 01/10/2012 08:30 PM
Quick question. AstonDA-G Scripting Help 3 08/06/2012 03:41 PM
Quick question Steven82 Help Archive 9 27/04/2011 09:48 AM
Quick question. Jose 510 Server Support 1 30/03/2010 05:54 PM
quick question [SF]RobMob Help Archive 2 07/03/2010 07:21 PM


All times are GMT. The time now is 09:48 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.