Introduction:hello guys, i scripted this first filterscript of helpers system because i checked their are very less scripts of helpers so i created i hope you like it
Helper's Commands:
/reply,
/hc,
/hduty,
hsay,
/pm,
/hgoto,
/hget
Installation:
1> Copy the code and compile it.
2> Put the amx in filterscripts folder.
3> Add name of filterscript in server.cfg.
4> Created folder named "helpers" in scriptfiles
Code:
Credits:
SA-MP Team for a_samp.inc
Y_Less and Emmet_ for sscanf2.inc
DracoBlue for Dini.inc
ZeeX for Zcmd.inc
Helper's System
Helper's Commands:
/reply,
/hc,
/hduty,
hsay,
/pm,
/hgoto,
/hget
Installation:
1> Copy the code and compile it.
2> Put the amx in filterscripts folder.
3> Add name of filterscript in server.cfg.
4> Created folder named "helpers" in scriptfiles
Code:
PHP Code:
/* 2 Level's Helper System By PremiumGamer */
#define FILTERSCRIPT
#include <a_samp>
#include <dini>
#include <zcmd>
#include <foreach>
#include <sscanf2>
/* Colors */
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_RED 0xFF0000FF
#define COLOR_HELPER 0x00E5EEFF
/* new defines */
new helper[MAX_PLAYERS];
new conversation[MAX_PLAYERS];
/*Saving*/
#define FILE_HELPER "helpers/%s.ini"
/* Players */
stock Players(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" 2 Level's Helper System By PremiumGamer");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
CMD:sethelper(playerid, params[])
{
new giveplayerid, moneys1, giveplayer[25], string[256], playername[25], helpers[MAX_PLAYERS];
if (sscanf(params, "ud", giveplayerid, moneys1)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /sethelper [playerid] [0 = not helper, 1 = helper, 2 = helper level 2]");
if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "Error: Inactive player id!");
if (moneys1 < 0 || moneys1 > 2) return SendClientMessage(playerid, COLOR_RED, "Error: 0 = not helper, 1 = helper level 1, 2 = helper level 2.");
GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
if (moneys1 == helper[giveplayerid])
{
if (giveplayerid != playerid)
{
if (moneys1 == 0)
{
format(string, 64, "%s is not set as a helper.", giveplayer);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else
{
format(string, 64, "%s is already set as a helper.", giveplayer);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
else
{
if (moneys1 == 0) SendClientMessage(playerid, COLOR_WHITE, "You are not set as a helper.");
else SendClientMessage(playerid, COLOR_WHITE, "You are already set as a helper.");
}
return 1;
}
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
if (moneys1 != 0)
{
format(helpers, sizeof(helpers), FILE_HELPER, giveplayer);
dini_IntSet(helpers, "helper", moneys1);
if (giveplayerid != playerid)
{
SendClientMessage(giveplayerid, COLOR_YELLOW, "You have been set as a helper.");
format(string, 64, "You have set %s as a helper.", giveplayer);
SendClientMessage(playerid, COLOR_YELLOW, string);
SendClientMessage(giveplayerid, COLOR_YELLOW, "Check /hcmds for available helper commands.");
}
else SendClientMessage(playerid, COLOR_YELLOW, "You have set yourself as a helper.");
}
else
{
format(helpers, sizeof(helpers), FILE_HELPER, giveplayer);
dini_IntSet(helpers, "helper", moneys1);
if (giveplayerid != playerid)
{
SendClientMessage(giveplayerid, COLOR_WHITE, "You have been removed as a helper.");
format(string, 64, "You have removed %s as a helper.", giveplayer);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
else SendClientMessage(playerid, COLOR_WHITE, "You have removed yourself as a helper.");
}
helper[giveplayerid] = moneys1;
return 1;
}
// Helpers Commands
CMD:hcmds(playerid, params[])
{
if(!helper[playerid]) return 0;
if(helper[playerid] == 1)
{
SendClientMessage(playerid, COLOR_HELPER, "Junior Helper Commands");
SendClientMessage(playerid, COLOR_WHITE, "/reply, /hc, /hduty, /hsay, /pm");
}
if(helper[playerid] == 2)
{
SendClientMessage(playerid, COLOR_HELPER, "Senior Helper Commands");
SendClientMessage(playerid, COLOR_WHITE, "/reply, /hc,/hduty, hsay, /pm, /hgoto, /hget");
}
return 1;
}
//if any player do /ask then the heleprs cn help him by /reply
CMD:reply(playerid, params[])
{
new giveplayerid, tmp2[256], moneys1, playername[25], giveplayer[25], string[270];
if (helper[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: You aren't a helper.");
if (sscanf(params, "us[128]", giveplayerid, tmp2)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /reply [playerid] [message]");
if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "Error: Inactive player id!");
if(conversation[giveplayerid] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: That player did not start coversation with helpers team!");
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
if (helper[playerid] == 1)
format(string, 64, "Help - %s: %s", playername, tmp2);
SendClientMessageToAll(giveplayerid,string);
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) && helper[i] == 1 && i != giveplayerid)
{
format(string, 64, "[Junior Helper] - %s: %s", playername, tmp2);
SendClientMessageToAll(i,string);
moneys1 ++;
}
}
if (helper[playerid] == 2)
format(string, 64, "Senior Helper - %s: %s", playername, tmp2);
SendClientMessageToAll(playerid,string);
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) && helper[i] == 2 && i != giveplayerid)
{
format(string, 64, "[Senior Helper] - %s: %s", playername, tmp2);
SendClientMessageToAll(i,string);
moneys1 ++;
}
}
printf("[helper] %s (Id%d) to %s (Id%d) %s", playername, playerid, giveplayer, giveplayerid, tmp2);
return 1;
}
//you can /hsay to show players tht if u need help do /ask
CMD:hsay(playerid, params[])
{
new tmp[256], playername[25], tmp2[256],string[256];
if (helper[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: You aren't a helper.");
if (sscanf(params, "s[128]", tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /hsay [message]");
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
if (helper[playerid] == 1)
{
format(tmp2, sizeof(tmp2), "say %s", tmp);
format(string, sizeof(string), "* Junior Helper: %s", tmp);
SendClientMessageToAll(COLOR_HELPER, string);
}
if (helper[playerid] == 2)
{
format(tmp2, sizeof(tmp2), "say %s", tmp);
format(string, sizeof(string), "* Senior Helper: %s", tmp);
SendClientMessageToAll(COLOR_HELPER, string);
}
printf("[ssay] %s: %s", playername, tmp);
return 1;
}
//this is helpers chat here helpers can do chatting
CMD:hc(playerid, params[])
{
new tmp[256], tmp2[256], playername[25];
if (helper[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: You aren't a helper.");
if (sscanf(params, "s[128]", tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /hc [message]");
if (helper[playerid] == 1)
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
format(tmp2, sizeof(tmp2), "Junior Helper [%s] %s", playername, tmp);
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) && helper[i] == 1) SendClientMessage(i, COLOR_HELPER, tmp2);
}
if (helper[playerid] == 2)
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
format(tmp2, sizeof(tmp2), "Senior Helper [%s] %s", playername, tmp);
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) && helper[i] == 2) SendClientMessage(i, COLOR_HELPER, tmp2);
}
printf(tmp2);
return 1;
}
//by doing /hduty player will go on helpers duty and then if other players need help they cn do /ask
CMD:hduty(playerid, params[])
{
new playername[MAX_PLAYER_NAME], string[270];
if (helper[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: You aren't a helper.");
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
if(GetPVarInt(playerid, "helperduty") == 0)
{
SetPVarInt(playerid, "playercolor", GetPlayerColor(playerid));
SetPlayerColor(playerid, COLOR_HELPER);
SetPVarInt(playerid, "helperduty", 1);
format(string, 64, "%s is now helper on duty, use /ask if you need any help!", playername, "");
SendClientMessageToAll(COLOR_HELPER,string);
}
else
{
SetPlayerColor(playerid, GetPVarInt(playerid, "playercolor"));
SetPVarInt(playerid, "helperduty", 0);
format(string, 64, "%s is now helper off duty.", playername);
SendClientMessageToAll(COLOR_HELPER,string);
}
return 1;
}
//this cmd allows you to pm other players
CMD:pm(playerid, params[])
{
new tmp[160], giveplayerid, giveplayer[25], playername[25],string[256];
if(helper[playerid] == 0) return 0;
GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
if (sscanf(params, "us[160]", giveplayerid, tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /pm [playerid] [message]");
if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "Error: Inactive player id!");
if (giveplayerid == playerid) return SendClientMessage(playerid, COLOR_RED, "Error: You can't send private message to your self!");
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
format(string, sizeof(string), "{E6E600}PM from %s(%d): %s", playername, playerid, tmp);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
format(string,sizeof(string), "{FFFF00}PM to %s(%d): %s", giveplayer, giveplayerid, tmp);
SendClientMessage(giveplayerid, COLOR_YELLOW, "You can use /pmr [message] for fast reply.");
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
//by this players can ask question about ur server or if they need help
CMD:ask(playerid, params[])
{
new tmp[254],string[200],playername[64],moneys1;
if (sscanf(params, "s[128]", tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /ask [message]");
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (!IsPlayerConnected(i) || helper[i] == 0) continue;
{
format(string, sizeof(string), "%s (Id%d) asked: %s", playername, playerid, tmp);
SendClientMessage(i, COLOR_HELPER, string);
}
moneys1 ++;
}
if (moneys1 != 0)
{
format(string, 64, "You asked: %s", tmp, "");
SendClientMessage(playerid, COLOR_HELPER,string);
printf("[ask] %s (Id%d) %s", playername, playerid, tmp);
conversation[playerid] = 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "There are currently no helpers online.");
}
return 1;
}
//by this cmd you can end the ask
CMD:askend(playerid,params[])
{
if(conversation[playerid] == 0) return SendClientMessage(playerid,COLOR_RED,"Error: You are not talking to a helper.");
conversation[playerid] = 0;
SendClientMessage(playerid,COLOR_RED,"You have ended your conversation with the helpers team.");
return 1;
}
//by this command players can see how much helpers online and who is online
CMD:hdos(playerid, params[])
{
new moneys1, string[128], string1[270];
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if (helper[i] == 1)
{
moneys1 ++;
}
else if(helper[i] == 2)
{
moneys1++;
}
}
}
if (moneys1 != 0)
{
SendClientMessage(playerid, COLOR_HELPER, "Current Online Help Desk Operators:");
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if (helper[i] == 1)
{
format(string, 128, "Junior Helper: %s(%d) {FFFFFF}[Level 1]", Players(i), i);
SendClientMessage(playerid, COLOR_HELPER, string);
}
else if (helper[i] == 2)
{
format(string1, 128, "Senior Helper: %s(%d) {FFFFFF}[Level 2]", Players(i), i);
SendClientMessage(playerid, COLOR_HELPER, string1);
}
}
}
}
else SendClientMessage(playerid, COLOR_RED, "There are currently no help desk operators online.");
return 1;
}
SA-MP Team for a_samp.inc
Y_Less and Emmet_ for sscanf2.inc
DracoBlue for Dini.inc
ZeeX for Zcmd.inc