PDA

View Full Version : Small Problem


DriftboyZ
04/10/2011, 06:59 AM
Hello, need little help here. I have a /helpme command which shows the dialog, player can type problem and send it to admin. But for some reason when player types i am not receiving the text. Any can tell what maybe the problem?


Dialog

if(strcmp(cmd, "/helpme", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(Mute[playerid] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, " You can't speak, you have been silenced !");
return 1;
}
else
{
if (Requesting_Help[playerid] == 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "Warning: You already have one helpme request waiting for response!");
if (HelperTimer[playerid] > 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "Warning: You have to wait before submitting another Help Request!");
new helpmediatext[500];
format(helpmediatext, sizeof(helpmediatext), "You are requesting help, please do the following:\n -Write down your problem/question; \n -Your question must be clear; \n -Your question must be easy to read.");
ShowPlayerDialog(playerid, DIALOG_HELPME, DIALOG_STYLE_INPUT, "Help Request", helpmediatext, "Send", "Cancel");
return 1;
}


}
return 1;
}




Dialog Response


if(dialogid == DIALOG_HELPME)
{
if(response == 1)
{
if(strlen(inputtext) > 8)
{
new helpmetext[128];


Requesting_Help[playerid] = 1;
format(helpmetext, sizeof(helpmetext),"%s(ID:%i) is requesting help:%s",PlayerName(playerid),playerid,inputtext);
SendHelperMessage(COLOR_RED, helpmetext);
SendHelperMessage(COLOR_RED, "Type /ahm to accept his help request.");
HelperTimer[playerid] = 60;




}
else
{
SendClientMessage(playerid,COLOR_LIGHTRED, "ERROR: Your message is too short, it must contain at least 8 characters");
}
}
if(response == 0)
{
SendClientMessage(playerid, COLOR_RED, "Action Canceled");
return 1;
}

Wesley221
04/10/2011, 07:01 AM
SendHelperMessage(Color, Text[])
{
foreach(Player, i)
{
if( IsPlayerHelper( i ) )
{
SendClientMessage( i, Color, Text );
}
}
return 0;
}
Does your helper function looks like this?

System64
04/10/2011, 07:03 AM
are you logged in as admin or what ever?show SendHelperMessage function
and little cleaner code:
if(dialogid == DIALOG_HELPME)
{
if(!response) return 0;
if(strlen(inputtext) < 8) return SendClientMessage(playerid,COLOR_LIGHTRED, "ERROR: Your message is too short, it must contain at least 8 characters");
new helpmetext[128];
Requesting_Help[playerid] = 1;
format(helpmetext, sizeof(helpmetext),"%s(ID:%i) is requesting help:%s",PlayerName(playerid),playerid,inputtext);
SendHelperMessage(COLOR_RED, helpmetext);
SendHelperMessage(COLOR_RED, "Type /ahm to accept his help request.");
HelperTimer[playerid] = 60;
}

GrimR
04/10/2011, 07:03 AM
Why don't you just have them do /helpme text and pull the text out and
send/admin broadcast it, then you dont need to worry about showing and interpreting dialog.

System64
04/10/2011, 07:06 AM
Why don't you just have them do /helpme text and pull the text out and
send/admin broadcast it, then you dont need to worry about showing and interpreting dialog.

Maybe because thye can't spam with /helpme, than they must type it in dialog again and again (if they want spam)
also give /ahm command here

GrimR
04/10/2011, 07:08 AM
They should have spam prevention in place anyway lol

DriftboyZ
04/10/2011, 07:13 AM
Oh my... -__- I am so stupid, i forgot its a SendHelperMessage function.. it sends it to available Helpers and not admin...

I am logged in as Admin. Thanks anyways guys :P