Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sms (source, command, receiverName, ...)
- ... = { ... }
- if not receiverName then
- outputChatBox("No recipient given", source)
- elseif #... == 0 then
- outputChatBox("No text message given", source)
- else
- local receiver = getPlayerFromName(receiverName)
- if receiver then
- receiverName = getPlayerName(receiver)
- if getPlayerMoney(source) >= 1 then
- takePlayerMoney(source, 1)
- local sendString = table.concat(..., " ")
- while (sendString:len() > 0) do
- outputChatBox("SMS from "..getPlayerName(source)..": "..sendString:sub(1, 100))
- sendString = sendString:sub(101)
- end
- outputChatBox("SMS sent", source)
- else
- outputChatBox("You have no credit left", source)
- end
- else
- outputChatBox("Destination unreachable", source)
- end
- end
- end
- addCommandHandler("sms", sms)
Add Comment
Please, Sign In to add comment