Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- This script was created as somebody in the SA-MP community asked for it.
- You can use this freely, but I'd be greatful if you would give me some
- credit for it. The commands are as follows:
- /ask [playerid/name] - This lets a person ask a question.
- /answer [playerid/name] - This lets an Administrator answer a question. (Must be RCON).
- /pm [playerid/name] [message] - This is so then two people can communicate with each
- other, answering questions.
- Thank you for using this script,
- iGetty.
- */
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- forward SendAdminMessage(color, string[]);
- new Asked[MAX_PLAYERS];
- public OnPlayerConnect(playerid)
- {
- Asked[playerid] = 0;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- Asked[playerid] = 0;
- }
- command(pm, playerid, params[])
- {
- new id, message[128], string[256];
- if(sscanf(params, "us[128]", id, message)) return SendClientMessage(playerid, -1, "Server: /pm [playerid/name] [message]");
- {
- format(string, sizeof(string), "[PM From: %s] %s", pName(playerid), message);
- SendClientMessage(id, -1, string);
- format(string, sizeof(string), "[PM To: %s] %s", pName(id), message);
- SendClientMessage(playerid, -1, string);
- }
- return 1;
- }
- command(ask, playerid, params[])
- {
- new message[128], string[256];
- if(sscanf(params, "s[128]", message)) return SendClientMessage(playerid, -1, "Server: /ask [question]");
- {
- format(string, sizeof(string), "Ask: %s has asked a question. (%s)", pName(playerid), message);
- SendAdminMessage(-1, string);
- Asked[playerid] = 1;
- }
- return 1;
- }
- command(answer, playerid, params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- new id, string[128];
- if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "Server: /answer [playerid/name]");
- {
- if(Asked[id] == 1)
- {
- format(string, sizeof(string), "Admin %s is now assisting you. Use \"/pm %d\" to talk to him.", pName(playerid), playerid);
- SendClientMessage(id, -1, string);
- Asked[id] = 0;
- }
- else return SendClientMessage(playerid, -1, "That player hasn't asked a question.");
- }
- }
- else return SendClientMessage(playerid, -1, "You must be an Administrator to use this.");
- return 1;
- }
- public SendAdminMessage(color, string[])
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerAdmin(i))
- {
- SendClientMessage(i, -1, string);
- }
- }
- return 1;
- }
- stock pName(playerid)
- {
- new Name[24];
- GetPlayerName(playerid, Name, sizeof(Name));
- return Name;
- }
Advertisement
Add Comment
Please, Sign In to add comment