SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 19/01/2015, 11:47 AM   #1
nezo2001
Gangsta
 
Join Date: Nov 2014
Location: Cairo, Egypt
Posts: 680
Reputation: 26
Default Chat System

Chat System

Here is a chat system that contains the most chat command if anyone have any suggest or found any bug feel free to post here

Commands:
/pm (To Send a private message to a player)
/pms (Toggle between block and unblock private messages)
/wc (Virtual world chat)
/me (To put your name before the wrods like that "Nezoo is showing an example for you ")
/shout (To shout like "Stop"! (nezoo shout))
/mute (To prevent player to chat in the main chat 'With Timer' "For Rcon only you can change this to your admin information")
/unmute (To enable him to talk in the chat and kill the timer "Same as above")
/w (whisper which show the message for the near player only with radius 100 "You can change it")
/cc (Car chat to chat with the player in the car only

How to change to your admin information:
Just change this:
PHP Code:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playeridCOLOR_RED"You can't use this command"); 
To:
PHP Code:
if(PlayerInfo[playerid][pAdmin] == 0)  return SendClientMessage(playeridCOLOR_RED"You can't use this command"); //Here change it to your information 
Edit: I forget to put the link
Link: http://pastebin.com/x2C7wnNA

As i said if you found any bug or you have any suggest feel free to post it here.

Please leave a feedback,
Ahmed_Nezoo
__________________
Quote:
Originally Posted by Human
When im met u, u were nub at scripting xD.

But now, i'm impressed. Good job.
Don't look at my history. Everyone started somewhere
nezo2001 is offline   Reply With Quote
Old 19/01/2015, 11:04 PM   #2
mitchellfunny1069
Little Clucker
 
Join Date: Mar 2010
Posts: 30
Reputation: 1
Default Re: Chat System

Nice
mitchellfunny1069 is offline   Reply With Quote
Old 20/01/2015, 08:28 AM   #3
CalvinC
High-roller
 
CalvinC's Avatar
 
Join Date: Nov 2014
Location: Denmark
Posts: 1,831
Reputation: 114
Default Re: Chat System

Sorry to say this, but this filterscript has alot of faulths...
First of all, the indentation is really quite bad.
Second off, you're creating variables at the top of commands when not needed.

pawn Code:
CMD:mute(playerid, params[])
{
        new targetid, minutes, reason[128], string[128];
        new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    new name2[MAX_PLAYER_NAME];
    GetPlayerName(targetid, name2, sizeof(name));
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected to the server");
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You can't use this command");
        if(muted[targetid] == true) return SendClientMessage(playerid, COLOR_RED, "Player is already muted");
        if(sscanf(params,"uis[128]", targetid, minutes, reason)) return SendClientMessage(playerid, COLOR_RED, "/mute (id) (minutes) (reason)");
        format(string, sizeof(string), "Administrator %s muted %s for %d minutes: %s", name, name2, minutes, reason);
        SendClientMessageToAll(COLOR_RED, string);
        mutetimer =     SetTimerEx("Unmute", minutes*60000, false, "i", targetid);
        muted[targetid] = true;
        return 1;
}
You could easily optimise this, you're creating the variables at the top, therefore it will create the variables even if something went wrong.
Like if the targetid isn't connected, the player isn't admin, the targetid is already muted or if you didn't insert a targetid.
It will still create the variables, it would be way better to create the variables as the functions in the command gets executed, not the stuff that checks and cancels the command.
Like this:
pawn Code:
CMD:mute(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You can't use this command");
    new targetid;
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected to the server");
    if(muted[targetid] == true) return SendClientMessage(playerid, COLOR_RED, "Player is already muted");
    new minutes, reason[128];
    if(sscanf(params,"uis[128]", targetid, minutes, reason)) return SendClientMessage(playerid, COLOR_RED, "/mute (id) (minutes) (reason)");
    new string[128], name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerName(targetid, name2, sizeof(name));
    format(string, sizeof(string), "Administrator %s muted %s for %d minutes: %s", name, name2, minutes, reason);
    SendClientMessageToAll(COLOR_RED, string);
    mutetimer = SetTimerEx("Unmute", minutes*60000, false, "i", targetid);
    muted[targetid] = true;
    return 1;
}
Also fixed your indentation, but this way would be more optimised.

You could also optimise your script because you're using "else" when it's not needed.
Example:
pawn Code:
CMD:pms(playerid, params[])
{
        if(pm[playerid] == false)
        {
            pm[playerid] = true;
            SendClientMessage(playerid,0xEE128960,"Private Messages unblocked! You can receive messages from other players");
        }
        else
        {
        pm[playerid] = false;
            SendClientMessage(playerid, 0xEE128960,"Private Messages blocked! You will no longer receive messages from other players");
        }
        return 1;
}

Using a switch in these occasions would be much better, and more optimised.

pawn Code:
CMD:pms(playerid, params[])
{
    switch(pm[playerid])
    {
        case false:
        {
            pm[playerid] = true;
            SendClientMessage(playerid,0xEE128960,"Private Messages unblocked! You can receive messages from other players");
        }
        case true:
        {
            pm[playerid] = false;
            SendClientMessage(playerid, 0xEE128960,"Private Messages blocked! You will no longer receive messages from other players");
        }
    }
    return 1;
}
__________________
[Tutorial] Custom Playerdamage system
Desert Eagle's dealing too much damage, you want one-hit sniper kills, or damage based on body parts? Check this out.
CalvinC is offline   Reply With Quote
Old 20/01/2015, 09:38 PM   #4
nezo2001
Gangsta
 
Join Date: Nov 2014
Location: Cairo, Egypt
Posts: 680
Reputation: 26
Default Re: Chat System

This two commands scripted by my mate because i was having exams
__________________
Quote:
Originally Posted by Human
When im met u, u were nub at scripting xD.

But now, i'm impressed. Good job.
Don't look at my history. Everyone started somewhere
nezo2001 is offline   Reply With Quote
Old 25/01/2015, 06:59 PM   #5
hossa
Huge Clucker
 
hossa's Avatar
 
Join Date: Dec 2011
Location: Around here.
Posts: 473
Reputation: 194
Default Re: Chat System

Well, your mate should've shared them, not you.
__________________

Contact me: Private Message
hossa is offline   Reply With Quote
Old 25/01/2015, 09:30 PM   #6
AroNix
Little Clucker
 
AroNix's Avatar
 
Join Date: Aug 2014
Posts: 49
Reputation: 2
Default Re: Chat System

Nice !
It is great for servers that do not have something and looking ..
__________________
» RSP :: Romania Stunt Place «
« 93.119.25.86:7777 »
Yahoo : wos_sunrise
Skype : samp_arownd

AroNix is offline   Reply With Quote
Old 20/02/2015, 09:54 PM   #7
MaxOkay
Little Clucker
 
Join Date: Jan 2015
Posts: 8
Reputation: 1
Default Re: Chat System

Nice
+REP,rep me back.if you want
MaxOkay is offline   Reply With Quote
Old 20/02/2015, 10:23 PM   #8
SoNikMells
Huge Clucker
 
SoNikMells's Avatar
 
Join Date: Feb 2014
Location: Belarus
Posts: 280
Reputation: 62
Default Re: Chat System

Quote:
Originally Posted by CalvinC View Post
pawn Code:
CMD:pms(playerid, params[])
{
    switch(pm[playerid])
    {
        case false:
        {
            pm[playerid] = true;
            SendClientMessage(playerid,0xEE128960,"Private Messages unblocked! You can receive messages from other players");
        }
        case true:
        {
            pm[playerid] = false;
            SendClientMessage(playerid, 0xEE128960,"Private Messages blocked! You will no longer receive messages from other players");
        }
    }
    return 1;
}
...xD

PHP Code:
CMD:pms(playeridparams[])
{
    
pm[playerid] = pm[playerid] ? false true;
    return 
SendClientMessage(playerid0xEE128960pm[playerid]
        ? (
"Private Messages blocked! You will no longer receive messages from other players")
        : (
"Private Messages unblocked! You can receive messages from other players"));

SoNikMells 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
[FilterScript] RECS - Raf's External Chat System - Chat from your Android phone ! R@f Filterscripts 71 26/05/2017 06:28 PM
[FilterScript] Shrewd Chat System V2 (With Smart Chat V3) [Good for Roleplay] =WoR=Varth Filterscripts 24 13/03/2017 01:24 PM
RP chat system.. RoleplayEditor Help Archive 9 17/08/2011 11:44 AM
Chat System Help ||.Rier.|| Help Archive 4 17/06/2010 03:15 PM
[FilterScript] [FS] Chat System ZaR Релизы/Releases 4 22/05/2010 10:01 AM


All times are GMT. The time now is 12:36 PM.


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