Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getmail(playerpawn p)
- {
- local string localbs,values;
- local int i,mailcount;
- localbs = dbobject.concatgroups (getplayername(p)$".inbox");
- ExecuteCommand(localbs);
- // getiing mail is broken due to the return having spaces in it.
- For( i = 0; i < 200 ; i++ )
- {
- if (wordlist[i] != "" && wordlist[i] != " " && wordlist[i] != "nil")
- {
- log (wordlist[i] ,stringtoname("[mailsrv]"));
- values = dbobject.getdatavalue (getplayername(p)$".inbox" , wordlist[i]);
- if (values != "nil") //&& values == "unread")
- {
- mailcount ++;
- p.ClientMessage("Inbox -" $ wordlist[i]);
- }
- }
- }
- if (mailcount > 0)
- {
- p.ClientMessage("Inbox you have " $ mailcount $ "unread messages in your inbox , chat /inbox markread to ignore them");
- }else{
- //p.ClientMessage("Inbox you have " $ mailcount " messages in your inbox");
- }
- }
- function sendmail(playerpawn p,string target,string message)
- {
- local string localbs;
- local int i,mailcount;
- local bool isuser,userpassed;
- // lookup if a player was ever here
- localbs = dbobject.concatgroups ("loggedplayer");
- ExecuteCommand(localbs);
- // check if the user has been here
- For( i = 0; i < 200 ; i++ )
- {
- if (wordlist[i] != "" && wordlist[i] != " " && wordlist[i] != "nil")
- {
- if (wordlist[i] == target)
- {
- isuser = true;
- }
- }
- }
- if (!isuser )
- {
- // not been here
- p.ClientMessage("The user you requested has probably never been on this server!");
- if (dbobject.getdatavalue (target $".nickserv" ,"password") == "nil")
- {
- // no account
- p.ClientMessage("The user you requested to leave a message for has never setup a account!");
- }else{
- // account but not logged at prelogin ? lol
- // i lul - but this can happen becuase we only started logging
- // prelogin later on
- userpassed = true;
- }
- }else{
- // been here
- if (dbobject.getdatavalue (target $".nickserv" ,"password") == "nil")
- {
- // no account here
- p.ClientMessage("The user you requested to leave a message for has never setup a account!");
- }else{
- // account !
- userpassed = true;
- }
- }
- if (userpassed)
- {
- // some user exists
- dbobject.updatedatavalue (target$".inbox" , "message~~~from~~~" $ getplayername(p) $ "~~~" $ stripspaces(message) ,"unread");
- p.ClientMessage("message saved, the user will see it next time he/she logs in!");
- }
- }
- // delimiter avoidance nonsence
- function string stripspaces(string inputstr)
- {
- local int p,lenn;
- lenn = len(inputstr);
- For(p = 0; p < lenn ; p++ )
- {
- inputstr = ReplaceStr(inputstr, " ", "~~~");
- }
- return inputstr;
- }
- function string putbackspaces(string inputstr)
- {
- local int p,lenn;
- lenn = len(inputstr);
- For(p = 0; p < lenn ; p++ )
- {
- inputstr = ReplaceStr(inputstr, "~~~", " ");
- }
- return inputstr;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement