14.01.2015, 18:31
Hello here is another tutorial to help newbies make other admins commad
I think no need for explain here
!
a color !
Now for the.....
(bool is something in samp that can be set to true or false only !)
now for the command
Then ....
Here we define the targetid that will mute and reason and string
Here we check if the targetid that the player wrote is connected to the server or not
Here we check if the player is admin check it to your Variables !
As i said we check if the bool equal true (Means if the player is muted) Send a message and stop !
And here we check if the player typed the command full with his params or not
And this is for messages (Do in it what do you want !)
Here,You set a timer that we will do later and multiply the minutes that the player write with 60000 because the timer is set with millisecond and set this timer for thr targetid
Here we set the bool true means that the player is muted !
Then end......
Now for the timer
make forward to make public (The timer)
The public
Set the player mute to false (Player unmuted) after the time end.
And send a message to the player after he umnuted
End of the timer.
And now for.....
The command.....
All these as i explained before (I am lazy :P !)
The timer will killed because we will stop it and will unmute the player
Set the player mute to false (Unmuted !)
End of the command..
End of the tutorial and this is for newbies because sure there are some people who are still learning
Basic code by : Axey (I was having exams -_-)
Edited by : Me (After i finished
)
Hope it will help you .
Ahmed_Nezoo
Mute & Unmute
first the includes PHP Code:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
![Cheesy](images/smilies/biggrin.png)
a color !
PHP Code:
#define COLOR_RED 0xFF0000AA
Mute !!
first we need a bool on the top of the script to check if the player muted or not(bool is something in samp that can be set to true or false only !)
PHP Code:
new bool:muted[MAX_PLAYERS];
PHP Code:
CMD:mute(playerid, params[])
{
PHP Code:
new targetid, minutes, reason[128], string[128];
PHP Code:
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected to the server");
PHP Code:
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_RED, "Command not found on server! /help");
PHP Code:
if(muted[targetid] == true) return SendClientMessage(playerid, COLOR_RED, "Player is already muted");
PHP Code:
if(sscanf(params,"uis[128]", targetid, minutes, reason)) return SendClientMessage(playerid, COLOR_RED, "Mute: /mute (id) (minutes) (reason)");
PHP Code:
format(string, sizeof(string), "Administrator %s muted %s for %d minutes: %s", PlayerName(playerid), PlayerName(targetid), minutes, reason);
SendClientMessageToAll(COLOR_RED, string);
PHP Code:
SetTimerEx("Unmute", minutes*60000, false, "i", targetid);
PHP Code:
muted[targetid] = true;
PHP Code:
return 1;
}
Now for the timer
PHP Code:
forward Unmute(playerid);
PHP Code:
public Unmute(playerid)
{
PHP Code:
muted[playerid] = false;
PHP Code:
SendClientMessage(playerid, COLOR_RED, "You have been unmuted automatically by server");
PHP Code:
return 1;
}
And now for.....
Unmute !!
PHP Code:
CMD:unmute(playerid, params[])
{
PHP Code:
new targetid, string[128];
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected to the server");
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_RED, "Command not found on server! /help");
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_RED, "Cancel player mute: /unmute (id)");
format(string, sizeof(string), "Your mute has been canceled by administrator %s", PlayerName(playerid));
SendClientMessage(targetid, COLOR_RED, string);
format(string, sizeof(string), "Administrator %s has canceled %s's mute", PlayerName(playerid), PlayerName(targetid));
SendToAdmins(COLOR_RED, string);
PHP Code:
KillTimer(Unmute(playerid));
PHP Code:
muted[targetid] = false;
PHP Code:
return 1;
}
End of the tutorial and this is for newbies because sure there are some people who are still learning
Basic code by : Axey (I was having exams -_-)
Edited by : Me (After i finished
![Cheesy](images/smilies/biggrin.png)
Hope it will help you .
Ahmed_Nezoo
![Wink](images/smilies/wink.png)