Need small help with PM
#3

Код:
 CMD:pm(playerid,params[])
    {
        new targetid, msg[128];
        if(sscanf(params, "us[128]", targetid, msg)) return SendClientMessage(playerid, LIGHTBLUE,"[ USAGE: /pm (name/id) (Message) ]");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, red, "[ ERROR: Player is not online! ]");
        if(pm[targetid] == false) return SendClientMessage(playerid, red,"[ ERROR: Player has blocked private messages! ]");
        if(targetid == playerid) return SendClientMessage(playerid, red, "[ ERROR: You can't pm yourself! ]");
        new string[128], Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
        GetPlayerName(playerid, Name1, sizeof(Name1));
        GetPlayerName(targetid, Name2, sizeof(Name2));
        format(string, sizeof(string),"Private Message from %s (%d): %s", Name1, playerid, msg);
        SendClientMessage(targetid,COLOR_PINK, string);
        format(string, sizeof(string),"Private Message sent to %s (%d): %s", Name2, targetid, msg);
        SendClientMessage(playerid,COLOR_PINK, string);
        MessageLog(msg);
        return 1;
}

Код:
forward MessageLog(msg[]);
public MessageLog(msg[])
{
	new entry[256];
	format(entry,sizeof(entry),"%s\r\n",msg);
	new File:rFile;
	rFile = fopen("PM.txt",io_append);
	fwrite(rFile,entry);
	fclose(rFile);
}
Not tested but i think this will work
Reply


Messages In This Thread
Need small help with PM - by Sc0pion - 13.03.2015, 15:01
Re: Need small help with PM - by ATGOggy - 13.03.2015, 15:16
Re: Need small help with PM - by Nabster - 13.03.2015, 15:19
Re: Need small help with PM - by Sc0pion - 13.03.2015, 15:27
Re: Need small help with PM - by ATGOggy - 13.03.2015, 15:32
Re: Need small help with PM - by Sc0pion - 13.03.2015, 15:35
Re: Need small help with PM - by ATGOggy - 13.03.2015, 15:40
Re: Need small help with PM - by Sc0pion - 13.03.2015, 15:48
Re: Need small help with PM - by Nabster - 13.03.2015, 15:49
Re: Need small help with PM - by ATGOggy - 13.03.2015, 15:51

Forum Jump:


Users browsing this thread: 1 Guest(s)