vp_world_list
Jump to navigation
Jump to search
Method call snippet
vp_world_list(instance, time);
Request the world list.
Parameters
These are the parameters that this method requires:
Parameter | Usage |
---|---|
VPInstance instance |
Pointer to the instance this method call is intended for |
int time |
Time since your last update. This is not used yet, the whole list will be requested. |
Returns
This method returns a return code integer, which indicates whether the call was successful or errored for any reason:
Return code | Cause |
---|---|
VP_RC_SUCCESS |
Successful call (for methods that have a registered callback, it only means the request has been sent) |
Behavior
The worlds will be listed in the VP_EVENT_WORLD_LIST
event. See vp_event_set()
.
Examples
void handle_world_list(VPInstance sdk)
{
const char *name;
int users, state;
name = vp_string(sdk, VP_WORLD_NAME);
users = vp_int(sdk, VP_WORLD_USERS);
state = vp_int(sdk, VP_WORLD_STATE);
printf("World \"%s\" has %d user%s and state %d\n", name, users, users != 1 ? "s" : "", state);
}
int main(int argc, const char* argv[])
{
//...
vp_event_set(sdk, VP_EVENT_WORLD_LIST, handle_world_list);
vp_world_list(sdk, 0);
//...
}