OnPlayerText question
#1

pawn Code:
public OnPlayerText(playerid, text[])
{
    if(CallEmergency[playerid] == 1)
    {
    if(!strcmp("police", text, true))
    {
    CallEmergency[playerid] = 0;
    PoliceSelect[playerid] = 1;
    SendClientMessage(playerid, COLOR_RED, "Please type in your situtation, Remember to include your location");
    }
    else if(!strcmp("paramedic", text, true))
    {
    CallEmergency[playerid] = 0;
    ParamedicSelect[playerid] = 1;
    SendClientMessage(playerid, COLOR_RED, "Please type in your situtation, Remember to include your location");
    }
    }
    else if(PoliceSelect[playerid] == 1)
    {
    PoliceSelect[playerid] = 0;
    new name[MAX_PLAYER_NAME];
    new string[300];
    GetPlayerName(playerid, name, sizeof(name));
    SendClientMessage(playerid, COLOR_RED, "Your message has been confirmed and sent, Thankyou");
    format(string, sizeof(string), "911 Call: (%s) %s", name, text);
    SendTeamMessage(TEAM_POLICE, COLOR_ORANGE, string);
    }
    else if(ParamedicSelect[playerid] == 1)
    {
    ParamedicSelect[playerid] = 0;
    new name[MAX_PLAYER_NAME];
    new string[300];
    GetPlayerName(playerid, name, sizeof(name));
    SendClientMessage(playerid, COLOR_RED, "Your message has been confirmed and sent, Thankyou");
    format(string, sizeof(string), "911 Call: (%s) %s", name, text);
    SendTeamMessage(TEAM_MEDIC, COLOR_ORANGE, string);
    }
    return 0;
}
Now you cant say anything except that in the code above, But thats only if you say /911,
So how can i make it return 0; on them things but return 1; on onplayertext itself
Reply
#2

http://pawn.pastebin.com/0pkNyT2F

Try that
Reply
#3

I still cant talk
Reply
#4

Proper Indentation can go a long way.
pawn Code:
public OnPlayerText(playerid, text[])
{
  if(CallEmergency[playerid] == 1)
  {
    if(!strcmp("police", text, true))
    {
      CallEmergency[playerid] = 0;
      PoliceSelect[playerid] = 1;
      SendClientMessage(playerid, COLOR_RED, "Please type in your situtation, Remember to include your location");
    }
    else if(!strcmp("paramedic", text, true))
    {
      CallEmergency[playerid] = 0;
      ParamedicSelect[playerid] = 1;
      SendClientMessage(playerid, COLOR_RED, "Please type in your situtation, Remember to include your location");
    }
    return 0;
  }
  else if(PoliceSelect[playerid] == 1)
  {
    PoliceSelect[playerid] = 0;
    new name[MAX_PLAYER_NAME];
    new string[300];
    GetPlayerName(playerid, name, sizeof(name));
    SendClientMessage(playerid, COLOR_RED, "Your message has been confirmed and sent, Thankyou");
    format(string, sizeof(string), "911 Call: (%s) %s", name, text);
    SendTeamMessage(TEAM_POLICE, COLOR_ORANGE, string);
    return 0;
  }
  else if(ParamedicSelect[playerid] == 1)
  {
    ParamedicSelect[playerid] = 0;
    new name[MAX_PLAYER_NAME];
    new string[300];
    GetPlayerName(playerid, name, sizeof(name));
    SendClientMessage(playerid, COLOR_RED, "Your message has been confirmed and sent, Thankyou");
    format(string, sizeof(string), "911 Call: (%s) %s", name, text);
    SendTeamMessage(TEAM_MEDIC, COLOR_ORANGE, string);
    return 0;
  }
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)