[FilterScript] Private Messaging [Simple]
#2

Simple but usefull, update is, new code (shorter + the same stuff):
If errors tell me them and i fix it.

Код:
#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>
#define version "1.0"
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" -PM System-");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else
new PMEnabled[MAX_PLAYERS];

main()
{
	print("\n----------------------------------");
	print(" ~PM System~");
	print("----------------------------------\n");
}

public OnPlayerConnect(playerid)
{
    PMEnabled[playerid] = 1;
	return 1;
}
CMD:togpm( playerid, params[ ] )
{
    if(isnull(params)) return SendClientMessage(playerid, 0xEDC71CFF, "CMD: /togpm [on/off]");
    if(strcmp(params, "on", true ) == 0 )
    {
        PMEnabled[playerid] = 1;
        SendClientMessage(playerid, 0x00FF00FF, "You have enabled your private messaging feature.");
    }
    else if( strcmp( params, "off", true ) == 0 )
    {
        PMEnabled[playerid] = 0;
        SendClientMessage(playerid, 0xAA3333AA, "You have disabled your private messaging feature");
    }
    else SendClientMessage(playerid, 0xEDC71CFF,"CMD: /togpm [on/off]");
    return 1;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 0 && response == 1)
    {
	    new pName[MAX_PLAYER_NAME],gName[MAX_PLAYER_NAME],string[128];
	    new giveplayerid = GetPVarInt(playerid,"ClickedPlayer");
	    GetPlayerName(playerid,pName,sizeof pName);
	    GetPlayerName(giveplayerid,gName,sizeof gName);
	    format(string,sizeof string,"{B0B0B0}[PM]{FF0000}From {B0B0B0}%s{FF0000}: {E3BB19}%s",pName,inputtext);
	    SendClientMessage(giveplayerid,0xFFE615D4,string);
	    format(string,sizeof string,"{B0B0B0}[PM]{FF0000}Sent to {B0B0B0}%s{FF0000}: {E3BB19}%s",gName,inputtext);
	    SendClientMessage(playerid,0xFFE615D4,string);
	    return 1;
    }
	return 0;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    new pName[MAX_PLAYER_NAME], string[170],playerid2;
    if(PMEnabled[playerid2] == 0) return SendClientMessage(playerid, 0xAFAFAFAA, "{FF0000}[PM]{AFAFAF}That played has blocked his PMing feature");
	SetPVarInt(playerid,"ClickedPlayer",clickedplayerid);
    GetPlayerName(clickedplayerid,pName,sizeof(pName));
	format(string,sizeof(string),"{FFFFFF}Type message which will be send to {E01B1B}%s{1BB5E0}(%d)",pName,clickedplayerid);
	ShowPlayerDialog(playerid,0,DIALOG_STYLE_INPUT,"{FFFFFF}PM",string,"Send","Cancel");
	return 1;
}
Reply


Messages In This Thread
Private Messaging [Simple] - by Stanford - 08.02.2013, 10:11
Re: Private Messaging [Simple] - by [WA]iRonan - 08.02.2013, 10:18
Re: Private Messaging [Simple] - by Stanford - 08.02.2013, 10:28
Re: Private Messaging [Simple] - by Alvon - 08.02.2013, 10:49
Re: Private Messaging [Simple] - by [WA]iRonan - 08.02.2013, 10:55
Re: Private Messaging [Simple] - by Stanford - 08.02.2013, 11:36
Re: Private Messaging [Simple] - by theomanking - 08.02.2013, 11:54
Re: Private Messaging [Simple] - by Stanford - 08.02.2013, 12:33
Re: Private Messaging [Simple] - by Anak - 08.02.2013, 13:09
Re: Private Messaging [Simple] - by 007Skyfall - 08.02.2013, 15:26

Forum Jump:


Users browsing this thread: 2 Guest(s)