SA-MP Forums Archive
OnPlayerText question - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerText question (/showthread.php?tid=129946)



OnPlayerText question - Torran - 24.02.2010

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


Re: OnPlayerText question - VonLeeuwen - 24.02.2010

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

Try that


Re: OnPlayerText question - Torran - 24.02.2010

I still cant talk


Re: OnPlayerText question - Joe Staff - 24.02.2010

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;
}