Community Resources: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 19: Line 19:
Info:
Info:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
int groupID
string "info", int groupID
</syntaxhighlight>  
</syntaxhighlight>  
'''Returns 5 values:'''<br />
'''Returns 5 values:'''<br />
Line 31: Line 31:
Members list:
Members list:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
int groupID
string "members", int groupID
</syntaxhighlight>  
</syntaxhighlight>  
'''Returns:''' a table of usernames in the group
'''Returns:''' a table of usernames in the group
Line 42: Line 42:
Latest resource version:
Latest resource version:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
string resourceName
string "version", string resourceName
</syntaxhighlight>  
</syntaxhighlight>  
'''Returns:''' an integer, resource version. 0 if an error has occured
'''Returns:''' an integer, resource version. 0 if an error has occured

Revision as of 11:32, 19 March 2008

Community calls documentation

using callRemote

community.mtasa.com/mta/verify.php

Calls:

User validation:

player thePlayer, string Username, string Serial

Returns: an integer, 1 if user is valid, 0 otherwise


community.mtasa.com/mta/groups.php

Calls:

Info:

string "info", int groupID

Returns 5 values:
1. Group name
2. Owner username
3. Number of members
4. Public. Integer: 1 if the group is public, 0 otherwise
5. Registration time


Members list:

string "members", int groupID

Returns: a table of usernames in the group


community.mtasa.com/mta/resources.php

Calls:

Latest resource version:

string "version", string resourceName

Returns: an integer, resource version. 0 if an error has occured


Example

addEventHandler ( "onPlayerJoin", getRootElement(), function()
  local username = getPlayerUserName ( source )
  local serial = getPlayerSerial ( source
  callRemote ( "http://community.mtasa.com/mta/verify.php", validatePlayer, source, username, serial )
end )

function validatePlayer ( player, result )
  local valid = "invalid"
  if ( result == 1 ) then valid = "valid" end
  outputChatBox ( getClientName ( player ).."'s username is "..valid )
end