SA-MP Forums Archive
Command without / - 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: Command without / (/showthread.php?tid=85995)



Command without / - Abernethy - 11.07.2009

Hey guys.
I'm working on a IG Computer System for Roleplay servers. Once you're booted into the Computer, you will have a bunch of things you can goto. By typing eg, "Jobs" which will display info about Jobs. The problem is, I've never attempted this before & am not sure how to make the actual OnPlayerText & how to detect if they've typed "Jobs". Something like if(strcmp("Jobs", true))
Hell, I have no idea.
Thanks


Re: Command without / - Anarkien - 11.07.2009

Quote:
Originally Posted by Abernethy
Hey guys.
I'm working on a IG Computer System for Roleplay servers. Once you're booted into the Computer, you will have a bunch of things you can goto. By typing eg, "Jobs" which will display info about Jobs. The problem is, I've never attempted this before & am not sure how to make the actual OnPlayerText & how to detect if they've typed "Jobs". Something like if(strcmp("Jobs", true))
Hell, I have no idea.
Thanks
If you're ever able to make something like that, I think we're all going to be very impressed.
Good luck.


Re: Command without / - Abernethy - 11.07.2009

It's honestly not that hard.
Oh, I see. I think you're thinking it's going to be like the real internet. No, it's not.
You just approach on of the 46 computers at the Cityhall. Type /pc & you log on. Once you've logged on you type a Category, then it will give you some information about it. Whatever, roleplay servers would be able to get jobs via the "Internet". Once you've done, type /logout & then you're free to roam around again.


Re: Command without / - Westie - 11.07.2009

Just treat OnPlayerText as if it was OnPlayerCommandText itself. You need to be reminded that you must return false after doing this, otherwise it would be ejected into global chat.

Here's a little example.

pawn Код:
public OnPlayerText(playerid, text[])
{
  if(aPlayer[playerid][bAtComputer]) // Make your own variable here...
  {
    // Your code here
    return false;
  }

  return true;
}



Re: Command without / - saiberfun - 11.07.2009

dang u weree faster than me /^We(stie|z+[e|a]r)$/ XD



Re: Command without / - Abernethy - 11.07.2009

Look.
I forgot where I saw the code before, so i need your help.
I've already got when they type /pc it's about 850+ lines. All I'm doing is this.
pawn Код:
public OnPlayerText(playerid, text[])
{
    //if(WhatTextDoIPlaceHereToDetect, like, if(strcmp"Games" seriously, I have no idea.
    {
      if (PlayerOnPC[playerid] == 1)
      {
        SendClientMessage(playerid, COLOR_BLUE, "| |______|CONNECTED|______| |");
          SendClientMessage(playerid, COLOR_YELLOW, "-GAMING CARD EXPIRED");
          SendClientMessage(playerid, COLOR_WHITE, "We're sorry, but your gaming");
          SendClientMessage(playerid, COLOR_WHITE, "card as expired. Please try");
      SendClientMessage(playerid, COLOR_WHITE, "purchasing another.");
      SendClientMessage(playerid, COLOR_WHITE, " ");
      SendClientMessage(playerid, COLOR_YELLOW, "  Coming 17/9/1992 ");
          SendClientMessage(playerid, COLOR_YELLOW, "   *+* Pacman *+*");
        SendClientMessage(playerid, COLOR_BLUE, "|___________________________|");
        }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, "** You are not Connected to a Computer.");
    }
    return 1;
}



Re: Command without / - happyface - 11.07.2009

Quote:
Originally Posted by Abernethy
Ah don't worry, guys, I'll do a shitload of searching.
i think you were on the right track, although this might not be working, something like

pawn Код:
public OnPlayerText(playerid, text[])
{

    if(strcmp(text, "jobs", true) == 0)
    {
        //...
    }
   
    return 1;
}



Re: Command without / - Abernethy - 11.07.2009

Quote:
Originally Posted by happyface
Quote:
Originally Posted by Abernethy
Ah don't worry, guys, I'll do a shitload of searching.
i think you were on the right track, although this might not be working, something like

pawn Код:
public OnPlayerText(playerid, text[])
{

    if(strcmp(text, "jobs", true) == 0)
    {
        //...
    }
   
    return 1;
}
/win. Compiled, without an error/warning. Lets see if it works, shall we.

EDIT: Okay, working good.
If I don't want him to say the word "Games", shall I just mute him than unmute the player during the time he types "Games"?


Re: Command without / - Westie - 11.07.2009

That'll do stuff even when you're not at a computer. If you just randomly type jobs, that would come up.

Quote:
Originally Posted by Abernethy
Look.
I forgot where I saw the code before, so i need your help.
I've already got when they type /pc it's about 850+ lines. All I'm doing is this.
pawn Код:
public OnPlayerText(playerid, text[])
{
  //if(WhatTextDoIPlaceHereToDetect, like, if(strcmp"Games" seriously, I have no idea.
  {
    if (PlayerOnPC[playerid] == 1)
    {
      SendClientMessage(playerid, COLOR_BLUE, "| |______|CONNECTED|______| |");
      SendClientMessage(playerid, COLOR_YELLOW, "-GAMING CARD EXPIRED");
      SendClientMessage(playerid, COLOR_WHITE, "We're sorry, but your gaming");
      SendClientMessage(playerid, COLOR_WHITE, "card as expired. Please try");
      SendClientMessage(playerid, COLOR_WHITE, "purchasing another.");
      SendClientMessage(playerid, COLOR_WHITE, " ");
      SendClientMessage(playerid, COLOR_YELLOW, "  Coming 17/9/1992 ");
      SendClientMessage(playerid, COLOR_YELLOW, "   *+* Pacman *+*");
       SendClientMessage(playerid, COLOR_BLUE, "|___________________________|");
    }
  }
  else
  {
  SendClientMessage(playerid, COLOR_GREY, "** You are not Connected to a Computer.");
  }
  return 1;
}
That's the closest you have got to something working...
Again, my example.

pawn Код:
public OnPlayerText(playerid, text[])
{
  if(PlayerOnPC[playerid] == 1)
  {
    if(!strcmp(text, "Games", true))
    {
      // game code here
    }
   
    return false;
  }
 
  return true;
}
Hope it can help you.