Need small help with PM
#7

This will store date and time:
PHP код:
CMD:pm(playerid,params[]) 
    { 
        new 
targetidmsg[128]; 
        if(
sscanf(params"us[128]"targetidmsg)) return SendClientMessage(playeridLIGHTBLUE,"[ USAGE: /pm (name/id) (Message) ]"); 
        if(!
IsPlayerConnected(targetid)) return SendClientMessage(playeridred"[ ERROR: Player is not online! ]"); 
        if(
pm[targetid] == false) return SendClientMessage(playeridred,"[ ERROR: Player has blocked private messages! ]"); 
        if(
targetid == playerid) return SendClientMessage(playeridred"[ ERROR: You can't pm yourself! ]"); 
        new 
string[128], Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME]; 
        
GetPlayerName(playeridName1sizeof(Name1)); 
        
GetPlayerName(targetidName2sizeof(Name2)); 
        
format(stringsizeof(string),"Private Message from %s (%d): %s"Name1playeridmsg); 
        
SendClientMessage(targetid,COLOR_PINKstring); 
        
format(stringsizeof(string),"Private Message sent to %s (%d): %s"Name2targetidmsg); 
        
SendClientMessage(playerid,COLOR_PINKstring); 
        new 
File:file=fopen("PM.log"io_append), hourminutesecondyearmonthday;
        
Gettime(hourminutesecond);
        
Getdate(yearmonthday);
        
format(stringsizeof(string), "[%d/%d/%d, %d:%d:%d] %s to %s: %s\r\n"daymonthyearhourminutesecondName1Name2msg);
        
fwrite(filestring); 
        
fclose(file); 
        return 
1

If you want to change the directory, just change this line:
PHP код:
new File:file=fopen("PM.log"io_append); 
to:
PHP код:
new File:file=fopen("/database/PM.log"io_append); 
or anything.
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)