[FilterScript] Simple PM System
#1

Before I Start, #NoHate, First Filterscript. :3
Okay, This Is Just A Personal Message System, Made Using zcmd By Zeex.
Theres Only One Command Which Is,
/pm [ID] [Message]

Код:
#include <zcmd>

CMD:pm(playerid, params[])
{
    new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
    if(sscanf(params, "us", id, str2))
    {
        SendClientMessage(playerid, 0xFF0000FF, "Usage: /pm [ID] [MESSAGE]");
        return 1;
    }
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player Isnt Connected");
    if(playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You Cannot PM Yourself!")
    {
        GetPlayerName(playerid, Name1, sizeof(Name1));
        GetPlayerName(id, Name2, sizeof(Name2));
        format(str, sizeof(str), "PM To %s: %s", Name2, id, str2);
        SendClientMessage(playerid, 0xFF0000FF, str);
        format(str, sizeof(str), "PM From %s: %s", Name1, playerid, str2);
        SendClientMessage(id, 0xFF0000FF, str);
    }
    return 1;
}
Thank You. <3
Reply
#2

Thanks, i like it. Simple and usefull, +rep.
Reply
#3

May I improve it a bit?
pawn Код:
CMD:pm(playerid, params[])
{
    new str2[93], id;
    if(sscanf(params, "us[93]", id, str2)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /pm [ID] [MESSAGE]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player Isnt Connected");
    if(playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You Cannot PM Yourself!");
    new Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME], str[128];
    GetPlayerName(playerid, Name1, sizeof(Name1));
    GetPlayerName(id, Name2, sizeof(Name2));
    format(str, sizeof(str), "PM To %s: %s", Name2, str2);
    SendClientMessage(playerid, 0xFF0000FF, str);
    format(str, sizeof(str), "PM From %s: %s", Name1, str2);
    SendClientMessage(id, 0xFF0000FF, str);
    return 1;
}
The max client message is 128, so 256 is waste. If you take the characters from "PM To/From name_here: " + message = 128.

"s" specifier in sscanf needs to be followed by its size.

You displayed player's ID though, it wouldn't exist any format for integers (%d).
Reply
#4

Tell me, in what way is it different then the others?
Anyway, +REP for helping.
Reply
#5

Thank You.
Reply
#6

i like it







.
Reply
#7

Quote:
Originally Posted by DeathFire
Посмотреть сообщение
Tell me, in what way is it different then the others?
Anyway, +REP for helping.
If you refer to me:
Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
The max client message is 128, so 256 is waste. If you take the characters from "PM To/From name_here: " + message = 128.

"s" specifier in sscanf needs to be followed by its size.

You displayed player's ID though, it wouldn't exist any format for integers (%d).
Anyways, good job as it his first filterscript.
Reply
#8

Good work brah
Reply
#9

Thank Youu <3
Reply
#10

old command.
I'm doing this a long time ago.


______________
Sorry for my english.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)