Hi There,
Can you guys help me with by code below.
I'm trying to get NickName/username of player close to me,I dont know what I am doing wrong.
When l do this :
CatchEvent OnLapperStart()
OnLapperStart_Ctrack();
EndCatchEvent
CatchEvent OnMSO( $userName, $text ) # Player event
$idxOfFirtsSpace = indexOf( $text, " ");
IF( $idxOfFirtsSpace == -1 ) THEN
$command = $text;
$argv = "";
ELSE
$command = subStr( $text,0,$idxOfFirtsSpace );
$argv = trim( subStr( $text,$idxOfFirtsSpace ) );
ENDIF
SWITCH( $command )
CASE "!t":
$players = GetListOfPlayers("U");
FOREACH($play IN $players)
$distance = trackuserdistance($play,$userName);
IF ($distance <=5)
THEN
globalMsg("^6Twin ".GetCurrentPlayerVar("NickName")."^6 and ".GetPlayerVar($play,"NickName"));
ELSE
privMsg("No nearby Cars");
ENDIF
ENDFOREACH
BREAK;
ENDSWITCH
EndCatchEvent
I get Current user/player nickname but not the other player and even if the distance between the players is not less than 5 the code in globalMsg still execute.
Thank you.
Can you guys help me with by code below.
I'm trying to get NickName/username of player close to me,I dont know what I am doing wrong.
When l do this :
CatchEvent OnLapperStart()
OnLapperStart_Ctrack();
EndCatchEvent
CatchEvent OnMSO( $userName, $text ) # Player event
$idxOfFirtsSpace = indexOf( $text, " ");
IF( $idxOfFirtsSpace == -1 ) THEN
$command = $text;
$argv = "";
ELSE
$command = subStr( $text,0,$idxOfFirtsSpace );
$argv = trim( subStr( $text,$idxOfFirtsSpace ) );
ENDIF
SWITCH( $command )
CASE "!t":
$players = GetListOfPlayers("U");
FOREACH($play IN $players)
$distance = trackuserdistance($play,$userName);
IF ($distance <=5)
THEN
globalMsg("^6Twin ".GetCurrentPlayerVar("NickName")."^6 and ".GetPlayerVar($play,"NickName"));
ELSE
privMsg("No nearby Cars");
ENDIF
ENDFOREACH
BREAK;
ENDSWITCH
EndCatchEvent
I get Current user/player nickname but not the other player and even if the distance between the players is not less than 5 the code in globalMsg still execute.
Thank you.