SA-MP Forums Archive
[FilterScript] Simple PM System - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Simple PM System (/showthread.php?tid=465298)



Simple PM System - Justin Reif - 21.09.2013

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


Re: Simple PM System - streetpeace - 21.09.2013

Thanks, i like it. Simple and usefull, +rep.


Re: Simple PM System - Konstantinos - 21.09.2013

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).


Re: Simple PM System - DeathFire - 21.09.2013

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


Re: Simple PM System - Justin Reif - 21.09.2013

Thank You.


Re: Simple PM System - TunisianoGamer - 21.09.2013

i like it







.


Re: Simple PM System - Konstantinos - 21.09.2013

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.


Re: Simple PM System - FireNation - 21.09.2013

Good work brah


Re: Simple PM System - Justin Reif - 22.09.2013

Thank Youu <3


Re: Simple PM System - MarikTeplii - 23.09.2013

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


______________
Sorry for my english.