Results 1 to 5 of 5

Thread: Help getcreatures Action works when him want

  1. #1
    Normal User
    Join Date
    Apr 2012
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    5

    Help getcreatures Action works when him want

    I don't know why my action works only when him want.
    I want to get name of the player in certain location, for test i make my character say the name.

    PHP Code:
    function Pegarjogador()
      
    local  player getcreatures('ps')
      
    local playercount player.count-1
      
    if (iscreatureontile(posx+2,posy,posz))then
            
    for i=0playercount do
               
    local name player[i].name
               local playerx 
    player[i].x
               local playery 
    player[i].y
               local playerz 
    player[i].z
               
    if (playerx == posx+and playery == posy and playerz == poszthen
                   say
    (name)
               
    end
            end
         end  
    end 
    Last edited by Sajean; 02-11-2014 at 09:57 PM.

  2. #2
    iBot User
    Join Date
    Aug 2012
    Posts
    805
    Mentioned
    18 Post(s)
    Tagged
    2 Thread(s)
    Quoted
    38 Post(s)
    Reputation
    180
    Rep Power
    7
    you put it as action with 800-1000 spam rate? If yes then delete 'function', you can put function in setup and add action with only function name

  3. #3
    iBot User walukasz's Avatar
    Join Date
    Feb 2012
    Location
    Poland
    Posts
    312
    Mentioned
    39 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    25 Post(s)
    Reputation
    67
    Rep Power
    5
    I believe you know you have to execute function, declaring is not enough.
    I think you are using "name" as variable name which is already taken by ibot variables for your character name, but it's not the case either. I didn't fix your function, I made you new one, that requires sirmates library. It returns name of player on that position or false, I think you will be able to edit it to suit ur needs.

    Code:
    function getName()
    	for PLAYER in Creature.GetAll("ps") do
    		if PLAYER:PositionX() == posx+2 and PLAYER:PositionY() == posy and PLAYER:PositionZ() == posz then
    			return PLAYER:Name()
    		end
    	end
            return false
    end

    actually your action seems to work all the time ;p
    Last edited by walukasz; 02-09-2014 at 05:06 AM.

  4. #4
    Normal User
    Join Date
    Apr 2012
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    5
    @shanp, yes i make this in action spam rate 800-1000 but i'm only testing i will put all functions in setup, but thank you.
    @walukas i will test your function, i try to make this without sirmate library but i will try, thank you. As i said, when i testing function works, but when i try again him stoped.
    Thank you.

  5. #5
    Normal User
    Join Date
    Apr 2012
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    5
    Thank you for all help, now i can use the script, i using my script and change to setup works fine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •