/helpme command reply
#1

Hey, I can't get find out how to do it myself.. When someone does /helpme *question*, all staff gets a message *helpme from *id* *question*. Now I want staff to be able to do /helpreply *id* *answer*, how can I do that? Hopefully anyone can help me with this!

Код:
	if(strcmp(cmd, "/helpme", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(JustReported[playerid] == 1)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "Wait 10 seconds after sending a next /helpme ! ");
	            return 1;
	        }
	        GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[128];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /helpme [Question]");
				return 1;
			}
			if(PlayerInfo[playerid][pReportMuted] == 1)
			{
			    return SendClientMessage(playerid, COLOR_RED, "    You're muted from sending any /helpme's!");
			}
			JustReported[playerid] = 1;
			SetTimerEx("ReportReset", 10000, false, "i", playerid);
			format(string, sizeof(string), "Helpme from %s(%d): %s", RemoveUnderScore(playerid), playerid, (result));
			ReportBroadCast(COLOR_YELLOW2, string, 1);
			ReportBroadCast(COLOR_GREEN,"Type: /ahm [PlayerID/PartOfName] to accept or /dhm [PlayerID/PartOfName] to deny.", 1);
			SendClientMessage(playerid, COLOR_YELLOW, "Your Helpme message was sent to all the Online Staff - It will be reviewed in a few seconds.");
			
			Reported[playerid] = 1;
		}
	    return 1;
	}
Currently I got this..

Код:
        if(strcmp(cmd, "/accepthelpme", true) == 0 || strcmp(cmd, "/ahm", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 1)
	        {
	            tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
			    	SendClientMessage(playerid, COLOR_WHITE, "USAGE: /(a)(h)elp(m)e [PlayerID/PartOfName]");
			    	return 1;
				}
				giveplayerid = ReturnUser(tmp);
				if(IsPlayerConnected(giveplayerid))
				{
				    if(giveplayerid != INVALID_PLAYER_ID)
				    {
				        if(Reported[giveplayerid] == 0)
				        {
				            return SendClientMessage(playerid, -1," This player has not sent a /helpme!");
						}
        				GetPlayerName(playerid, sendername, sizeof(sendername));
						GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						AcceptedReport[playerid] = giveplayerid;
						Talkingto[giveplayerid] = playerid;
						format(string, sizeof(string), "%s Has accepted your /helpme, he will be with you shortly", RemoveUnderScore(playerid));
						SendClientMessage(giveplayerid, COLOR_YELLOW, string);
						format(string, sizeof(string), "%s has accepted %s's helpme.", RemoveUnderScore(playerid), RPN(giveplayerid));
						ReportBroadCast(COLOR_YELLOW, string);
						Reported[giveplayerid] = 0;
       				}
			 	}
	        }
	        else
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   You are not authorized to use that command !");
	            return 1;
	        }
	    }
	    return 1;
	}
Reply
#2

I'll give you an example. but I won't go through your whole code.

Alright so first define a boolean variable outside any callbacks/functions:
pawn Код:
new bool:needhelp[playerid]; // this is false for every playerid by default
Then, under /helpme:
pawn Код:
// ....Code
needhelp[playerid] = true;
Then, under /accepthelp [playerid]
pawn Код:
if(needhelp[SelectedID] == true)
{
// Code here
}
else SendClientMessage(playerid, COLOR, "That player ID didn't request help");
**Note: I recommend setting needhelp[playerid] as false, everytime under the callback OnPlayerConnect and OnPlayerDisconnect. this is to prevent errors from happening, say ID 3 requested help. helpme[3] = true now, let's say they disconnect, it would still be true for player ID 3.

that's all
+Rep if it helped.
Reply
#3

I actually got something like that, but I mean.. *someone requests a helpme* now I can just /accepthelpme it. I want to /helpreply, the player needed of help will recieve a message *helpme reply {answer}* How can I do that?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)