View Full Version : Gani script question

02-04-2007, 01:15 AM

I'm using player.attr to attach a scripted gani to players.

In the gani the player object refers to the player to which the gani belongs. This is fine, but how can I access the player of the person viewing the gani?

For example, the gani shows an image but i dont want the person to see the image attached to themselves.

I want to do something like:

if (client.player == player) {
findimg(200).alpha = 0;

Where client.player is the reference to the player viewing the gani rather than the player who has the gani set in player.attr.

02-04-2007, 09:00 AM
Use params inside the player.attr.

If (params[0] == player.account)

02-04-2007, 06:21 PM
How do i actually set the params in player.attr?

02-04-2007, 09:26 PM
Simpliest solution would be to set some global variable to the player or player account, e.g. in the System-Weapon you do "localplayer = player;". The gani script can access all variables, so you just would need to check "if (player==localplayer)...". The "player" variable in gani script is the object to which the gani belongs, it can be the local player, other players, or even npcs or projectiles.

Another way (more complex) would be to set player.attr[1] to the gani script, and e.g. use player.attr[2] to the account name of the player, but that would be redundant and better be solved by the first way I have described. You can also pass parameters directly to the gani script without using another attr[], you would need to do something like "player.attr[1] = "myani.gani,1,2,3";" and in the gani script you get the parameters in onPlayerEnters(param1,param2,param2), I have not tested that a lot though (it works definitely if you use if (playerenters) and check for params[])