[Lua] Script not working

Joined
Jun 4, 2018
Messages
14
Likes
0
Points
1
Location
Netherlands
1
#1
Code:
function main()
  wait(5000)
  SampRegisterChatCommand("search",cmd)
end

function cmd(arg)
  if #arg == 0 then
      sampAddChatMessage(string.format("/search id"),FF0000)
  else
      ped = sampGetCharHandleBySampPlayerId(arg)
      positionX, positionY, positionZ = getCharCoordinates(ped)
      sampAddChatMessage(string.format("Coordinates are: ",positionX,positionY,positionZ),FF0000)
  end
end


What have I done wrong?

 
OP
OP
6jorn_
Joined
Jun 4, 2018
Messages
14
Likes
0
Points
1
Location
Netherlands
1
#2
Made a few key changes to the program that fixed this specific issue - such as

checks if the player is online
check if charExists
adding sampGetStreamedOutPlayerPos instead of getCharCoordinates
added else to that and if result of sampGetStreamedOutPlayerPos fails try getCharCoordinates instead

EDIT: removed charExists from exclusive disjunction and is now working fully functional
 
Top