[Include] Textdraw inputs - easy input using keypad & player list [0.3e]
#1

I took a look at the clickable textdraw shit and it's pretty neat tbh. I decided to use it for some sort.

YOU NEED 0.3e RC5 OR HIGHER FOR THIS TO RUN!!

I'll skip the useless text nobody reads. Here are screenshots.

Player list
The player list can be used to easily select another player, to be used in a form. Or something else, whatever suits you best. I guess it could be nice in for example vote kick or teleport commands. Administrating users wouldn't be a bad idea either. Or you could just use it to replace the tab list. Use it to your likings.

The player list comes with a function and a callback. Use InputFromPlayerList(); to show the list and allow the player to select somebody. When the player has selected somebody, the data will be passed to OnPlayerSelectPlayer.
pawn Код:
native InputFromPlayerList(playerid, event, bool:allowcancel);
// playerid - the player to use the list
// event - similar to the id when using dialogs. Use it to tell what you're doing.
// allowcancel > set this to true if you'd like to allow the user to cancel selecting
// a player from the list, returning INVALID_PLAYER_ID (An 'x' icon will appear, which the player can click on). Set it to false to disable the icon.

forward OnPlayerSelectPlayer(playerid, targetid, event);
// playerid - the player who selected another player
// targetid - the target the player selected
// event - the event you used when starting the list showing thingy.
An example of a script that bans the (selected) player.
pawn Код:
#define EVENT_BAN 1
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp(cmdtext, "/ban", true))
  {
    InputFromPlayerList(playerid, EVENT_BAN, true);
    return 1;
  }
  return 0;
}

public OnPlayerSelectPlayer(playerid, targetid, event) // Doesn't handle returns, btw.
{
  if(event == EVENT_BAN && targetid != INVALID_PLAYER_ID)
  {
    Ban(targetid);
  }
}
Keypad
The keypad can be used to input digits. Yes, I do say. This can be used for a lot of things, like bank PINs or calling other people if you're using a phone system. Perhaps even make babies pregnant, but I never tried that out.

The max length of the keypad input is 16 digits. The amount of max digits can be controlled. Like the player list, it comes with a function to enable it and a callback to output all data.
pawn Код:
native InputFromKeypad(playerid, event, len, bool:allowcancel);
// playerid - see player list
// event - see player list
// minlen - the minimum length of the input. Defaults to 1 if between
// maxlen - the max length of the input. Choose from a range between 1 and 16. Invalid values default to 16.
// allowcancel - see player list

forward OnPlayerKeypadInput(playerid, input[], event);
// playerid - the player who used the keypad to input something
// input - Whatever number the player has put in.
// event - The event you use.. See player list
Since 1.0.5:
A note on the length parameters: If minlen is zero or below zero, it'll default to 1.
OnPlayerKeypadInput returns the input in a string (!), instead of an integer, because 32 bit integers can't be longer than 10 digits. If you're using a maxlen of 9 or below, you can simply use strval. (You most probably won't need to input up to 16 chars anyway)

Guess that'll get ya going. Here's an example though:
pawn Код:
#define EVENT_SETHP 2
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp(cmdtext, "/sethp", true))
  {
    InputFromKeypad(playerid, EVENT_SETHP, 1, 2 true);
    return 1;
  }
  return 0;
}

public OnPlayerKeypadInput(playerid, input[], event) // Doesn't handle returns, btw.
{
  if(event == EVENT_SETHP)
  {
    SetPlayerHealth(playerid, floatstr(input));
  }
}
Misc
If you want the player to do something else than input stuffs, you can cancel it this way:
pawn Код:
native CancelInput(playerid);
Download
Use this SolidFiles link and put the include in the /pawno/include folder.

SolidFiles
Pastebin.com

Changelog
1.0.5 -
Updates to PVars, which in this script would be better.
If the player is allowed to close the input, pressing escape will do the trick as well.
Fixed a possible, but not confirmed bug regarding players joining/leaving and not updating the player list.
It's possible to stop a player from inputting something, using CancelInput.
Doesn't need the use of a filterscript anymore, include it in any script!


1.0 -
Initial release


Archive
1.0 SolidFiles (initial release, requires you to use InputInit before use. Definitely not recommended)

Credits
Special credits go to..
- Kar (testing)
- Jochemd (testing)
- Approx 140 bots (testing)
Reply
#2

Nice release!
Reply
#3

Here you go again.
Reply
#4

Nice release. I love your random jokes all around
Reply
#5

Nice, gonna use this later when 0.3e is official
Reply
#6

I have a feeling that keypad is SLIGHTLY copied.
Reply
#7

Amazing. Looks better than MP2 due to functions
Reply
#8

Personally, I think the textdraws in mine look better, this one looks rushed and simple. My keypad is for like, a 'pass' system, not for inputting a value, so it is not exactly the same, and therefore can not really be compared past the visual appeal.

EDIT: Just looked at the source, the Init function is practically exactly the same as mine. This is totally copied.
Reply
#9

Quote:
Originally Posted by MP2
Посмотреть сообщение
Personally, I think the textdraws in mine look better, this one looks rushed and simple. My keypad is for like, a 'pass' system, not for inputting a value, so it is not exactly the same, and therefore can not really be compared past the visual appeal.
bitchy. Meow.
Reply
#10

Not bitchy, I simply don't appreciate my work being edited and passed off as someone elses.

Awaiting Hiddos' response on this.
Reply
#11

Quote:
Originally Posted by MP2
Посмотреть сообщение
Not bitchy, I simply don't appreciate my work being edited and passed off as someone elses.

Awaiting Hiddos' response on this.
You can't do anything, let's suppose he stole your idea but the codes are totaly different he doesn't need any permission to release this. I'm just telling you
Reply
#12

Quote:
Originally Posted by MP2
Посмотреть сообщение
Personally, I think the textdraws in mine look better, this one looks rushed and simple. My keypad is for like, a 'pass' system, not for inputting a value, so it is not exactly the same, and therefore can not really be compared past the visual appeal.

EDIT: Just looked at the source, the Init function is practically exactly the same as mine. This is totally copied.
No it's not. I can vouch for Hiddos, I was on MSN yesterday, and he didn't even know your thingy existed. Example: someone creates a RP server. Someone else gets the same idea's, and also creates a RP server. They both have their own script, but the same idea. An idea is an creation. Would you be mad at your neighbour for having the same car as you do? Of course not. Think.
Reply
#13

COOL WORK!
Reply
#14

Quote:
Originally Posted by robintjeh
Посмотреть сообщение
No it's not. I can vouch for Hiddos, I was on MSN yesterday, and he didn't even know your thingy existed. Example: someone creates a RP server. Someone else gets the same idea's, and also creates a RP server. They both have their own script, but the same idea. An idea is an creation. Would you be mad at your neighbour for having the same car as you do? Of course not. Think.
I think you should ****** 'intellectual property', because gathering from what you just said, you are totally clueless as to what you are talking about.

If he came up with the idea himself, kudos to him, but I've looked at the code and a lot of it is laid out similar to mine.
Reply
#15

I definitely didn't edit anything, nor do I think I 'stole' anything. I had the idea to create a keypad, just like you (Matter of fact, I already thought of a system like it before you posted your first video).

Actually, looking at your code, I only see one point where your textdraws get created. Whereas in my code I create the keypad at one point, and create a input line only at the stage where the player really starts using the system. Furthermore, there are a lot of other structural differences between our codes.

Quote:
Originally Posted by MP2
Посмотреть сообщение
Personally, I think the textdraws in mine look better, this one looks rushed and simple.
If you think your system looks better, what's the problem about it? I indeed rushed my textdraws a bit, but still to a point where I think it looks nice. I made them the way I wanted it to look, you made yours the way you wanted yours to look.
Reply
#16

Nice work
Reply
#17

So you knew about my first video then, interesting.


Quote:
Originally Posted by Hiddos
Посмотреть сообщение
I had the idea to create a keypad, just like you (Matter of fact, I already thought of a system like it before you posted your first video).
I highly doubt that. I had this idea in ~2009, and created a similar thing using arrow keys.

Anyway, at the risk of starting a flame war, I'm out.
Reply
#18

very nice! Thanks.
Reply
#19

Quote:
Originally Posted by MP2
Посмотреть сообщение
So you knew about my first video then, interesting.


I highly doubt that. I had this idea in ~2009, and created a similar thing using arrow keys.
By 'first video' I was referring to the one you posted just a few days ago showing your system we're currently bitching about.

I guess we're done talking? I never copied anything, just created a similar system.
Reply
#20

You, MP2, my friend, could do some hell of a work at a anti-piracy cooperation.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)