Author Topic: Events System: strings  (Read 638 times)

How would you accept input from a textbox in an event?
Code: [Select]
Code
..."Player","Aimat","string 200 20"...
I know this much, but how do i get the data?

You'd better look at some existing event add-ons since this is covered in basically all of them.

yeah, but for string data would it be getlong() or getword() or what? i just need them to enter a player's name

You dont need to do anything, the arguments for an event are passed as function arguments so it'd be something like:

function Player::Aimat(%this,%something,%somethingelse,%yourstringhere)

off the top of my head. Seriously, look at some existing events like the player teleport add-on.


doesn't work. here's the code for the whole thing:
Code: [Select]
registerOutputEvent("Player", "AimAt", "string 200 200", 1);

function Player::AimAt(%client,%playername){

%client.player.SetAimObject(findclientbyname(%playername).player );

}

In the console it says:
Code: [Select]
Unable to find object ' ' attempting to call function 'SetAimObject'
Unable to find object ' ' attempting to call function 'SetAimObject'
Unable to find object ' ' attempting to call function 'SetAimObject'
Unable to find object ' ' attempting to call function 'SetAimObject'
Unable to find object ' ' attempting to call function 'SetAimObject'
...
repeatedly for as long as the bot is on the brick

I'm not going to help you anymore - if you'd just look at how everyone else does it, you could figure this out easily.

function Player::AimAt(%client,%playername){
%client.player
Maybe your problem starts right there.
You are trying to get the var, player, from a Player object.